Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The ISO should work for BIOS or UEFI and can be dd'ed to a USB device.
- ```
- sudo apt-get install \
- isolinux \
- grub-pc-bin \
- grub-efi-amd64-bin
- ```
- Create some dirs.
- ```
- mkdir -p $HOME/live_boot/image/{boot/isolinux,EFI/boot}
- ```
- Copy isolinux files.
- ```
- sudo cp \
- /usr/lib/ISOLINUX/isolinux.bin \
- $HOME/live_boot/image/boot/isolinux/ && \
- sudo cp \
- /usr/lib/syslinux/modules/bios/* \
- $HOME/live_boot/image/boot/isolinux/
- ```
- Generate a `grub.cfg` menu configuration file.
- ```
- cat <<'EOF' >/tmp/grub.cfg
- search --no-floppy --set=root --file /DEB_CUSTOM_ISO.file
- insmod all_video
- set default="0"
- set timeout=30
- menuentry "Debian Live" {
- linux /live/vmlinuz boot=live quiet nomodeset
- initrd /live/initrd
- }
- EOF
- ```
- Create a uniquely named file that we will use to infer our Grub root when we boot.
- ```
- touch $HOME/live_boot/image/DEB_CUSTOM_ISO.file
- ```
- Generate a UEFI boot image. You probably do not need all these modules. I ended up with this list after troubleshooting, and never trimmed the module list after I got things working. `grub-mkstandalone` is neat. It creates a self-contained file with everying Grub needs to boot, which is kind of nice since you needn't worry about paths, copying modules to the wrong spot, etc. This was most reliable for me across different hardware, but there make be a better way of doing this.
- ```
- grub-mkstandalone \
- --directory="/usr/lib/grub/x86_64-efi" \
- --format=x86_64-efi \
- --output=$HOME/live_boot/image/EFI/boot/bootx64.efi \
- --modules="linux normal iso9660 efi_uga efi_gop fat chain disk exfat usb multiboot msdospart part_msdos part_gpt search part_gpt configfile ext2 boot" \
- "boot/grub/grub.cfg=/tmp/grub.cfg"
- ```
- Create a FAT16 EFI disk image.
- ```
- (cd $HOME/live_boot/image/EFI && \
- dd if=/dev/zero of=efiboot.img bs=1M count=100 && \
- mkfs.vfat efiboot.img && \
- mmd -i efiboot.img efi efi/boot efi/boot/grub && \
- mcopy -i efiboot.img boot/bootx64.efi ::efi/boot/
- )
- ```
- Generate an `isolinux.cfg` menu configuration file.
- ```
- cat <<'EOF' >$HOME/live_boot/image/boot/isolinux/isolinux.cfg
- UI menu.c32
- MENU TITLE ISOLINUX Boot Menu
- DEFAULT linux
- TIMEOUT 600
- LABEL linux
- MENU LABEL Some Linux Entry
- MENU DEFAULT
- KERNEL /live/vmlinuz
- APPEND initrd=/live/initrd boot=live quiet
- TEXT HELP
- Boot Linux
- ENDTEXT
- EOF
- ```
- Generate the ISO file. Note the `-isohybrid-mbr` flag, which allows writing the ISO to USB with `dd`.
- ```
- xorriso \
- -as mkisofs \
- -iso-level 3 \
- -full-iso9660-filenames \
- -volid "DEBIAN_CUSTOM" \
- -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
- -eltorito-boot \
- boot/isolinux/isolinux.bin \
- -no-emul-boot -boot-load-size 4 -boot-info-table \
- --eltorito-catalog boot/isolinux/isolinux.cat \
- -eltorito-alt-boot \
- -e EFI/efiboot.img \
- -no-emul-boot -isohybrid-gpt-basdat \
- -output "${HOME}/live_boot/debian-custom.iso" \
- "${HOME}/live_boot/image"
- ```
Add Comment
Please, Sign In to add comment