2023/09/22 14:15
以SD卡升级spi nand为例:
1、修改uboot-env.txt文件
board/nuvoton/ma35d1/uboot-env.txt
在spinandboot命令下添加if fatload mmc 0:1 0x90000000 uboot-update-cmd.img;then source 0x90000000;fi;
spinandboot=if test ${mtdids} = 'spi-nand0=spi-nand0' ;then echo "Booting from spinand ... ...";if fatload mmc 0:1 0x90000000 uboot-update-cmd.img;then source 0x90000000;fi; mtd list; setenv bootargs noinitrd ubi.mtd=${spinand_ubiblock} root=ubi0:rootfs rootfstype=ubifs rw rootwait=1 console=ttyS0,115200n8 rdinit=/sbin/init mem=${kernelmem}; mtd read kernel ${kernel_addr_r}; mtd read device-tree ${fdt_addr_r}; booti ${kernel_addr_r} - ${fdt_addr_r}; fi
2、新建一个文件uboot-update.script,里面是下面的命令:
fatls mmc 0:1
mtd erase device-tree
mtd erase kernel
mtd erase rootfs
fatload mmc 0:1 0x90000000 img5.bin
mtd write device-tree 0x90000000
fatload mmc 0:1 0x90000000 img6.bin
mtd write kernel 0x90000000
fatload mmc 0:1 0x90000000 img7.bin
mtd write rootfs 0x90000000
3、用output/host/bin目录下的mkimage工具将文件uboot-update.script转换成image(uboot-update-cmd.img)
./mkimage -A arm -O linux -T script -C none -n "uboot-nor script" -d ~/workspace/uboot-update.script ~/workspace/uboot-update-cmd.img
4、把需要更新的image 和uboot-update-cmd.img拷贝到SD卡,SD卡插入到开发板