Sunday, February 16, 2014

grub2 boot iso image inside usb drive

1- install grub2
# apt-get install grub2

2- install grub into the usb for example in /dev/sdc
 - # mkdir /dev/sdc1 /mnt
 - # mkdir /mnt/boot1
 - # grub-install --force --no-floppy --boot-directory=/mnt/boot1 /dev/sdc
- create grub.cfg in /mnt/boot1/boot/grub with the following content
   $ cat /mnt/bout1/grub/grub.cfg

menuentry 'ISO tiny core ' {

    set isofile="/Core-current.iso"

    loopback loop (hd0,1)$isofile

    linux (loop)/boot/vmlinuz boot=boot iso-scan/filename=$isofile noprompt noeject

    initrd (loop)/boot/core.gz


3- copy core-current.iso to /mnt/
download itnycore

4- now the usb is bootable, (reboot the system, or disconnect usb then reconnect again)
if you to test with qemu  -- run

# qemu-system-x86_64 -hda /dev/sdc -m 400
or  with boot menu
# qemu-system-x86_64 -hda /dev/sdc -m 400 -boot menu=on

No comments:

Post a Comment