参考
# 合并飞腾派配置文件
./support/kconfig/merge_config.sh configs/phytium_ubuntu_defconfig configs/phytiumpi_sdcard.config
# 生成所有相关镜像文件
make
# 删除所有编译结果,包括output目录下的所有内容。当编译完一个文件系统后,编译另一个文件系统前,需要执行此命令。
make clean
# # 重置Buildroot,删除所有编译结果、下载目录以及配置。
# 一般情况下不需要执行
# make distclean
# find . -name Image.gz
mv workspace_aarch64-dyn.bin output/images/
修改 ./output/images/kernel.its 如下所示
/* * Compilation: * mkimage -f fit_kernel_dtb.its fit_kernel_dtb.itb * * Files in linux build dir: * - arch/arm/boot/Image (zImage-old-ok) * - arch/arm/boot/dts/ft.dtb * * fatload usb 0:1 0x90100000 fit_kernel_dtb.itb * bootm 0x90100000#e2000 * */ /dts-v1/; / { description = "U-Boot fitImage for Phytium Phytiumpi"; #address-cells = <1>; images { kernel { description = "Starry OS"; data = /incbin/("workspace_aarch64-dyn.bin"); type = "kernel"; arch = "arm64"; os = "linux"; compression = "none"; load = <0x80080000>; entry = <0x80080000>; hash-1 { algo = "sha1"; }; }; fdt-phytium { description = "FDT phytiumpi"; data = /incbin/("phytiumpi_firefly.dtb"); type = "flat_dt"; arch = "arm64"; compression = "none"; hash-1 { algo = "sha1"; }; }; }; configurations { default = "phytium@cecport"; phytium { description = "phytimpi"; kernel = "kernel"; fdt = "fdt-phytium"; hash-1 { algo = "sha1"; }; }; }; };
cd ./output/images
mkdir -p ./input
../host/bin/mkimage_phypi -f kernel.its ./input/fitImage
# cd ./output/images
cp ../../board/phytium/genimage-tools/genimage-sd.cfg .
修改 ./genimage-sd.cfg 文件
image sdcard.img { hdimage { } partition uboot { in-partition-table = no offset = 0 image = "fip-all.bin" size = 4M holes = {"(0; 512)"} } partition bootload { in-partition-table = no offset = 4M image = "fitImage" size = 60M } partition root { partition-type = 0x83 image = "rootfs.ext2" size = 12G } }
执行 生成 ./output/sdcard.img
注意 ./input 中存放需要的 fip-all.bin、fitImage、rootfs.ext2 这三个镜像,./tmp、./root 及 ./output 需要手动创建,在生成过程中会用到
# cd ./output/images
mkdir -p ./tmp
mkdir -p ./root
mkdir -p ./output
cp fip-all.bin ./input/
cp rootfs.ext2 ./input/
../host/bin/genimage --inputpath ./input --outputpath ./output --config genimage-sd.cfg --tmppath ./tmp --rootpath ./root
压缩下载
# cd ./output/images
# 查看编译出来的镜像
ls -lah output/
# 压缩
# -T0:使用所有 CPU 核心
# -z:压缩(可省略)
# -9:最高压缩比
xz -T0 -z -9 -k output/sdcard.img
tftp 0x80080000 fitImage
bootm 0x80080000
# 多镜像启动,指定启动镜像
bootm 0x80080000#phytium