Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have remote embedded Linux devices I am trying to update to a new kernel without having to physically access. However, the command line options they boot with make one of the MTDs read only - I cannot modify the kernel, and U-Boot is only accessible over a physical, serial connection.

kexec support was not installed.

I am trying to build kexec myself, but not having any success. I have built the kexec from kexec-tools, but when I attempt to load a kernel, I get:

kexec_load failed: Function not implemented

Is there any way I can salvage this situation? Can kexec be made as a single binary executable? I have seen on forums where people have suggested they were using it this way, but I cannot seem to build it as such.

Edit:  If making kexec work is not an option, is there any way I can get access to MTD0? I don't have access to one of the devices this second, but there's something like /proc/something/devices/virtual/mtd0/ro, which is 1, and if I chmod 777 it I can echo 0 > to it without any errors, but it doesn't stick.

share|improve this question
Hmmm, maybe kexec can be built as a module, then loaded into the running kernel? At least if modules are enabled. – derobert May 8 '13 at 22:17
@derobert - that was a thought. I've toyed with it, but no success thus far, and I'm not even entirely sure I'm doing it right - I've never made a module other than a little hello world before. – trycatch May 9 '13 at 0:31
Build it as a module, as in pick 'M' instead of 'N' to the kexec option in the kernel config, then build the kernel (or at least the modules). If done with the same build environment & kernel sources as the running kernel, that should leave you with a kexec.ko ready for insmod on the target system. Then kexec-tools will work like normal. (I'd post as an answer, but I'm not sure if kexec can be built as a module). – derobert May 9 '13 at 15:31
@derobert - The hooks do appear to be there in the kexec.c source, but menuconfig only gives you =y or =n as options. I'm currently trying to pull out the relevant pieces and hammer it into a module by hand. – trycatch May 9 '13 at 15:57
Just for kicks check if maybe you could modify the mtd partition containing the U-boot env vars, but I'm sure that's read only too, right? – LawrenceC Apr 11 '14 at 18:40

kexec is a mechanism by which the running kernel replaces itself by another one. An external program doing so would have to have an extremely intimate knowledge of the kernel(s) involved, and kernel-level access to everything on the machine too. Perhaps doable, but I think nobody is crazy enough to try.

share|improve this answer
That complex? I thought kexec did about the same as Grub: Load the kernel image and the initrd into memory, tell them where and start it. What should it do more? I quote from the man page: "The primary difference between a standard system boot and a kexec boot is that the hardware initialization normally performed by the BIOS or firmware (depending on architecture) is not performed during a kexec boot." – Hauke Laging May 8 '13 at 22:43
@HaukeLaging - That was my thought. I've seen on a few forums where people have allegedly flashed new Android kernels using kexec binaries, but I can't find any instruction as to how. – trycatch May 9 '13 at 0:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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