Skip to content

Instantly share code, notes, and snippets.

@gr33n7007h
Created March 29, 2016 10:56
Show Gist options
  • Save gr33n7007h/ded3928f2383e220a14f to your computer and use it in GitHub Desktop.
Save gr33n7007h/ded3928f2383e220a14f to your computer and use it in GitHub Desktop.
iso9660
Creating a multiboot USB-Stick
==============================
Short notes on how to create a multiboot capable USB-Stick with efi/bios support,
a Windows usable data partiton and a System Rescue CD boot entry.
Creating the partition table
------------------------------
Use gdisk to create a new empty gpt table with protective mbr.
:::shell
gdisk /dev/sdX
Create four partitions, a data partion as first partion as this is the only partiton that can
be accessed by Widows.
A 2MB bios partition type ef02, a 100MB efi partition type ef00 and a partion to hold the
iso images and the grub installation and config files.
Formating the partitions
-----------------------------
I used ntfs for the data partition the bios partion can stay raw, fat32 for the efi partition
and ext4 for my grub/iso partiton
:::shell
mkfs.ntfs -f -L "USB_DATA" -v /dev/sdX1
mkfs.vfat -F32 -n "EFI" /dev/sdX3
mkfs.ext4 -L multiboot /dev/sdX4
Mounting the partitions
-----------------------------
:::shell
mkdir /mnt/stick
mount /dev/sdX4 /mnt/stick
mkdir /mnt/stick/efi
mount /dev/sdX3 /mnt/stick/boot/efi
mkdir /mnt/stick/boot
Installing grub for both efi and bios
-----------------------------
EFI install may only work out of the box if booted in an efi enabled environment.
:::shell
grub-install --no-floppy --target x86_64-efi --efi-directory /mnt/stick/efi --boot-directory /mnt/stick/boot /dev/sdX
grub-install --no-floppy --target i386-pc --boot-directory /mnt/stick/boot /dev/sdX
Edit grub.cfg and enable System Rescue CD boot entries
----------------------------
Downloaded the latest Version of the System Rescue CD at time of writing 4.5.1
and copy it to the stick.
:::shell
mkdir /mnt/stick/boot/iso
cp systemrescuecd-x86-4.5.1.iso /mnt/stick/boot/iso
Edit the grub.cfg in `/mnt/stick/boot/grub/grub.cfg` to look like this
Note: The grub.cfg has some more iso files added but they are untested.
~~~~
set timeout=10
set default=1
set sysresciso="/boot/iso/systemrescuecd-x86-4.5.1.iso"
set tailsiso="/boot/iso/tails-i386-1.2.3.iso"
set kaliiso="/boot/iso/kali-linux-1.1.0-amd64.iso"
set mintiso="/boot/iso/linuxmint-17.1-cinnamon-64bit.iso"
menuentry "SystemRescueCD 64bit load to RAM" {
set isofile=$sysresciso
loopback loop $isofile
linux (loop)/isolinux/rescue64 isoloop=$isofile setkmap=de docache
initrd (loop)/isolinux/initram.igz
}
menuentry "SystemRescueCD 32bit load to RAM" {
set isofile=$sysresciso
loopback loop $isofile
linux (loop)/isolinux/rescue32 isoloop=$isofile setkmap=de docache
initrd (loop)/isolinux/initram.igz
}
menuentry "Tails" {
loopback loop /boot/iso/tails-i386-1.2.1.iso
linux (loop)/live/vmlinuz findiso=$tailsiso boot=live config live-media=removable apparmor=1 security=apparmor nopersistent noprompt timezone=Europe/Berlin block.events_dfl_poll_msecs=1000 splash noautologin module=Tails quiet
initrd (loop)/live/initrd.img
}
menuentry "Kali-Linux" {
set isofile=$kaliiso
bootoptions="findiso=$isofile boot=live noconfig=sudo username=root hostname=kali quiet splash"
search --set -f $isofile
loopback loop $isofile
linux (loop)/live/vmlinuz $bootoptions
initrd (loop)/live/initrd.img
}
menuentry "Linux Mint" {
loopback loop $mintiso
linux (loop)/casper/vmlinuz boot=casper quiet splash noeject noprompt iso-scan/filename=$mintiso --
initrd (loop)/casper/initrd.lz
}
~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment