I am working on a project where upgrades to the Raspberry PI will over HTTP, and the Raspberry PI will not be directly accessible (cannot just swap cards).
I would like to have a partition setup like so:
- Partition 1- /boot (contains kernels for both partitions)
- Partition 2- / (recovery partition)
- Partition 3- / (primary partition)
When an upgrade goes bad and the Raspberry PI gets into a reboot loop, or hangs on boot, I'd like the user to be able to press a button, which triggers a GPIO line, which would cause the boot loader to boot into the recovery partition instead of the primary partition.
The recovery partition would never be upgraded, so this would be safe.
I see a couple of options:
- Always boot into the recovery partition, check GPIO, then boot into primary partition of no button pressed
- GPIO is checked by the boot loader directly
I'm basically trying to do something similar to what routers do, where if you hold in reset while it boots you can TFTP over a new image or something.
Is this possible with the Raspberry PI? If so, is there any documentation for doing this sort of thing?
Edit:
I found this answer to this related question: Is it possible to dual boot from the SD card?
A comment on the above question led me here: http://www.berryterminal.com/doku.php/berryboot. This looks promising, but I'll have to research it more to see if I can get a GPIO read from it. If anyone has any experience with it, I'd be very interested.
/boot
(RO),/
(RO),/var
(RW),/home
(RW). The initial problem was filesystem corruption when power is cut during boot. I'd still like like to write/find a 2nd stage bootloader though. – beatgammit Nov 30 '13 at 20:45