I have a raspberry with a customized OS. The image it should load is described in the config.txt on the boot partition. The image is called zImage and the line in the config.txt is:

kernel=zImage

I expect to update it from time to time by updating the whole zImage. Now I am wondering that if I accidentally upload a faulty new zImage.img which causes a faulty system start (no start or partial start). Is there a way that I can use a fallback zImage?

So my ideal boot procedure would be:

Raspberry checks if a certain file is present on the boot partion (for example fallback.txt).

If fallback.txt is present use the kernel image fallback.img

If not, use the zImage.img and as a first step write the file fallback.txt

Boot and perform some checks. If everything is ok, delete fallback.txt

In this configuration I would always have a bootable system, even if I mess up the update of the system. I have been searching if this is possible but I only find procedures to boot through USB.

1 Answer
1

Modifying boot procedure is very difficult on Raspberry Pi because it is a custom solution for Raspberry Pi and deep integrated into the firmware. As far as I know there are parts closed source. You will find a description from the official site at Raspberry Pi boot modes. Have a look at Boot flow there.