7

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 ?

2
  • If you don't want to modify anything how is this supposed to work? Commented Aug 10, 2012 at 0:38
  • What's wrong with... rebooting? Commented Aug 10, 2012 at 2:31

2 Answers 2

8

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.

7

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.

4
  • 2
    kexec is designed to load a Linux kernel. I don't believe it's capable of loading anything else. Commented Aug 10, 2012 at 2:31
  • You can specify any binary for the payload IIRC. Commented Aug 10, 2012 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. Commented Sep 24, 2012 at 2:13
  • Edits made based on @Kevin's comment. Good point. Commented Sep 24, 2012 at 3:10

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.