01-步骤整理-华为海思Hikey970开发板的AOSP编译烧写

只谈情不闲聊 提交于 2019-12-02 01:55:39

    最近结合第三方厂家与官方提供的编译文档,实践整理了Hikey970单板编译与烧写Google原生AOSP(Android Open Source Project)系统的步骤。

    单板参数:6GB LPDDR4

                     64GB UFS

    具体流程如下。

一、Bootloader

1、sudo apt-get install uuid-dev build-essential
2、mkdir bootloader
   cd bootloader
3、git clone https://github.com/96boards-hikey/tools-images-hikey970.git
   git clone https://github.com/96boards-hikey/OpenPlatformPkg.git -b hikey970_v1.0
   git clone https://github.com/96boards-hikey/arm-trusted-firmware.git -b hikey970_v1.0
   git clone https://github.com/96boards-hikey/l-loader.git -b hikey970_v1.0
   git clone https://github.com/96boards-hikey/edk2.git -b hikey970_v1.0
   git clone https://github.com/96boards-hikey/uefi-tools.git -b hikey970_v1.0
4、cd edk2
   ln -sf ../OpenPlatformPkg
5、vim ${BUILD_PATH}/l-loader/build_uefi.sh
   具体改动见下图
6、 编译 l-loader/build_uefi.sh hikey970

二、Kernel

1、mkdir kernel
   cd kernel
2、git clone https://github.com/96boards-hikey/linux.git -b hikey970-v4.9
3、设置环境变量
export ARCH=arm64
export CROSS_COMPILE=/xxx/aarch64-linux-android-4.9/bin/aarch64-linux-android-
(编译链下载:git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9)
4、make hikey970_defconfig
   make -j4
   make hisilicon/kirin970-hikey970.dtb

三、AOSP

1、mkdir aosp
   cd aosp
2、1)墙外用户:repo init -u https://android.googlesource.com/platform/manifest -b master
   2)墙内用户:repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b master (建议先离线下载压缩包,而后到Linux环境下解压)
3、git clone https://github.com/96boards-hikey/android-manifest.git -b hikey970_v1.0 .repo/local_manifests
4、sudo repo sync (最终大约100+G)
5、编译
   Copy kirin970-hikey970.dtb (arch/arm64/boot/dts/hisilicon/ kirin970-hikey970.dtb) to the device/linaro/hikey-kernel directory as file: kirin970-hikey970.dtb-4.9
   Copy the Image file (arch/arm64/boot/Image.gz-dtb) to the device/linaro/hikey-kernel directory as file: Image.gz-hikey970-4.9
   source ./build/envsetup.sh
   lunch hikey970-userdebug
   make -j16

生成 boot.img:

1、Copy Image and kirin970-hikey970.dtb from kernel directory
2、copy ramdisk.img from android out/
3、cat Image kirin970-hikey970.dtb > Image-dtb
   mkbootimg --kernel Image-dtb --ramdisk ramdisk.img --cmdline "androidboot.hardware=hikey970 firmware_class.path=/system/etc/firmware loglevel=15 buildvariant=userdebug androidboot.selinux=permissive clk_ignore_unused=true initrd=0xBE19D000,0x16677F earlycon=pl011,0xfff32000,115200 console=ttyAMA6 androidboot.serialno=54DA9CD5022525E4 clk_ignore_unused=true" -o boot.img

四、烧写

1、将单板上的拨码开关拨到1、3 ON,2、4 OFF,即fastboot mode everytime模式

2、用Type-C线将单板上非串口调试的Type-C口与电脑USB口相连

3、在Windows CMD中使用fastboot工具烧写各镜像文件

fastboot flash ptable l-loader/ptable-aosp-64g.img
fastboot flash xloader tools-images-hikey970/sec_xloader.img
fastboot flash fastboot l-loader/l-loader.bin
fastboot flash fip l-loader/fip.bin
fastboot flash boot boot.img
fastboot flash cache cache.img
fastboot flash system system.img
fastboot flash userdata userdata.img

    另,由于hikey970官方与第三方厂商均未提供官方QQ群以供开发者交流,在此特创建QQ群:609941175,希望Hikey970的开发者或者Android/Linux 各层开发者加入,大家一起交流学习,共同进步!

    /*

     * 以上步骤为自己实践总结,亲测有效,欢迎转载,转载请注明出处!

     * 欢迎各开发者加群共同讨论学习!

     */

 

 

 

 

 

 

 


 

 

 

 

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!