固件制作指南
Titan固件
安装依赖
apt-get -y install zip
拷贝固件依赖的文件
export TMP=pack_dirmkdir -p $TMP/factory/cp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/bootinfo_emmc.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/bootinfo_sd.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/bootinfo_spinand.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/bootinfo_spinor.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/FSBL.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/u-boot.itb $TMPcp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/env.bin $TMPcp $TARGET_ROOTFS/usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.itb $TMPcp bootfs.ext4 $TMPcp rootfs.ext4 $TMP
下载参考分区表
wget -P $TMP https://gitee.com/bianbu/image-config/raw/main/fastboot.yamlwget -P $TMP https://gitee.com/bianbu/image-config/raw/main/partition_2M.jsonwget -P $TMP https://gitee.com/bianbu/image-config/raw/main/partition_flash.jsonwget -P $TMP https://gitee.com/bianbu/image-config/raw/main/partition_universal.json
打包
cd $TMPzip -r ../bianbu-custom.zip *
SDCARD镜像
下面介绍如何使用genimage制作SDCARD镜像。
安装依赖
echo 'tzdata tzdata/Areas select Asia' | debconf-set-selectionsecho 'tzdata tzdata/Zones/Asia select Shanghai' | debconf-set-selectionsDEBIAN_FRONTEND=noninteractive apt-get -y install wget python3 genimage
拷贝固件依赖的文件
export TMP=pack_dirmkdir -p $TMP/factory/cp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/bootinfo_emmc.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/bootinfo_sd.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/bootinfo_spinand.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/bootinfo_spinor.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/FSBL.bin $TMP/factorycp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/u-boot.itb $TMPcp $TARGET_ROOTFS/usr/lib/u-boot/spacemit/env.bin $TMPcp $TARGET_ROOTFS/usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.itb $TMPcp bootfs.ext4 $TMPcp rootfs.ext4 $TMP
下载参考分区表
wget -P $TMP https://gitee.com/bianbu/image-config/raw/main/partition_universal.json
下载生成genimage.cfg的脚本,并生成genimage.cfg
wget -P $TMP https://gitee.com/bianbu-linux/scripts/raw/bl-v1.0.y/gen_imgcfg.pypython3 $TMP/gen_imgcfg.py -i $TMP/partition_universal.json -n bianbu-custom.sdcard -o $TMP/genimage.cfg
生成SDCARD镜像
ROOTPATH_TMP="$(mktemp -d)"GENIMAGE_TMP="$(mktemp -d)"genimage \ --config "$TMP/genimage.cfg" \ --rootpath "$ROOTPATH_TMP" \ --tmppath "$GENIMAGE_TMP" \ --inputpath "$TMP" \ --outputpath "."
当看到以下信息时,说明打包成功。
INFO: hdimage(bianbu-custom): adding partition 'bootinfo' from 'factory/bootinfo_sd.bin' ...INFO: hdimage(bianbu-custom): adding partition 'fsbl' (in MBR) from 'factory/FSBL.bin' ...INFO: hdimage(bianbu-custom): adding partition 'env' (in MBR) from 'env.bin' ...INFO: hdimage(bianbu-custom): adding partition 'opensbi' (in MBR) from 'fw_dynamic.itb' ...INFO: hdimage(bianbu-custom): adding partition 'uboot' (in MBR) from 'u-boot.itb' ...INFO: hdimage(bianbu-custom): adding partition 'bootfs' (in MBR) from 'bootfs.ext4' ...INFO: hdimage(bianbu-custom): adding partition 'rootfs' (in MBR) from 'rootfs.ext4' ...INFO: hdimage(bianbu-custom): adding partition '[MBR]' ...INFO: hdimage(bianbu-custom): adding partition '[GPT header]' ...INFO: hdimage(bianbu-custom): adding partition '[GPT array]' ...INFO: hdimage(bianbu-custom): adding partition '[GPT backup]' ...INFO: hdimage(bianbu-custom): writing GPTINFO: hdimage(bianbu-custom): writing protective MBRINFO: hdimage(bianbu-custom): writing MBRINFO: cmd: "rm -rf "/tmp/tmp.rX4fZ39DKG"/*" (stderr):