Dual kernel firmware

Is it possible to build 2 kernel in single firmware image?
i want to use 2 kernel for alternate use where crashing of first kernel ,auto from uboot 2nd kernel start working or copy itself to first kernel??
what can be the changes in image file?

Well, the way you describe it, it's probably impossible to get it right... It will ultimately come down to what device you are using (you didn't tell), but even then: you'll have to account for a lot of "false positive" like brownouts/blackouts/hw-failures that cause the device to reboot/crash but not because of a kernel crash.

Furthermore, the kernel + filesystem are coupled. This is because OpenWrt "offloads" many important modules to the filesystem in order to save valuable space in the kernel partitions. So you can't really have "two different" kernels without adapting the filesystem to support "two different" kernels. So the 2nd kernel partition can only effectively serve as a backup in case of flash errors corrupt the 1st kernel partition.
(Which based on your description does not really match your use-case anymore. Since the way you describe it, it wouldn't make sense since both kernel are the same).

1 Like

Thanks chunkeey for the guidance.
Yes ,even i didnt face any kind of sudden kernel crashes in openwrt till now.
Actually i am concerned by the case of occurrence of power failure or power fluctuation while upgrading or flashing firmware to the hardware.In that case, what can be the better solution instead of uploading firmware by tftp manually?

  • buy a device with dual firmwares. Some devices like Linksys WRT1900AC series (and 1200 and 3200 etc.) have two firmwares installed and the u-boot bootloader switches to use the other firmware if one firmware fails to complete the login process. So, it is not one dual-kernel firmware but two alternative firmwares.
  • use UPS. In any case even in a double firmware scenario there is a vulnerable moment when you are just flashing the info which firmware you are using. So, if power stability is your problem, use UPS.