切換目錄到 /home/roco/work/amlogic/SourceCode/mx0831-0525下将mx0831-0525.tgz拷貝到 /home/pyou/ 目錄下,解壓,生成mx0831-0525目錄。此目錄就是将來的工作目錄。 tar.bz2 指令: tar -jxvf *.tar.bz2

切換目錄到 /home/roco/work/amlogic/Document中,拷貝amlogic-tool.zip到 /home/pyou下解壓生成 amlogic-tool目錄
該目錄下有以下3個壓縮檔案
1. arm-2010q1-188-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
2. arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu1.tar.bz2
3. gnutools-arc2.3-p0-ubuntu-9.04-2010-5-10.tar.bz2
由于前面兩個解壓的目錄相同,是以建立一個目錄188,并将arm-2010q1-188-arm-none-eabi-i686-pc-linux-gnu.tar.bz2移到188目錄下,解壓生成目錄/amlogic-tool/188/arm-2010q
切換目錄到/amlogic-tool,分别解壓gnutools-arc2.3-p0-ubuntu-9.04-2010-5-10.tar.bz2檔案和arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu1.tar.bz2 檔案,生成目錄/amlogic-tool/arm-2010q1和目錄/amlogic-tool/opt
切換目錄到 /home/pyou目錄下,使用ll指令查檔案清單,然後使用vim指令修改.bashrc 檔案,在該檔案最後添加環境變量。如下所示:
PATH="$PATH:/home/pyou/amlogic-tool/188/arm-2010q1/bin:/home/pyou/amlogic-tool/arm-2010q1/bin:/home/pyou/amlogic-tool/opt/gnutools/arc2.3-p0/elf32-4.2.1/bin:/home/pyou/amlogic-tool/opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin"
切換目錄到~/mx0831-0525/uboot目錄下
使用make help |grep roco 檢視項目配置,檢視指令清單,然後再指令清單中查找到make m6_roco_1212_config指令并使用該指令進行編譯,編譯完後再使用make指令進行編譯,在~/mx0831-0525/uboot/build目錄下會生成u-boot.bin檔案
1. make m6_roco_1212_config
2. Make
3. cp build/u-boot.bin ../device/other/TBDG1073
切換目錄至~/mx0831-0525
這個指令是用來将envsetup.sh裡的所有用到的指令加載到環境變量裡去,我們來分析下它。
envsetup.sh裡的主要指令如下:
function help() # 顯示幫助資訊
function get_abs_build_var()# 擷取絕對變量
function get_build_var()# 擷取絕對變量
function check_product()# 檢查product
function check_variant()# 檢查變量
function setpaths() # 設定檔案路徑
function printconfig()# 列印配置
function set_stuff_for_environment() # 設定環境變量
function set_sequence_number() # 設定序号
function settitle() # 設定标題
function choosetype() # 設定type
function chooseproduct() # 設定product
function choosevariant() # 設定variant
function tapas() # 功能同choosecombo
function choosecombo() # 設定編譯參數
function add_lunch_combo() # 添加lunch項目
function print_lunch_menu() # 列印lunch清單
function lunch()# 配置lunch
function m()# make from top
function findmakefile() # 查找makefile
function mm() # make from current directory
function mmm() # make the supplied directories
function croot()# 回到根目錄
function cproj()
function pid()
function systemstack()
function gdbclient()
function jgrep()# 查找java檔案
function cgrep() # 查找c/cpp檔案
function resgrep()
function tracedmdump()
function runhat()
function getbugreports()
function startviewserver()
function stopviewserver()
function isviewserverstarted()
function smoketest()
function runtest()
function godir () # 跳到指定目錄 405
# add_lunch_combo函數被多次調用,就是它來添加Android編譯選項
# Clear this variable. It will be built up again when the vendorsetup.sh
406 # files are included at the end of this file.
# 清空LUNCH_MENU_CHOICES變量,用來存在編譯選項
407 unset LUNCH_MENU_CHOICES
408 function add_lunch_combo()
409 {
410 local new_combo=$1 # 獲得add_lunch_combo被調用時的參數
411 local c
# 依次周遊LUNCH_MENU_CHOICES裡的值,其實該函數第一次調用時,該值為空
412 for c in ${LUNCH_MENU_CHOICES[@]} ; do
413 if [ "$new_combo" = "$c" ] ; then # 如果參數裡的值已經存在于LUNCH_MENU_CHOICES變量裡,則傳回
414 return
415 fi
416 done
# 如果參數的值不存在,則添加到LUNCH_MENU_CHOICES變量裡
417 LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo)
418 }
# 這是系統自動增加了一個預設的編譯項 generic-eng
420 # add the default one here
421 add_lunch_combo generic-eng # 調用上面的add_lunch_combo函數,将generic-eng作為參數傳遞過去
422
423 # if we're on linux, add the simulator. There is a special case
424 # in lunch to deal with the simulator
425 if [ "$(uname)" = "Linux" ] ; then
426 add_lunch_combo simulator
427 fi
# 下面的代碼很重要,它要從vendor目錄下查找vendorsetup.sh檔案,如果查到了,就加載它
1037 # Execute the contents of any vendorsetup.sh files we can find.
1038 for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/build/vendorsetup.sh 2> /dev/null`
1039 do
1040 echo "including $f"
1041 . $f # 執行找到的腳本,其實裡面就是廠商自己定義的編譯選項
1042 done
1043 unset f
envsetup.sh其主要作用如下:
1. 加載了編譯時使用到的函數指令,如:help,lunch,m,mm,mmm等
2. 添加了兩個編譯選項:generic-eng和simulator,這兩個選項是系統預設選項
3. 查找vendor/<-廠商目錄>/和vendor/<廠商目錄>/build/目錄下的vendorsetup.sh,如果存在的話,加載執行它,添加廠商自己定義産品的編譯選項
其實,上述第3條是向編譯系統添加了廠商自己定義産品的編譯選項,裡面的代碼就是:add_lunch_combo xxx-xxx。
根據上面的内容,可以推測出,如果要想定義自己的産品編譯項,簡單的辦法是直接在envsetup.sh最後,添加上add_lunch_combo myProduct-eng,當然這麼做,不太符合上面代碼最後的本意,我們還是老實的在vendor目錄下建立自己公司名字,然後在公司目錄下建立一個新的vendorsetup.sh,在裡面添加上自己的産品編譯項
#mkdir vendor/farsight/
#touch vendor/farsight/vendorsetup.sh
#echo "add_lunch_combo fs100-eng" > vendor/farsight/vendorsetup.sh
這樣,當我們在執行source build/envsetup.sh指令的時候,可以在shell上看到下面的資訊:
including vendor/farsight/vendorsetup.sh
按數字17,因為該項目是17對應的項目TBG1073-user 。
lunch指令是envsetup.sh裡定義的一個指令,用來讓使用者選擇編譯項,來定義Product和編譯過程中用到的全局變量。
我們一直沒有說明前面的fs100-eng是什麼意思,現在來說明下,fs100是我定義的産品的名字,eng是産品的編譯類型,除了eng外,還有user, userdebug,分别表示:
eng: 工程機,
user:最終使用者機
userdebug:調試測試機
tests:測試機
由此可見,除了eng和user外,另外兩個一般不能交給最終使用者的,記得m8出來的時候,先放出了一部分eng工程機,然後出來了user機之後,可以用工程機換。
那麼這四個類型是幹什麼用的呢?其實,在main.mk裡有說明,在Android的源碼裡,每一個目标(也可以看成工程)目錄都有一個Android.mk的makefile,每個目标的Android.mk中有一個類型聲明:LOCAL_MODULE_TAGS,這個TAGS就是用來指定,目前的目标編譯完了屬于哪個分類裡。
PS:Android.mk和Linux裡的makefile不太一樣,它是Android編譯系統自己定義的一個makefile來友善編譯成:c,c++的動态、靜态庫或可執行程式,或java庫或android的程式,
清除make clean
打更新檔make custom1
打完更新檔後記得執行以下指令
find . -name *.xml.orig | xargs rm
find . -name *.xml.reg | xargs rm
find . -name *.xml.rej | xargs rm
執行完該指令後會在out/target/product/TBDG1073/目錄下生成一些zip更新壓縮包,如:out/target/product/TBDG1073/TBDG1073-ota-20130708.v016.zip
生成的目标平台的相關的檔案在out/target/product/board_name/中(board_name要與目标平台相比對)。
目錄或檔案
描述
gxxref-ota-eng.[linux user name].zip
更新包
obj/
存放中間檔案的目錄
recovery/
recovery的rootfs目錄,和ramdisk.img相對應
res-package.img
uboot使用的一些資源(充電圖檔等)
root/
正常啟動的rootfs目錄,和ramdisk-recovery.img相對應
symbols/
存放符号表的目錄
system/
存放大多數目标檔案的目錄
u-boot.bin
uboot,就是自己項目目錄下的uboot檔案
boot.img
正常啟動的鏡像,
由header+kernel(uImage)+ramdisk.img構成
recovery.img
recovery模式啟動的鏡像,
由header+kernel(uImage)+ramdisk-recovery.img構成
==================================================================================================
作者:歐陽鵬 歡迎轉載,與人分享是進步的源泉!