Skip to content

Instantly share code, notes, and snippets.

@borysn
Last active March 6, 2023 06:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save borysn/472f6776816c1ceaf8548b424fd29c44 to your computer and use it in GitHub Desktop.
Save borysn/472f6776816c1ceaf8548b424fd29c44 to your computer and use it in GitHub Desktop.
multiboot iso usb
# multiboot iso grub config
set timeout=15
set default=0
# (U)EFI Graphic Protocol
insmod efi_gop
insmod efi_uga
insmod font
if loadfont $(prefix)/fonts/unicode.pf2
then
insmod gfxterm
set gfxmode=auto
set gfxpayload=keep
terminal_output gfxterm
fi
### BEGIN custom menu
menuentry "Gentoo Admin CD (amd64) (2017.02.09)" {
set iso=/iso/admincd-amd64-20170209.iso
set cmdline="root=/dev/ram0 init=/linuxrc dokeymap looptype=squashfs cdroot vga=791"
loopback loop $iso
linux (loop)/image.squashfs $cmdline
initrd (loop)/gentoo.igz
}
menuentry "SystemRescueCD (x86) (5.0.1)" {
set iso=/iso/systemrescuecd-x86-5.0.1.iso
set cmdline="nomodeset vga=791 docache setkmap=us isoloop=$iso"
loopback loop $iso
linux (loop)/isolinux/rescue64 $cmdline
initrd (loop)/isolinux/initram.igz
}
menuentry "Arch Linux (x86/64) (2017.05.01)" {
set iso=/iso/archlinux-2017.05.01-x86_64.iso
set imgdevpath="/dev/disk/by-uuid/13719501-8776-42b8-bbba-b13a8c6f5337"
set cmdline="archisodevice=/dev/loop0 img_dev=$imgdevpath img_loop=$iso earlymodules=loop"
loopback loop $iso
linux (loop)/arch/boot/x86_64/vmlinuz $cmdline
initrd (loop)/arch/boot/x86_64/archiso.img
}
menuentry "Tails (x86) (2.12)" {
set iso=/iso/tails-i386-2.12.iso
set cmdline="boot=live fromiso=$iso config
loopback loop $iso
linux (loop)/live/vmlinuz $cmdline
initrd (loop)/live/initrd.img
}
### END custom menu

multiboot iso usb

create an uefi bootable usb, which boots multiple iso files from a menu

requirements

  1. 16gb usb (or enough space for your iso files and grub)
  2. parted (or your favorite partitioning tool)
  3. dosfstools
  4. grub2

directions

  1. list storage devices
    • $ lsblk
  2. plug in usb!
  3. find usb name
    • $ lsblk
      • look for new device
  4. partition usb
    • $ parted /dev/sdX
    • create a new gpt partition table
      • (parted) mklabel gpt
    • make a new boot partition
      • (parted) mkpart p fat32 1 201
      • (parted) name 1 boot
      • (parted) set 1 boot on
    • make a new data partition
      • (parted) mkpart p ext4 201 100%
      • (parted) name 2 data
    • finals results should look similar
      Disk /dev/sde: 16.1GB
      Sector size (logical/physical): 512B/512B
      Partition Table: gpt
      Disk Flags: 
      
      Number  Start   End     Size    File system  Name  Flags
      1      1049kB  210MB   209MB   fat32        boot  boot, esp
      2      210MB   16.1GB  15.9GB  ext4         iso
      
  5. format partitions
    • $ mkfs.vfat -F32 /dev/sdX1
    • $ mkfs.ext4 /dev/sdX2
  6. create multiboot iso usb
    • mount data partition
      • $ moint /dev/sdX2 /mnt
    • create efi dir
      • $ mkdir /mnt/efi
    • mount boot partition
      • $ mount /dev/sdX1 /mnt/efi
    • install grub
      • $ grub-install --removable --boot-directory=/mnt --efi-directory /mnt/efi --target x86_64-efi
    • create iso dir & copy iso files
      • $ mkdir /mnt/iso
    • create grub.cfg file
      • $ touch /mnt/grub/grub.cfg
      • view my attached grub.cfg file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment