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 want to reboot from Linux to another system (a bootable CD for my current need).
I don't want to modifiy the current bootloader, nor to modify BIOS settings.

Some Linux CD can be run from Windows (Windows stops and the Linux is runned from the CD).
How can I do the same thing from Linux ?

share|improve this question
    
If you don't want to modify anything how is this supposed to work? –  Ulrich Dangel Aug 10 '12 at 0:38
    
What's wrong with... rebooting? –  Michael Hampton Aug 10 '12 at 2:31
add comment

2 Answers

You might be able to rig something with kexec.

Yes, kexec is intended to boot kernels, but nothing's stopping you from kexec'ing to any binary (a "statically linked" binary that doesn't depend on libraries or an existing running OS and is meant to run under preboot conditions) you want, whether a bootloader or even memtest86 - that page talks about some of the traps you may fall into. E.g., if it's a text mode bootloader, you should switch back to text mode before issuing kexec.

If you're using Debian the kexec-tools or whatever pretty much performs all the normal shutdown steps, including switching back to text mode, before issuing the kexec command.

What kexec won't do is boot a disk or disk image, but you could extract the bootloader from the CD and pass it to kexec. If the boot CD is in the drive I don't see why it wouldn't work but I haven't tried it.

Unpacking an .iso in RAM and getting the .iso's bootloader to run from it without the bootloader being aware of the situation would be technically possible, but extremely difficult. I don't know of any utilities capable of that and don't believe any exist.

share|improve this answer
1  
kexec is designed to load a Linux kernel. I don't believe it's capable of loading anything else. –  Michael Hampton Aug 10 '12 at 2:31
    
You can specify any binary for the payload IIRC. –  ultrasawblade Aug 10 '12 at 20:45
1  
It will probably try to load any binary you give it, but the kernel will then not set up the library linking that userland programs generally require. I.e. if it wasn't written as a kernel, with its own implementation of things such as malloc and printf, it won't work. –  Kevin Sep 24 '12 at 2:13
    
Edits made based on @Kevin's comment. Good point. –  ultrasawblade Sep 24 '12 at 3:10
add comment

You can run grub4dos using kexec:

    kexec -l grub.exe
    kexec -e

Grub4dos is then able to boot from CD:

    cdrom --init
    cdrom --hook
    chainloader (cd0)
    boot

Snippets are from the Grub4dos tutorial.

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.