You should use the kexec system call directly, the file that you need
to edit is src/initng_main.c.

Good luck ;).

Thank you. I have did it, and it worked perfectly.

If you have any interest in this, here is some information:

I read the kexec user program source code. When it is invoked with "kexec
-e", it calls a sync() function, a ifdown() function, and finally tells the
kernel to run the (already loaded by the kexec -l command) kernel image.
I assume that the sync() function flushes the disk buffers, that the
ifdown() function brings network interfaces down. I also assume that initng
already does this when rebooting, so the only thing that I have to add to
initng is the system call that makes the kernel run the new kernel.

[EMAIL PROTECTED] ~ $ diff oldinitng/initng-0.6.8/src/initng_main.c
/home/jorge/initng/initng-kexec-0.1/src/initng_main.c
51c51,55
<
---
#include <sys/syscall.h>
#include <unistd.h>
#define       LINUX_REBOOT_MAGIC1     0xfee1dead
#define       LINUX_REBOOT_MAGIC2     672274793
#define LINUX_REBOOT_CMD_KEXEC                0x45584543
229a234
                              syscall(__NR_reboot, LINUX_REBOOT_MAGIC1,
LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0);
[EMAIL PROTECTED] ~ $

As you see, I have added the syscall and I have not removed the call to the
reboot() function that initng already had. I did this because, I think, if
the kernel fails to load the new kernel image (for example, the user did not
load the kernel image) than the reboot() function will do a normal reboot. I
have tested (rebooting the computer without loading the kernel image) and it
worked.

Anyway, I would be more confident If I could read the documentation for the
kexec system call.  I have not found it anywhere. (I looked in
/usr/src/linux/Documentation, in the TLDP, and in Google). Do you know where
I can find it?

--
Software is like sex: it is better when it is free.
-- 
_______________________________________________
Initng mailing list
[email protected]
http://jw.dyndns.org/mailman/listinfo/initng

Reply via email to