HiKey970固件烧写

AOSP与Kernel编译成功后,接着进行固件烧写的工作,首先我们需要生成boot.img, 步骤如下:

1.  git clone https://github.com/96boards-hikey/linux.git

2. git checkout -b hikey970-v4.9

以上步骤为下载Kernel源代码,如之前下载过则可以忽略

3. mkdir tools (该tools创建在与linux目录平级)

4. cp  AOSP_PATH/system/core/mkbootimg/mkbootimg  ./tools

5. cp  AOSP_PATH/out/target/product/hikey970/ramdisk.img  ./tools

6. 创建build_kernel.sh脚本,内容如下:

#!/bin/bash

DTB=1

LOCAL_DIR=$(pwd)

KERNEL_DIR=${LOCAL_DIR}/linux

PRODUCT_OUT=${LOCAL_DIR}/out/target/product/hikey970

GEN_IMAGES_DIR=${LOCAL_DIR}/tools

HIKEY970_KERNEL=${LOCAL_DIR}/tools

MKBOOTTOOL_DIR=${LOCAL_DIR}/tools

CURRENT_DIR=${LOCAL_DIR}

NCPU=`grep -c ^processor /proc/cpuinfo`

if [ ! -e ${PRODUCT_OUT} ]

then

mkdir -p ${PRODUCT_OUT}

fi

export MINI_SYS=true

export ARCH=arm64

export CROSS_COMPILE=AOSP_PATH/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-

check_build_result()

{

if [ $? != 0 ]; then

echo -e "\033[31m $1 build fail! \033[0m"

exit -1

else

echo -e "\033[32m $1 build success! \033[0m"

fi

}

if [ "${MINI_SYS}" != true ]; then

source ./build/envsetup.sh && lunch hikey970-userdebug && make -j$[NCPU*2] $2

check_build_result "Android System"

fi

cd ${KERNEL_DIR}

make hikey970_defconfig && make -j$[NCPU*2] Image.gz modules

check_build_result "Kernel Image"

rm -f arch/arm64/configs/hikey970_temp_defconfig

cp arch/arm64/boot/Image.gz ${HIKEY970_KERNEL}

if [ $DTB -eq 1 ]; then

make hisilicon/kirin970-hikey970.dtb

check_build_result "Hikey970 dtb"

cp arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dtb ${HIKEY970_KERNEL}

fi

cd ${CURRENT_DIR}

if [ ${need_repack_userdata} ];

then

make -j$[NCPU*2] userdataimage-nodeps

check_build_result "Hikey970 need repack userdataimage"

fi

if [ "${MINI_SYS}" = true ]; then

RAMDISK=${GEN_IMAGES_DIR}/ramdisk.img

else

RAMDISK=${PRODUCT_OUT}/ramdisk.img

if [ ! -e $RAMDISK ]; then

echo -e "\033[33m $RAMDISK is not exist! please build ramdisk first.

\033[0m"

echo -e "\033[33m . ./build/envsetup.sh && lunch hikey960-userdebug

&& make ramdisk \033[0m"

exit -1

fi

fi

#uefi boot.img = Image + dtb + ramdisk

cat ${KERNEL_DIR}/arch/arm64/boot/Image ${KERNEL_DIR}/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dtb > ${HIKEY970_KERNEL}/Image-dtb

check_build_result "Image-dtb"

${MKBOOTTOOL_DIR}/mkbootimg --kernel ${HIKEY970_KERNEL}/Image-dtb --ramdisk ${RAMDISK} --cmdline "androidboot.hardware=hikey970 firmware_class.path=/system/etc/firmware loglevel=15 buildvariant=userdebug androidboot.selinux=permissive clk_ignore_unused=true" --base 0x0 --tags_offset 0x07A00000 --kernel_offset 0x00080000 --ramdisk_offset 0x07c00000 --os_version 9.0 --os_patch_level 2018-11-21 --output ${PRODUCT_OUT}/boot.img

check_build_result "Boot Image"

echo -e "\033[36m build boot.img complete! \033[0m"

7. 执行上面的build_kernel.sh,然后生成boot.img

8.根据https://www.96boards.org/documentation/consumer/hikey/hikey970/installation/linux-fastboot.md.html的内容烧写开发板

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值