天天看點

Hikey960 開發闆 Fuchsia 編譯

* 前提:

** 假設源碼路徑: 

/opt/work/fuchsia/

** 作業系統: 

Ubuntu 18.04.3 X64

** 版本

我使用的是離線下載下傳的Fuchsia 2020.04.07版本, 位址請見下文.

* 源碼下載下傳:

官方教程:

https://fuchsia.dev/docs/development/source_code/README

安裝依賴:

sudo apt-get install build-essential curl git python unzip
cd ~
           

引導腳本(此指令開始後将啟動代碼下載下傳流程)

curl -s "https://fuchsia.googlesource.com/fuchsia/+/master/scripts/bootstrap?format=TEXT" | base64 --decode | bash
           

PS:不幸的是, 國内網速不好, 我使用的是鏡像:

https://mirrors.sirung.org/fuchsia/source-code/fuchsia-source-20200407.tar.gz

* 建構前的準備:

配置環境變量(參考官方):

export PATH=$PATH:/opt/work/fuchsia/.jiri_root/bin
source /opt/work/fuchsia/scripts/fx-env.sh
fx-update-path
           

* Hikey960的的準備:

** 恢複bootloader(錯誤)

1. 下載下傳bootloader

http://snapshots.linaro.org/reference-platform/components/uefi-staging/latest/hikey960/release/

2. 燒寫bootloader

sudo ./hikey_idt -c config -p /dev/ttyUSB1

** 恢複bootloader(錯誤)

1. 下載下傳:

wget https://snapshots.linaro.org/reference-platform/components/uefi-staging/latest/hikey/release/recovery.bin

wget https://snapshots.linaro.org/reference-platform/components/uefi-staging/latest/hikey/release/l-loader.bin

wget https://snapshots.linaro.org/reference-platform/components/uefi-staging/latest/hikey/release/fip.bin

wget https://snapshots.linaro.org/reference-platform/components/uefi-staging/latest/hikey/release/ptable-linux-4g.img

wget https://snapshots.linaro.org/reference-platform/components/uefi-staging/latest/hikey/release/ptable-linux-8g.img

wget https://snapshots.linaro.org/reference-platform/components/uefi-staging/latest/hikey/release/hisi-idt.py

2. 安裝:

sudo python2.7 hisi-idt.py -d /dev/ttyUSB1 --img1 recovery.bin

** 恢複bootloader(正确, 需要切換到recovery模式)

1. 下載下傳

git clone https://github.com/96boards-hikey/tools-images-hikey960
           

2. 可能需要準備的檔案:

然後需要一個Android版本的Image, 需要其中的一些img, 你可以通過AOSP編譯獲得:

. build/envsetup.sh
lunch hikey960-userdebug
make -j64
fastboot flashall
           

也可以直接從官方下載下傳, 注意: 需要将編譯輸出的bin和img拷貝到tools-images-hikey960/下, 否則可能無法啟動.

3. 開始刷入bootloader

cd tools-images-hikey960
sudo ./recovery-flash.sh /dev/ttyUSB1
           

** 刷入基本固件:

1. 下載下傳

git clone https://android.googlesource.com/device/linaro/hikey hikey-firmware
git -C hikey-firmware checkout 972114436628f874ac9ca28ef38ba82862937fbf
fastboot flash ptable hikey-firmware/installer/hikey960/ptable.img
fastboot flash xloader hikey-firmware/installer/hikey960/sec_xloader.img
fastboot flash fastboot hikey-firmware/installer/hikey960/fastboot.img
fastboot flash nvme hikey-firmware/installer/hikey960/nvme.img
fastboot flash fw_lpm3 hikey-firmware/installer/hikey960/lpm3.img
fastboot flash trustfirmware hikey-firmware/installer/hikey960/bl31.bin
           

2. 安裝

* 編譯

fx set bringup.hikey960
fx build
           

* 燒錄Hikey960(fastboot模式)

out/default/flash.sh