cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bfung_2
Adventurer
Adventurer
227 Views
Registered: ‎07-02-2020

U-Boot bootscript for Back-up image

I'm trying to figure out what commands to add to boot.scr to boot a safe image in case the working image is broken. Suppose I have an image.ub and image_golden.ub in my Boot partition of my SD card, what commands would allow u-boot to perform this action?

At the moment, my bootscript checks if there's an SD card and an image.ub file:

if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" ; then
if test -e ${devtype} ${devnum}:${distro_bootpart} /image.ub; then
fatload ${devtype} ${devnum}:${distro_bootpart} 0x10000000 image.ub;
bootm 0x10000000;
exit;
fi
if test -e ${devtype} ${devnum}:${distro_bootpart} /uImage; then
fatload ${devtype} ${devnum}:${distro_bootpart} 0x00200000 uImage;;
fi
if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then
fatload ${devtype} ${devnum}:${distro_bootpart} 0x00100000 system.dtb;
fi
if test -e ${devtype} ${devnum}:${distro_bootpart} /rootfs.cpio.gz.u-boot; then
fatload ${devtype} ${devnum}:${distro_bootpart} 0x04000000 rootfs.cpio.gz.u-boot;
bootm 0x00200000 0x04000000 0x00100000
exit;
fi
bootm 0x00200000 - 0x00100000
exit;

If the image.ub fails, would the if-else statement progress such that I can add another if-else to boot the image_golden.ub? I guess I'm unclear about the progression of execution and the boot sequencing.

 

Thanks.  

Tags (2)
0 Kudos
2 Replies
hokim
Scholar
Scholar
141 Views
Registered: ‎10-21-2015

Hi

test -e xxx means the existence of file.

As I know, there is no way to figure out the failure of u-boot image program in boot.scr

0 Kudos
stephenm
Xilinx Employee
Xilinx Employee
94 Views
Registered: ‎09-12-2007

What you are trying to do will not work from a uboot script. You can use a wdt, and if this isnt kicked, then you could revert to a golder boot image. The bootrm supports mutiboot for this reason.

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842403/Zynq+Ultrascale+MPSoC+Multiboot+and+Fallback

0 Kudos