0

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:

  1. Raspberry checks if a certain file is present on the boot partion (for example fallback.txt).
  2. If fallback.txt is present use the kernel image fallback.img
  3. If not, use the zImage.img and as a first step write the file fallback.txt
  4. 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.

Is this possible?

2 Answers 2

2

If there's no

kernel=zImage

line in /boot/config.txt then your system will load kernel.img, kernel7.img or kernel7l.img (depending on the model). So the simple fix is to make

kernel=zImage

into a comment. You can do that on Windows or with the NOOBS recovery console.

#kernel=zImage

and it will boot normally (as long as you've got the original kernel and original matching /lib/modules/$(uname -r) folder that goes with it.

The other quick fix is a second bootable SDCard and a USB reader.

0

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.

1
  • Yes I have checked this. The boot modes only describe possibilities to have external secondary options (USB/ethernet). I am looking for an internal option.
    – Steven
    Sep 17, 2018 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.