Oct 4, 2010

booting iso from grub2

1. Format a partition on the USB stick to some filesystem that's supported by GRUB 2 in the way you prefer to do that.
sudo mkfs.vfat /dev/sdd1

2. mount partition on the temp directory
sudo mkdir /media/flash_disk
sudo mount /dev/sdd1 /media/flash_disk/

3. Install GRUB 2 onto the USB stick.
sudo grub-install --no-floppy --root-directory=/media/flash_disk/ /dev/sdd

4. Edit /media/flash_disk/boot/grub/grub.cfg to point to the ISO files.
set timeout=10
set default=0

menuentry "Run Ubuntu Live 10.04" {
 loopback loop /ubuntu-10.04-desktop-i386.iso
 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-10.04-desktop-i386.iso splash --
 initrd (loop)/casper/initrd.lz
}

menuentry "Ubuntu 10.4 Server i386" {
loopback loop /ubuntu-10.04-server-i386.iso
linux (loop)/install/vmlinuz --
initrd (loop)/install/initrd.gz
}

5. copy linux cdrom iso to /media/flash_disk
cp ubuntu-10.04-desktop-i386 /media/flash_disk/

6. booting by qemu
sudo /opt/bin/qemu -hda /dev/sdd -boot c -m 256 -localtime

No comments: