查看: 1611|回复: 0

【HiKey】开发板bootloader android 编译烧写测试

[复制链接]

该用户从未签到

发表于 2016-8-24 10:42:21 | 显示全部楼层 |阅读模式
分享到:
交叉编译工具链:
下载:
https://releases.linaro.org/15.02/components/toolch...
https://releases.linaro.org/15.02/components/toolch...
安装:
mkdir arm-tc arm64-tc
tar --strip-components=1 -C ${PWD}/arm-tc -xf gcc-linaro-4.9-*-x86_64_aarch64-linux-gnu.tar.xz
tar --strip-components=1 -C ${PWD}/arm64-tc -xf gcc-linaro-4.9-*-x86_64_arm-linux-gnueabihf.tar.xz
export PATH="${PWD}/arm-tc/bin{PWD}/arm64-tc/binPATH"
bootloader代码下载:
git clone -b hikey --depth 1 https://github.com/96boards/edk2.git linaro-edk2
git clone -b hikey --depth 1 https://github.com/96boards-hikey/arm-trusted-firmware.git
git clone -b hikey --depth 1 https://github.com/96boards/LinaroPkg.git
git clone --depth 1 https://github.com/96boards/l-loader.git
git clone git://git.linaro.org/uefi/uefi-tools.git
编译UEFI
export AARCH64_TOOLCHAIN=GCC49
export EDK2_DIR=${PWD}/linaro-edk2
export UEFI_TOOLS_DIR=${PWD}/uefi-tools
cd ${EDK2_DIR}
${UEFI_TOOLS_DIR}/uefi-build.sh -c ../LinaroPkg/platforms.config -b RELEASE -a ../arm-trusted-firmware hikey
cd ../l-loader
ln -s ${EDK2_DIR}/Build/HiKey/RELEASE_GCC49/FV/bl1.bin
ln -s ${EDK2_DIR}/Build/HiKey/RELEASE_GCC49/FV/fip.bin
arm-linux-gnueabihf-gcc -c -o start.o start.S
arm-linux-gnueabihf-gcc -c -o debug.o debug.S
arm-linux-gnueabihf-ld -Bstatic -Tl-loader.lds -Ttext 0xf9800800 start.o debug.o -o loader
arm-linux-gnueabihf-objcopy -O binary loader temp
python gen_loader.py -o l-loader.bin --img_loader=temp --img_bl1=bl1.bin
sudo PTABLE=aosp-8g bash -x generate_ptable.sh
python gen_loader.py -o ptable-aosp-8g.img --img_prm_ptable=prm_ptable.img
镜像输出(l-loader目录下):
fip.bin l-loader.bin ptable-aosp-8g.img
sudo python hisi-idt.py --img1=l-loader.bin -d /dev/ttyUSB0
sudo fastboot flash ptable ptable-aosp-8g.img
sudo fastboot flash fastboot fip.bin
Fastboot App 在$EDK2_DIR/Build/HiKey/RELEASE_GCC49/AARCH64/AndroidFastbootApp.efi
android编译:
系统设置:
修改/etc/sudoers,根据自己主机情况添加下面几行(zeroway是我的用户名)
zeroway ALL= NOPASSWD: /bin/mount
zeroway ALL= NOPASSWD: /bin/umount
zeroway ALL= NOPASSWD: /usr/sbin/mkfs.fat
代码下载(这里和其它android一样,可以使用清华大学的镜像站点):
repo init -u https://android.googlesource.com/platform/manifest... -b android-5.1.1_r1 -g "default,-device,hikey"
cd .repo/
git clone https://github.com/96boards/android_manifest -b android-5.0 local_manifests
cd -
repo sync -j8
source build/envsetup.sh
lunch hikey-userdebug
make -j8
编译完成后会生成下面的镜像,烧写测试:
sudo fastboot flash boot boot_fat.uefi.img
sudo fastboot flash system system.img
注意:
这里编译的boot_fat.uefi.img要和上面编译的fip.bin一起烧写,否则无法启动
如果不想烧写上面编译的fip.bin的话则需要手动修改生成boot_fat.uefi.img:
手动打包过程如下(将你自己编译的内核,DT和RAMDISK替换进去下面下载的prebuild的boot_fat.uefi.img后就可以了):
wget https://builds.96boards.org/releases/reference-plat...
wget https://builds.96boards.org/snapshots/reference-pl... -O grubaa64.efi
mkdir boot-fat
dd if=/dev/zero of=boot-fat.uefi.img bs=512 count=131072
sudo mkfs.fat -n "BOOT IMG" boot-fat.uefi.img
sudo mount -o loop,rw,sync boot-fat.uefi.img boot-fat
sudo cp hi6220-hikey.dtb boot-fat/hi6220-hikey.dtb
sudo cp AndroidFastbootApp.efi boot-fat/fastboot.efi
sudo cp grubaa64.efi boot-fat/grubaa64.efi
sudo umount boot-fat
sudo mv boot-fat.uefi.img hikey-boot-linux-VERSION.uefi.img
rm -rf boot-fat
参考:
https://github.com/96boards/documentation/wiki/CE-AOSP-RPB-HiKey-15.10-Build
https:/                                                                                          /github.com/96boards/documentation/wiki/HiKeyUEFI
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /4 下一条

手机版|小黑屋|与非网

GMT+8, 2024-11-19 12:35 , Processed in 0.116202 second(s), 17 queries , MemCache On.

ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

苏公网安备 32059002001037号

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.