Kaynağa Gözat

GRUB and Live ISO

Adding some Bash command references for installing GRUB with EFI and
cryptodisk as well as a reference for setting up a live Debian ISO.
master
Nate Bohman 5 yıl önce
ebeveyn
işleme
c768d69d38
2 değiştirilmiş dosya ile 79 ekleme ve 0 silme
  1. +71
    -0
      debootstrap_chroot_live.sh
  2. +8
    -0
      grub_efi_crypto_install.sh

+ 71
- 0
debootstrap_chroot_live.sh Dosyayı Görüntüle

@@ -0,0 +1,71 @@
#!/usr/bin/env bash

# Additional details from
# https://www.opengeeks.me/2015/04/build-your-hybrid-debian-distro-with-xorriso/
# https://wiki.archlinux.org/index.php/Chroot

# Install required packages
apt install debootstrap squashfs-tools syslinux isolinux syslinux-common xorriso

# Make a working dir and a chroot dir
mkdir -p livebuild/chroot

# Bootstrap Debian into chroot
cd livebuild
debootstrap --arch=amd64 testing chroot

# Mount filesystemd and chroot
mount -t proc /proc chroot/proc/
mount --rbind /sys chroot/sys/
mount --rbind /dev chroot/dev/
mount --rbind /run chroot/run/
chroot chroot /bin/bash

# Install and configure live system the way you like
echo "DebianLive" > /etc/hostname
echo -e '127.0.0.1\tlocalhost' > /etc/hosts
echo -e '127.0.1.1\tDebianLive' >> /etc/hosts
echo '' >> /etc/hosts
echo -e '::1\t\tlocalhost ip6-localhost ip6-loopback' >> /etc/hosts
echo -e 'ff02::1\t\tip6-allnodes' >> /etc/hosts
echo -e 'ff02::2\t\tip6-allrouters' >> /etc/hosts

apt install linux-image-amd64 linux-headers-amd64 firmware-* memtest86+ live-boot debian-installer-launcher debootstrap apt-file aria2 bash-completion ntfs-3g btrfs-progs btrfs-compsize btrfs-heatmap btrfsmaintenance build-essential ccache checkinstall chrony cifs-utils cmake command-not-found cryptsetup curl deb-multimedia-keyring dosfstools duperemove e2fsprogs ethtool fail2ban fuse git xfsprogs nano vim man less testdisk wireguard zfs-dkms grub-efi-amd64 grub-pc-bin haveged hwinfo iftop iotop iptables iputils-ping jq localepurge locales lsb-base lshw lz4 net-tools nfs-common network-manager* nodm openconnect pigz python python-pip python-dev python3 python3-pip python3-dev rsync screen smartmontools sudo sshpass strace tcpdump terminology tlp tp-smapi-dkms tshark ttf-mscorefonts-installer wget wireshark xz-utils zlib1g zstd zfs-initramfs

apt autoremove --purge
apt clean
apt autoclean

rm -rf /tmp/*

# Exit from chroot
exit

# Unmount chrooted environment
umount --recursive chroot

# Start building ISO
mkdir -p image/{live,isolinux}
cp chroot/boot/vmlinuz* image/live/vmlinuz
cp chroot/boot/initrd* image/live/initrd
cp chroot/boot/memtest86+.bin image/live/memtest86+.bin
cp chroot/boot/memtest86+_multiboot.bin image/live/memtest86+_multiboot.bin
cp /usr/lib/ISOLINUX/isolinux.bin image/isolinux/
cp /usr/lib/syslinux/modules/bios/* image/isolinux/

echo > image/isolinux/isolinux.cfg << EOF
UI menu.c32
prompt 0 menu title Debian Live
timeout 30
label Debian Live menu label ^Debian Live menu default kernel /live/vmlinuz append initrd=/live/initrd boot=live
label hdt menu label ^Hardware Detection Tool (HDT) kernel hdt.c32 text help HDT displays low-level information about the systems hardware. endtext
label Memtest86+ menu label ^Memory Failure Detection (memtest86+)
/live/memtest86+.bin
label Memtest86+ (multiboot) menu label ^Memory Failure Detection (memtest86+) /live/memtest86+_multiboot.bin
EOF

# Make squashfs
mksquashfs chroot/ image/live/filesystem.squashfs -e boot

# Create hybrid ISO
xorriso -as mkisofs -r -J -joliet-long -l -cache-inodes -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -partition_offset 16 -A "Debian Live" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o debianlive.iso image

+ 8
- 0
grub_efi_crypto_install.sh Dosyayı Görüntüle

@@ -0,0 +1,8 @@
grub-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot/efi --bootloader-id=grub
grub-mkconfig -o /boot/efi/grub/grub.cfg

efibootmgr --create --disk /dev/sda --part 5 --loader /EFI/grub_uefi/grubx64.efi --label "Debian" --verbose

# Some UEFI firmware requires that the bootable .efi stub have a specific name and be placed in a specific location: esp/EFI/boot/bootx64.efi (where esp is the UEFI partition mountpoint). Failure to do so in such instances will result in an unbootable installation. Fortunately, this will not cause any problems with other firmware that does not require this.
# mkdir /boot/efi/EFI/boot
# cp /boot/efi/EFI/grub/grubx64.efi /boot/efi/EFI/boot/bootx64.efi

Yükleniyor…
İptal
Kaydet