linux - Boot ISO image from GRUB4DOS on EFI machines

16
2014-04
  • Vladimir Tikhomirov

    I failed with loading ISO image (non-distro) from GRUB2 from USB stick, but found the way how I can boot the GRUB4DOS and then load the image from there. However, it doesn't work all the time and the questions is WHY it doesn't?

    Environment and loading process:

    We need to have EFI machine, USB stick, booting ISO, GRUB2 and GRUB4DOS. Last 3 on USB stick. Boot: USB -> EFI loader -> GRUB2 -> GRUB4DOS -> ISO image

    Configuration files

    To boot GRUB4DOS I use this from grub.cfg:

    menuentry "image.iso" { linux /syslinux/grub.exe --config-file="/menu.lst" }

    My menu.lst is here:

    timeout 20

    default 0

    title image.iso

    find --set-root --ignore-floppies --ignore-cd //image.iso

    map --heads=0 --sectors-per-track=0 //image.iso (hd32)

    map --hook

    chainloader (hd32)

    This works perfectly with Legacy machines.

    However, when I come to GRUB4DOS, I don't see the menu with image.iso, I see only GRUB command line. That means that my menu.lst didn't load.

    Why is it like this?

    Background and ideas

    1. I have an idea that GRUB4DOS doesn't recognize my USB stick as a device. I tried the command find and got (hd0,0), (hd0,1), (hd0,2), (rd). When I tried to set root to any of these devices I don't see fat file system, how it was with Legacy machines. The root device is (hd0,0), which has ntfs file system which should be partition with Windows.
    2. EFI machines support only GRUB2, so I can't boot GRUB4DOS straight away.
    3. Please, don't suggest anything like this, because my image doesn't have kernel. You can imagine that you load HDAT2 or Hiren's boot cd, for example.

      menuentry "Blancco Blancco5.iso" {

      set isofile="/image.iso"

      loopback loop $isofile

      set root=(loop)

      linux /isolinux/vmlinuz isofile=$isofile splash quiet

      initrd /isolinux/initrd

      }

  • Answers
  • Seasoned Advice (cooking)

    GRUB4DOS will not work in EFI environment, in any case. It needs a BIOS!


  • Related Question

    linux - Boot iso images from bootable USB
  • Questioner

    I'm trying to figure out an universal solution to have a multi-boot usb memory stick. I have some ISO images like: knoppix, debian, ubuntu, etc.

    Is there any way to do the following procedure:

    1. List item
    2. load a micro kernel/bootloader from bootable memory stick into RAM
    3. load the most necessary modules to mount filesystem, iso, etc.
    4. boot directly from that iso.

    I know that there are several solutions I've found but non of them are universal:

    1. grub4dos can load the whole image to ram and then boot it. -> it's ok if the image is small, but if it has e.g. 4 GB of RAM than we should have at least 6-8GB to work properly.
    2. grub2 can boot from iso, but we need to know exactly what's the syslinux parameters. This is an example configuration of grub.cfg that I've prepared for my Knoppix ISO:

      menuentry "Knoppix" {
      set isofile="/boot/iso/knoppix.iso"
      echo "Loading kernel.."
      loopback loop $isofile
      linux (loop)/boot/isolinux/linux64 boot=casper iso-scan/filename=$isofile ramdisk_size=100000 lang=en vt.default_utf8=0 acpi=off apm=power-off vga=791 nomce fromiso=$isofile noeject noprompt --
      echo "Loading modified initrd.."
      initrd (loop)/boot/isolinux/minirt.gz
      

      }

    The problem is that after kernel boots, the init process can not find the mounted files even if they are exist on my loopback mounted iso.

    I was able to boot successfully some of my ISOs but that's not universal way. Sometimes it fails.

    And what about Windows installer. Let say some of my friends who don't have any CD/DVD device want me to reinstall the system. Can I do that with the similar way? Honestly I would probably solve that problem few years ago, but I've been working on Linux platform for many years and have contact with Windows-es only at work.


  • Related Answers
  • deveneyi

    There are a few options listed on PendriveLinux, XBOOT, YUMI and SARDU, run under Windows and MultiSystem runs under Linux.

    I've not used it myself but SARDU can apparently be used for the Windows Installer too.

  • Thor

    Linux_420 has a nice write-up over at LQ on how to use syslinux for this.