Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm looking for a way to learn about and understand this technique. Here's what I'm talking about:

  • Slax boots, {does stuff, like copy itself to RAM}, then transitions control to the kernel/file system it just made
  • SYSLINUX boots off a FAT32/NTFS system, {does stuff}, then boots into a kernel
  • ISOLINUX boots off a CD/DVD, {does stuff} then boots into a kernel

Is there a name for this? Is it similar in GRUB when using chainloading?

  • GRUB boots, loads selection menu, does selection. If it's a chainloading selection, it passes control to something else.

I'm looking for how I can use one kernel to extract an .iso (from a FAT32/NTFS partition) into RAM, then boot off the RAM drive as if it had been there at startup. For more details as to why I want to do this, see this question.

Here, however, I'm just asking for details about how a kernel "transitions" to another. Is there a name for this? I've heard of INT13h which I believe is used in GRUB/chainloading. Is this a technique to 'reboot into a different kernel'? If not, how is this done?

share|improve this question
    
"see this question" … it appears you've lost a link there. –  derobert Feb 23 '13 at 22:34
    
Sorry about that - it's linked now. –  Ehryk Feb 24 '13 at 0:49
1  
int 13h is just the bios disk read service. –  psusi Feb 24 '13 at 4:56
    
You are mixing here things up, the bootloader loads the kernel and the initrd at a specific location and just jumps to the location. The memory layout etc. has to be known by the kernel and the bootloader see kernel.org/doc/Documentation/x86/boot.txt for the x86 boot protocol. There is no kernel replacement or anything like that. –  Ulrich Dangel Feb 24 '13 at 12:58
    
Indeed, I'm trying to understand this. Basically; it's say I <somehow> build a proper ext3 file system in RAM after booting into SYSLINUX, making a 1GB RAM partition, and copying a linux distro into the ext3 'disk'. How do I then 'boot to' the ext3 partition in memory as though it had been there from boot? –  Ehryk Feb 24 '13 at 22:07
add comment

1 Answer

up vote 1 down vote accepted

I'm guessing this is how: http://linux.die.net/man/8/kexec

kexec(8) - Linux man page

Name

kexec - directly boot into a new kernel

Synopsis

/sbin/kexec [-v (--version)] [-f (--force)] [-x (--no-ifdown)] [-l (--load)] [-p (--load-panic)] [-u (--unload)] [-e (--exec)] [-t (--type)] [--mem-min=addr] [--mem-max=addr]

Description

kexec is a system call that enables you to load and boot into another kernel from the currently running kernel. kexec performs the function of the boot loader from within the kernel. 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. This has the effect of reducing the time required for a reboot. Make sure you have selected CONFIG_KEXEC=y when configuring the kernel. The CONFIG_KEXEC option enables the kexec system call.

share|improve this answer
add comment

Your Answer

 
discard

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.