如题,感觉拿个TF卡刷入镜像再dd出来有点愚蠢。所以……
根据CSDN的帖子:
https://blog.csdn.net/armkits/article/details/93848472
我用的是256MB 的sd nand
自己摸索了一下下,汇总在下面:
qemu-img create V3S-OK.img 245M
sfdisk --in-order --Linux --unit M ./V3S-OK.img <<EOF
4,20,L
,,L
EOF
kpartx -av V3S-OK.img
mkfs.vfat -F 16 /dev/mapper/loop0p1 -n boot
mkfs.ext4 /dev/mapper/loop0p2 -L rootfs
dd if=../Lichee/u-boot/u-boot-sunxi-with-spl.bin of=./V3S-OK.img bs=1024 seek=8 conv=notrunc
mount /dev/mapper/loop0p1 tmpmnt/boot/ &&\
mount /dev/mapper/loop0p2 tmpmnt/rootfs/ &&\
cd tmpmnt/boot/ && \
cp ../../../Lichee/linux/arch/arm/boot/zImage . && \
cp ../../../Lichee/linux/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dtb . && \
cp ../../../zero_imager/boot.scr .
cd ../rootfs/
tar -xvf ../../../Lichee/buildroot/backuptotalokrootfs_20200922/rootfs.tar -C .
cd ../.. && \
umount ./tmpmnt/boot/ && \
umount ./tmpmnt/rootfs/ && \
kpartx -dv V3S-OK.img
大致描述一下:
1、生成一个245MB的空固件Img
qemu-img create V3S-OK.img 245M
2、分个区, 4,20,L 代表第一个分区是20M, 4代表20M前面空4MB空间出来, L是个ID,传送门:
http://manpages.ubuntu.com/manpages//trusty/en/man8/sfdisk.8.html
Id is given in hex, without the 0x prefix, or is [E|S|L|X], where L (LINUX_NATIVE (83)) is
the default, S is LINUX_SWAP (82), E is EXTENDED_PARTITION (5), and X is LINUX_EXTENDED
(85).
sfdisk --in-order --Linux --unit M ./V3S-OK.img <<EOF
4,20,L
,,L
EOF
kpartx 把分区挂载到文件系统 , 会在 /dev/mapper/ 下面生成节点loopXpx
kpartx -av V3S-OK.img
格式化一下,按照荔枝派zero的教程,第一个分区是fat16 ,第二个是ext4
mkfs.vfat -F 16 /dev/mapper/loop0p1 -n boot
mkfs.ext4 /dev/mapper/loop0p2 -L rootfs
写入uboot :
dd if=../Lichee/u-boot/u-boot-sunxi-with-spl.bin of=./V3S-OK.img bs=1024 seek=8 conv=notrunc
挂载并拷贝内核和rootfs:
mount /dev/mapper/loop0p1 tmpmnt/boot/ &&\
mount /dev/mapper/loop0p2 tmpmnt/rootfs/ &&\
cd tmpmnt/boot/ && \
cp ../../../Lichee/linux/arch/arm/boot/zImage . && \
cp ../../../Lichee/linux/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dtb . && \
cp ../../../zero_imager/boot.scr .
cd ../rootfs/
tar -xvf ../../../Lichee/buildroot/backuptotalokrootfs_20200922/rootfs.tar -C .
cd ../.. && \
umount ./tmpmnt/boot/ && \
umount ./tmpmnt/rootfs/ && \
最后解除文件系统挂载:
kpartx -dv V3S-OK.img
然后就可以用win32diskImage 刷入了,起飞!
离线
分享全志主线u-boot/linux 打包 TF/SD/SDNAND 镜像脚本
http://whycan.com/t_4008.html
(出处:哇酷开发者社区【全志 V3S/F1C100s/X3】)
谢谢分享,
离线
点个赞!
别,别,看下二楼,这个东西本就有个脚本生成了我还自己瞎折腾了。
离线