環境准備基本環境:ubuntu-14.04-desktop-64bit LTS
其他要求:空閒磁盤空間100G以上,我裝的是win7+ubuntu雙系統,分了180G給ubuntu.
=============================
環境初始化=============================
1. 安裝Oracle JDK下載jdk-6u45-linux-x64.bin
下載後,修改權限
chmod 777 jdk-6u45-linux-x64.bin
./jdk-6u45-linux-x64.bin
創建java目錄
$ sudo mkdir -p /usr/local/java
將你下載的jdk-6u45-linux-x64.bin拷貝至/usr/local/java目錄
$ cd /usr/local/java
$ sudo cp /home/dennis/Downloads/jdk-6u45-linux-x64.bin .
解壓bin文件
$ sudo chmod +x jdk-6u45-linux-x64.bin
$ sudo ./jdk-6u45-linux-x64.bin
$ sudo rm -rf jdk-6u45-linux-x64.bin
配置JAVA_HOME和PATH環境變量
$ sudo vim /etc/profile
在該文件的末尾加上如下部分:
JAVA_HOME=/usr/local/java/jdk1.6.0_45
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
配置ubuntu的JDK和JRE的位置
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.6.0_45/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.6.0_45/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.6.0_45/bin/javaws" 1
配置Oracle為系統默認JDK/JRE
$ sudo update-alternatives --set java /usr/local/java/jdk1.6.0_45/bin/java
$ sudo update-alternatives --set javac /usr/local/java/jdk1.6.0_45/bin/javac
$ sudo update-alternatives --set javaws /usr/local/java/jdk1.6.0_45/bin/javaws
配置完成後,執行如下命令使其立即生效。
$ . /etc/profile
再次執行"java -version"顯示如下:
dennis@dubuntu1404:~$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
=============================
2.安裝必備工具軟件$sudo apt-get install build-essential u-boot-tools binutils-arm-linux-gnueabihf gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf libusb-1.0-0 libusb-1.0-0-dev git wget fakeroot kernel-package zlib1g-dev libncurses5-dev
$sudo apt-get install build-essential git u-boot-tools texinfo texlive ccache zlib1g-dev gawk bison flex gettext uuid-dev
============
$sudo apt-get install ia32-libs
現在沒有可用的軟件包 ia32-libs,但是它被其它的軟件包引用了。
這可能意味著這個缺失的軟件包可能已被廢棄,
或者只能在其他發布源中找到
可是下列軟件包取代了它:
lib32z1 lib32ncurses5 lib32bz2-1.0
E: 軟件包 ia32-libs 沒有可供安裝的候選者
我換成下面2個了
$sudo apt-get update
$sudo apt-get upgrade
============
$sudo apt-get install ncurses-dev=============================
3.Uboot鏡像制作工具下載安裝$sudo apt-get install uboot-mkimage
現在沒有可用的軟件包 uboot-mkimage,但是它被其它的軟件包引用了。
這可能意味著這個缺失的軟件包可能已被廢棄,
或者只能在其他發布源中找到
可是下列軟件包取代了它:
u-boot-tools:i386 u-boot-tools
E: 軟件包 uboot-mkimage 沒有可供安裝的候選者
$sudo apt-get install u-boot-tools:i386
=============================
4.編譯內核編譯手冊:
X:\android\device\softwinner\polaris-common\Documents\A33\Firmwareandroid 系統編譯可分為兩部分:一部分是 linux 內核編譯(lichee) ;另 一部分是 android 源碼編譯| -- android --- android 源碼
| -- lichee --- linux 內核
| |-- buildroot
| ………..
| |-- build.sh
| |-- linux-3.0
| |-- out --- 生成鏡像文件的目錄,編譯成功就會生成此目錄
安裝了jdk
第一步: cd lichee (apt-get install uboot-mkimage需要安裝mkimage工具
source buildroot/scripts/mksetup.sh
Welcome to mkscript setup progress
All available chips:
0. sun8iw5p1
Choice: 0
All available platforms:
0. android
1. dragonboard
2. linux
Choice: 0
All available kernel:
0. linux-3.4
Choice: 0
All available boards:
0. base_config
1. config_option
2. evb
3. maple
4. projects
5. redwood
6. y2
7. y3
Choice: 7
編譯licheemklichee
regenerate rootfs cpio
8772 blocks
9475 blocks
build_ramfs
Copy boot.img to output directory ...
Copy modules to target ...
INFO: build kernel OK.
INFO: build rootfs ...
INFO: skip make rootfs for android
INFO: build rootfs OK.
INFO: ----------------------------------------
INFO: build lichee OK.
INFO: ----------------------------------------
(內核編譯完成)
========
單獨編譯buildroot
mkbr
編譯過程
INFO: build buildroot ...
external toolchain has been installed
INFO: build buildroot OK.
單獨編譯內核
mkkernel
8772 blocks
9475 blocks
build_ramfs
Copy boot.img to output directory ...
Copy modules to target ...
INFO: build kernel OK.
(至此,內核編譯完成)
=============================
cd lichee/brandy/u-boot-2011.09/
make distclean
make sun8iw5p1_config
make -j2
當編譯成功,生成的u-boot-sun8iw5pl.bin文件會自動拷貝到對應的tool目錄下,這時候可以直接打包或者其他操作。U-boot-sun8iw5pl.bin啟動時是uboot核心可執行程序。
"u-boot-sun8iw5p1.bin" -> "/opt/item_A33/lichee/brandy/u-boot-2011.09/../../tools/pack/chips/sun8iw5p1/bin/u-boot-sun8iw5p1.bin"
=============================
lunch
出現以下設置選項,請依照設置
You're building on Linux
Lunch menu... pick a combo:
1. aosp_arm-eng
2. aosp_x86-eng
3. aosp_mips-eng
4. vbox_x86-eng
5. MID11Q9L-eng
6. MID11Q9L-user
7. astar_y3-eng
8. astar_y3-user
9. MiTraveler748-eng
10. MiTraveler748-user
11. astar_wifibt-eng
12. astar_wifibt-user
13. astar_wifionly-eng
14. astar_wifionly-user
15. aosp_hammerhead-userdebug
16. aosp_mako-userdebug
17. mini_armv7a_neon-userdebug
18. mini_mips-userdebug
19. mini_x86-userdebug
20. aosp_deb-userdebug
21. aosp_grouper-userdebug
22. aosp_tilapia-userdebug
23. aosp_flo-userdebug
24. aosp_manta-userdebug
Which would you like? [aosp_arm-eng] 5
make -j4
BUILDTYPE即編譯的模式,有一下三種:
-user:
受限的訪問,適用於發行版的產品
-userdebug:
和”user”模式類似,但是有root權限訪問並具有debug功能,適用於debug
-eng:
工程機的模式,用於在開發配置中添加新的debug工具等
=============================在android目錄下執行sourceTopwisetools.sh
然後執行:build_customall -c changjia -o ph7115編譯客戶定制軟件。
build_custom的命令參數如下:
目標
firmware 只編譯固件,會將客戶的資源文件加入到固件中
patch 只打入補丁,不編譯
revert 恢復已打入補丁,要先執行過打補丁的命令後,才能恢復打入的補丁
all 包含打入補丁,編譯固件,恢復補丁三個動作
選項:
-b lichee目錄下要打包的配置文件名
-c 客戶名稱,必須與客戶文件夾名稱一致,包括大小寫
-p android目錄要編譯的具體配置,例如polaris_wifionly
-o 訂單的具體名稱
=============================
錯誤
make: *** 正在等待未完成的任務....
Traceback (most recent call last):
File "scripts/make_css_value_keywords.py", line 177, in <module>
in_generator.Maker(CSSValueKeywordsWriter).main(sys.argv)
File "/home/atek/work/a33_release_2.0/android/external/chromium_org/third_party/WebKit/Source/core/scripts/in_generator.py", line 119, in main
writer.write_files(options.output_dir)
File "/home/atek/work/a33_release_2.0/android/external/chromium_org/third_party/WebKit/Source/core/scripts/in_generator.py", line 77, in write_files
self._write_file(output_dir, generator(), file_name)
File "scripts/make_css_value_keywords.py", line 172, in generate_implementation
gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
make: *** [out/target/product/astar-wifibt/obj/GYP/shared_intermediates/blink/CSSValueKeywords.cpp] 錯誤 1
這是由於沒有安裝git造成的,安裝上git就可以了。按說程序裡面應該判斷一下系統是否安裝了git,不知道為什麼沒有判斷。
sudo apt-get install git-core
=============================錯誤處理
sh: gperf: not found
target Generated: libwebcore <= external/webkit/Source/JavaScriptCore/create_regex_tables
Generating CSSPropertyNames.h <= CSSPropertyNames.in
sh: gperf: not found
calling gperf failed: 32512 at ./makeprop.pl line 140.
make: *** [out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h] Error 25
make: *** Deleting file `out/target/product/generic/obj/STATIC_LIBRARIES/libwebcore_intermediates/Source/WebCore/css/CSSPropertyNames.h'
解決方法:sudo apt-get install gperf
=============================[b][/b]=============================[b][b][b][b][/b][/b]
[/b]
[/b]