天天看點

Android系統源代碼編譯—[4]運作建構建構fastboot和adb引導到fastboot模式解鎖bootloader選擇一個裝置進行建構Flash到一個裝置

本文提供了在特定裝置上運作建構的詳細内容,同時也被設計擴充準備建構的資訊。

建構fastboot和adb

如果你還沒有fastboot和adb,你可以使用正規的建構系統建構他們。使用準備建構中的說明并使用下面指令來替換make指令:

$ make fastboot adb
           

引導到fastboot模式

在冷啟動裝置期間,使用下面的組合鍵引導進入fastboot模式,這個模式是一個用來flash裝置的引導裝載程式模式。

Device Keys
hikey Link pins 1 - 2 and 5 - 6 of J15
angler Press and hold Volume Down, then press and hold Power
bullhead Press and hold Volume Down, then press and hold Power
shamu Press and hold Volume Down, then press and hold Power
fugu Press and hold Power
volantis Press and hold Volume Down, then press and hold Power
hammerhead Press and hold both Volume Up and Volume Down, then press and hold Power
flo Press and hold Volume Down, then press and hold Power
deb Press and hold Volume Down, then press and hold Power
manta Press and hold both Volume Up and Volume Down, then press and hold Power
mako Press and hold Volume Down, then press and hold Power
grouper Press and hold Volume Down, then press and hold Power
tilapia Press and hold Volume Down, then press and hold Power
phantasm Power the device, cover it with one hand after the LEDs light up and until they turn red
maguro Press and hold both Volume Up and Volume Down, then press and hold Power
toro Press and hold both Volume Up and Volume Down, then press and hold Power
toroplus Press and hold both Volume Up and Volume Down, then press and hold Power
panda Press and hold Input, then press Power
wingray Press and hold Volume Down, then press and hold Power
crespo Press and hold Volume Up, then press and hold Power
crespo4g Press and hold Volume Up, then press and hold Power

不用組合鍵你也可以使用指令adb reboot bootloader 來重新開機直接進入引導裝載程式。

解鎖bootloader

隻有手機的bootloader允許才能flash一個定制的系統,而且bootloader預設是鎖定的。你可以解鎖bootloader,但是需要意識到這樣做會删除使用者的隐私資料(解鎖操作隻需要運作一次)。解鎖後,裝置上的所有資料都會被擦除,i.e.應用的私有資料以及通過USB共享的資料,包括圖檔和電影。在解鎖bootloader前請確定已備份了珍貴的檔案。

當裝置在fastboot模式下,使用下面指令來解鎖bootloader:

$ fastboot oem unlock
           

在Nexus 10裝置上,解鎖bootloader後,内部存儲是無格式的。你可以使用下面指令格式化裝置:

$ fastboot format cache
$ fastboot format userdata
           

重新鎖定bootloader,使用:

Note: 在Motoroal Xoom裝置上重新鎖定bootloader或擦除使用者資料(包括USB共享的資料)。

選擇一個裝置進行建構

當運作無參數的lunch指令時,建議通過lunch菜單中選擇可用的build。你可以從developers.google.com為Nexus裝置下載下傳factory inages 和 二進制檔案:

  • Preview binaries (blobs)
  • Factory images for released devices
  • Support binaries (drivers) for release devices

參見擷取專有二進制檔案了解更詳細的資訊以及通過裝置二進制檔案要求了解其他資源。

Device Code name Build configuration
HiKey hikey hikey-userdebug
Nexus 6P angler aosp_angler-userdebug
Nexus 5X bullhead aosp_bullhead-userdebug
Nexus 6 shamu aosp_shamu-userdebug
Nexus Player fugu aosp_fugu-userdebug
Nexus 9 volantis (flounder) aosp_flounder-userdebug
Nexus 5 (GSM/LTE) hammerhead aosp_hammerhead-userdebug
Nexus 7 (Wi-Fi) razor (flo) aosp_flo-userdebug
Nexus 7 (Mobile) razorg (deb) aosp_deb-userdebug
Nexus 10 mantaray (manta) full_manta-userdebug
Nexus 4 occam (mako) full_mako-userdebug
Nexus 7 (Wi-Fi) nakasi (grouper) full_grouper-userdebug
Nexus 7 (Mobile) nakasig (tilapia) full_tilapia-userdebug
Galaxy Nexus (GSM/HSPA+) yakju (maguro) full_maguro-userdebug
Galaxy Nexus (Verizon) mysid (toro) aosp_toro-userdebug
Galaxy Nexus (Experimental) mysidspr (toroplus) aosp_toroplus-userdebug
PandaBoard (Archived) panda aosp_panda-userdebug
Motorola Xoom (U.S. Wi-Fi) wingray full_wingray-userdebug
Nexus S soju (crespo) full_crespo-userdebug
Nexus S 4G sojus (crespo4g) full_crespo4g-userdebug\

Flash到一個裝置

你可以使用單一的指令來flash一個完整的Android系統到裝置;這樣做可以确定flash的系統和已經初始化的bootlodaer以及radio是相容的,然後寫入boot,還原,系統分區,然後重新開機系統。Flashing同樣也會擦除所有使用者資料,類似于fastboot oem unlock.

然裝置進入fastboot模式既可以手動通過在boot過程中按組合鍵也可以通過下面的shell指令:

$ adb reboot bootloader
           

一旦裝置處于fastboot模式,運作:

$ fastboot flashall -w
           

-w選項擦除了裝置上的/data分區;當你第一次flash特定裝置的時候是有用的但不是必須的。

Note: 通過在Motorola Xoom裝置上 fastboot來建立的檔案系統沒有進行函數優化。我們建議通過recovery來re-creating 檔案系統,使用$ adb reboot recovery.當在recovery這段時間裡,打開菜單(按住 Power + Volume Up),清楚緩存分區,然後清楚資料。

繼續閱讀