Guest User

Untitled

a guest
Apr 23rd, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. The ISO should work for BIOS or UEFI and can be dd'ed to a USB device.
  2.  
  3. ```
  4. sudo apt-get install \
  5. isolinux \
  6. grub-pc-bin \
  7. grub-efi-amd64-bin
  8. ```
  9.  
  10. Create some dirs.
  11.  
  12. ```
  13. mkdir -p $HOME/live_boot/image/{boot/isolinux,EFI/boot}
  14. ```
  15.  
  16. Copy isolinux files.
  17.  
  18. ```
  19. sudo cp \
  20. /usr/lib/ISOLINUX/isolinux.bin \
  21. $HOME/live_boot/image/boot/isolinux/ && \
  22. sudo cp \
  23. /usr/lib/syslinux/modules/bios/* \
  24. $HOME/live_boot/image/boot/isolinux/
  25. ```
  26.  
  27. Generate a `grub.cfg` menu configuration file.
  28.  
  29. ```
  30. cat <<'EOF' >/tmp/grub.cfg
  31.  
  32. search --no-floppy --set=root --file /DEB_CUSTOM_ISO.file
  33.  
  34. insmod all_video
  35.  
  36. set default="0"
  37. set timeout=30
  38.  
  39. menuentry "Debian Live" {
  40. linux /live/vmlinuz boot=live quiet nomodeset
  41. initrd /live/initrd
  42. }
  43. EOF
  44. ```
  45.  
  46. Create a uniquely named file that we will use to infer our Grub root when we boot.
  47.  
  48. ```
  49. touch $HOME/live_boot/image/DEB_CUSTOM_ISO.file
  50. ```
  51.  
  52. 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.
  53.  
  54. ```
  55. grub-mkstandalone \
  56. --directory="/usr/lib/grub/x86_64-efi" \
  57. --format=x86_64-efi \
  58. --output=$HOME/live_boot/image/EFI/boot/bootx64.efi \
  59. --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" \
  60. "boot/grub/grub.cfg=/tmp/grub.cfg"
  61. ```
  62.  
  63. Create a FAT16 EFI disk image.
  64.  
  65. ```
  66. (cd $HOME/live_boot/image/EFI && \
  67. dd if=/dev/zero of=efiboot.img bs=1M count=100 && \
  68. mkfs.vfat efiboot.img && \
  69. mmd -i efiboot.img efi efi/boot efi/boot/grub && \
  70. mcopy -i efiboot.img boot/bootx64.efi ::efi/boot/
  71. )
  72. ```
  73.  
  74. Generate an `isolinux.cfg` menu configuration file.
  75.  
  76. ```
  77. cat <<'EOF' >$HOME/live_boot/image/boot/isolinux/isolinux.cfg
  78. UI menu.c32
  79.  
  80. MENU TITLE ISOLINUX Boot Menu
  81. DEFAULT linux
  82. TIMEOUT 600
  83. LABEL linux
  84. MENU LABEL Some Linux Entry
  85. MENU DEFAULT
  86. KERNEL /live/vmlinuz
  87. APPEND initrd=/live/initrd boot=live quiet
  88. TEXT HELP
  89. Boot Linux
  90. ENDTEXT
  91. EOF
  92. ```
  93.  
  94. Generate the ISO file. Note the `-isohybrid-mbr` flag, which allows writing the ISO to USB with `dd`.
  95.  
  96. ```
  97. xorriso \
  98. -as mkisofs \
  99. -iso-level 3 \
  100. -full-iso9660-filenames \
  101. -volid "DEBIAN_CUSTOM" \
  102. -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
  103. -eltorito-boot \
  104. boot/isolinux/isolinux.bin \
  105. -no-emul-boot -boot-load-size 4 -boot-info-table \
  106. --eltorito-catalog boot/isolinux/isolinux.cat \
  107. -eltorito-alt-boot \
  108. -e EFI/efiboot.img \
  109. -no-emul-boot -isohybrid-gpt-basdat \
  110. -output "${HOME}/live_boot/debian-custom.iso" \
  111. "${HOME}/live_boot/image"
  112. ```
Add Comment
Please, Sign In to add comment