Kexec Load Error

Has anyone used kexec successfully?

Hardware: Raspberry Pi 4B (2GB)
OpenWrt version: self-build BCM2709 snapshot

I'm trying to implement the following scenario:

  1. Pi boots an pre-configured Openwrt initramfs kernel from card.
  2. This kernel connects to a wifi LAN and downloads another pre-configured OpenWrt initramfs kernel containing the application.
  3. kexec is used to pivot to the new kernel, which runs the application after it boots.

I want a system working this way as it needs to be very robust against extreme temperatures and power cuts. There should not be any writing to the local USB or SD card, ever.

So far 1 and 2 works, but at step 3, kexec throws an "Invalid argument" error during the load (I know I will have to do something about the device tree as well, but it seems it doesn't even get that far.) Here I'm testing with the same kernel that just booted. I have enabled "Kernel support for kexec" in menuconfig. I'm using the 32 bit BCM2709 build because this option isn't in the arm8 BCM2711 build.

root@Pi4:/mnt# kexec -ld kernel7l.img
Try gzip decompression.
Try LZMA decompression.
lzma_decompress_file: read on kernel7l.img of 65536 bytes failed
kernel: 0xb5012010 kernel_size: 0x1e2e958
MEMORY RANGES
0000000000000000-000000003b2fffff (0)
0000000040000000-000000007fffffff (0)
zImage header: 0xe16ff009 0xe12ef30e 0xe160006e
kexec_load: entry = 0x8000 flags = 0x280000
nr_segments = 2
segment[0].buf   = 0xb5012010
segment[0].bufsz = 0x1e2e958
segment[0].mem   = 0x8000
segment[0].memsz = 0x1e2f000
segment[1].buf   = 0x13a0c80
segment[1].bufsz = 0xba78
segment[1].mem   = 0x96f2000
segment[1].memsz = 0xc000
kexec_load failed: Invalid argument
entry       = 0x8000 flags = 0x280000
nr_segments = 2
segment[0].buf   = 0xb5012010
segment[0].bufsz = 0x1e2e958
segment[0].mem   = 0x8000
segment[0].memsz = 0x1e2f000
segment[1].buf   = 0x13a0c80
segment[1].bufsz = 0xba78
segment[1].mem   = 0x96f2000
segment[1].memsz = 0xc000
root@Pi4:/mnt# kexec -e
Nothing has been loaded!

@mk24 Has it been solved´╝čI have same question.