Advertisement
Guest User

MultiBoot USB with Grub2 (boot directly from iso files)

a guest
Mar 26th, 2013
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. ##############################################
  4. # Source: http://www.panticz.de/MultiBootUSB #
  5. #       Thank you, Pawel Konczalski          #
  6. ##############################################
  7.  
  8. DEVICE=/dev/$1
  9. VOLUME=MultiBootUSB
  10.  
  11.  
  12. # create filesystem on usb pen
  13. sudo mkfs.vfat -n ${VOLUME} ${DEVICE}1
  14.  
  15.  
  16. sudo mkdir /mnt/MultiBootUSB
  17. # mount usb
  18. sudo mount ${DEVICE}1 /mnt/MultiBootUSB
  19.  
  20.  
  21. # install grub2 on usb pen
  22. sudo grub-install --no-floppy --root-directory=/mnt/MultiBootUSB ${DEVICE}
  23.  
  24.  
  25. # create grub config
  26. cat <<EOF> /mnt/MultiBootUSB/boot/grub/grub.cfg
  27. menuentry "Ubuntu Live 10.04 32bit" {
  28.  loopback loop /boot/iso/ubuntu-10.04-desktop-i386.iso
  29.  linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-10.04-desktop-i386.iso noeject noprompt --
  30.  initrd (loop)/casper/initrd.lz
  31. }
  32.  
  33. menuentry "Ubuntu Live 10.04 64bit" {
  34.  loopback loop /boot/iso/ubuntu-10.04-desktop-amd64.iso
  35.  linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-10.04-desktop-amd64.iso noeject noprompt --
  36.  initrd (loop)/casper/initrd.lz
  37. }
  38.  
  39. menuentry "Ubuntu Alt 10.04 32bit" {
  40.  loopback loop /boot/iso/ubuntu-10.04-alternate-i386.iso
  41.   linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-10.04-alternate-i386.iso noeject noprompt --
  42.    initrd (loop)/casper/initrd.lz
  43. }
  44.  
  45. menuentry "Ubuntu Alt 10.04 64bit" {
  46.  loopback loop /boot/iso/ubuntu-10.04-alternate-amd64.iso
  47.    linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/boot/iso/ubuntu-10.04-alternate-amd64.iso noeject noprompt --
  48.       initrd (loop)/casper/initrd.lz
  49.    }
  50.  
  51.  
  52. menuentry "tinycore" {
  53.  loopback loop /boot/iso/tinycore_2.3.1.iso
  54.  linux (loop)/boot/bzImage --
  55.  initrd (loop)/boot/tinycore.gz
  56. }
  57.  
  58.  
  59. menuentry "BackTrack 4" {
  60.  linux /boot/bt4/boot/vmlinuz BOOT=casper boot=casper nopersistent rw vga=0x317 --
  61.  initrd /boot/bt4/boot/initrd.gz
  62. }
  63.  
  64. menuentry "Memory test (memtest86+)" {
  65.  linux16 /boot/img/memtest86+.bin
  66. }
  67.  
  68. menuentry "BackTrack ERR" {
  69.  loopback loop /boot/iso/bt4-pre-final.iso
  70.  linux (loop)/boot/vmlinuz find_iso/filename=/boot/iso/bt4-pre-final.iso BOOT=casper boot=casper nopersistent rw vga=0x317--
  71.  initrd (loop)/boot/initrd.gz
  72. }          
  73.  
  74.  
  75. menuentry "netboot.me" {
  76.  loopback loop /boot/iso/netbootme.iso
  77.  linux16 (loop)/GPXE.KRN
  78. }
  79.  
  80. EOF
  81.  
  82. # create iso directory
  83. sudo mkdir /mnt/MultiBootUSB/boot/iso
  84.  
  85. #
  86. # download images
  87. #
  88.  
  89.  
  90. # tinycore
  91. wget http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/2.x/release/tinycore_2.3.1.iso -P /mnt/MultiBootUSB/boot/iso
  92.  
  93.  
  94.  
  95. # netboot.me
  96. wget http://static.netboot.me/gpxe/netbootme.iso -P /mnt/MultiBootUSB/boot/iso
  97.  
  98. # umount
  99. sync
  100. sudo umount /mnt/MultiBootUSB
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109. # update debian installation files (/mnt/boot/debian/update.sh)
  110. mount $DEVICE /mnt/MultiBootUSB
  111. wget http://ftp.de.debian.org/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz -O initrd.gz
  112. wget http://ftp.de.debian.org/debian/dists/stable/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux -O linux
  113.  
  114.  
  115.  
  116.  
  117. # links
  118. #https://bugs.launchpad.net/ubuntu/+bug/94204
  119. #http://debianforum.de/forum/viewtopic.php?f=32&t=111249
  120. #http://michael-prokop.at/blog/2009/05/25/boot-an-iso-via-grub2/
  121. #https://wiki.edubuntu.org/Grub2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement