I have an embedded device with a SPI connected flash. Basically this means the device boots its bootloader and Linux kernel from a small flash part.
As the device boots, but before the root filesystem is mounted and switch_root is called – I’d like to optionally boot a second, different, kernel
Is such a thing possible? My goal in this is to have a very minimal bootloader and stock kernel in flash – but then to put a newer/larger kernel on a hard disk.
My bootloader is very limited, where I cannot read the newer kernel from the hard disk.
a) CPU comes out of reset, reads its bootloader from flash b) bootloader boots, inits basic hardware, loads Linux kernel from flash c) kernel boots, inits more hardware, and reads a second kernel from a hard disk d) I'd like to switch to the second kernel at this point
my goal in this process is to provide a mechanism where the kernel in flash can get old with time, but updated kernels can be supplied via the hard disk. If my bootloader were more advanced, I’d go that route – however it’s not able to initialize the hardware necessary (the disk controller), nor does it have modern filesystem support
…an option I’ve pondered is if it’d be possible to put the second kernel into physical memory, mark a known address as having this second kernel, then reset. The boot loader could then detect the known address and verify the integrity of the second kernel, choosing it instead of one coming from Flash
any tips would be appreciated!
You don’t have to do anything too complicated. Just call
kexec to boot into the new kernel. It couldn’t get simpler…unless your old kernel was somehow compiled without kexec support.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.