diff --git a/uefi-usb-boot-stick/EFI/BOOT/.grub.cfg.swp b/uefi-usb-boot-stick/EFI/BOOT/.grub.cfg.swp new file mode 100644 index 0000000..4df5833 Binary files /dev/null and b/uefi-usb-boot-stick/EFI/BOOT/.grub.cfg.swp differ diff --git a/uefi-usb-boot-stick/EFI/BOOT/BOOTX64.EFI b/uefi-usb-boot-stick/EFI/BOOT/BOOTX64.EFI new file mode 100644 index 0000000..8d882b5 Binary files /dev/null and b/uefi-usb-boot-stick/EFI/BOOT/BOOTX64.EFI differ diff --git a/uefi-usb-boot-stick/EFI/BOOT/grub.cfg b/uefi-usb-boot-stick/EFI/BOOT/grub.cfg new file mode 100644 index 0000000..31f54ec --- /dev/null +++ b/uefi-usb-boot-stick/EFI/BOOT/grub.cfg @@ -0,0 +1,50 @@ +set default="1" + +function load_video { + insmod efi_gop + insmod efi_uga + insmod video_bochs + insmod video_cirrus + # + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + # + insmod all_video +} + +load_video +set gfxpayload=keep +insmod gzio +# +insmod increment +insmod xfs +insmod part_gpt +insmod fat +insmod blscfg +# +insmod part_gpt +insmod ext2 + +set timeout=-1 + +search --no-floppy --set=root -l 'RESCUE' + +menuentry 'Colibri' { + linuxefi /images/colibri/vmlinuz root=/dev/mapper/centos-root ro crashkernel=auto resume=/dev/mapper/centos-swap rd.lvm.lv=centos/root rd.luks.uuid=luks-0dd30579-2c04-422c-b6c6-3ab35d4c783f rd.lvm.lv=centos/swap rhgb quiet intel_iommu=on + initrdefi /images/colibri/initrd.img +} + +menuentry 'Rocky' { + linuxefi /images/rocky/vmlinuz root=/dev/mapper/centos-rockyroot ro crashkernel=auto resume=/dev/mapper/centos-swap rd.lvm.lv=centos/rockyroot rd.luks.uuid=luks-0dd30579-2c04-422c-b6c6-3ab35d4c783f rd.lvm.lv=centos/swap rhgb quiet intel_iommu=on + initrdefi /images/rocky/initrd.img +} + +menuentry 'buzzard' { + linuxefi /images/buzzard/vmlinuz root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.luks.uuid=luks-7a701398-14f8-428c-93c6-09e340beb118 rd.luks.options=discard rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8 nouveau.modeset=0 rd.driver.blacklist=nouveau + initrdefi /images/buzzard/initrd.img +} + + diff --git a/uefi-usb-boot-stick/EFI/BOOT/grub.cfg.orig b/uefi-usb-boot-stick/EFI/BOOT/grub.cfg.orig new file mode 100644 index 0000000..6b70a2d --- /dev/null +++ b/uefi-usb-boot-stick/EFI/BOOT/grub.cfg.orig @@ -0,0 +1,44 @@ +set default="1" + +function load_video { + insmod efi_gop + insmod efi_uga + insmod video_bochs + insmod video_cirrus + # + insmod ieee1275_fb + insmod vbe + insmod vga + insmod video_bochs + insmod video_cirrus + # + insmod all_video +} + +load_video +set gfxpayload=keep +insmod gzio +# +insmod increment +insmod xfs +insmod part_gpt +insmod fat +insmod blscfg +# +insmod part_gpt +insmod ext2 + +set timeout=-1 + +search --no-floppy --set=root -l 'RESCUE' + +menuentry 'Colibri' { + linuxefi /images/colibri/vmlinuz root=/dev/mapper/centos-root ro crashkernel=auto resume=/dev/mapper/centos-swap rd.lvm.lv=centos/root rd.luks.uuid=luks-0dd30579-2c04-422c-b6c6-3ab35d4c783f rd.lvm.lv=centos/swap rhgb quiet intel_iommu=on + initrdefi /images/colibri/initrd.img +} + +menuentry 'Rocky' { + linuxefi /images/rocky/vmlinuz root=/dev/mapper/centos-rockyroot ro crashkernel=auto resume=/dev/mapper/centos-swap rd.lvm.lv=centos/rockyroot rd.luks.uuid=luks-0dd30579-2c04-422c-b6c6-3ab35d4c783f rd.lvm.lv=centos/swap rhgb quiet intel_iommu=on + initrdefi /images/rocky/initrd.img +} + diff --git a/uefi-usb-boot-stick/EFI/BOOT/grubx64.efi b/uefi-usb-boot-stick/EFI/BOOT/grubx64.efi new file mode 100644 index 0000000..4d6376c Binary files /dev/null and b/uefi-usb-boot-stick/EFI/BOOT/grubx64.efi differ diff --git a/uefi-usb-boot-stick/createboot.md b/uefi-usb-boot-stick/createboot.md new file mode 100644 index 0000000..6437331 --- /dev/null +++ b/uefi-usb-boot-stick/createboot.md @@ -0,0 +1,68 @@ +# Creating a bootable USB UEFI stick + +## Identify the drive + +Insert your USB stick and tail /var/log/message to find out the device name. +Then set the device name in a variable + + +``` +DRIVE=/dev/sdc +``` + + +## Initial formatting of the USB stick + +This is a one-time operation. When updating the USB stick +this step can be skipped. + + +Formatting: +* gpt partition table +* primary partition of type ext2 +* primary partition of type EFI (EF) +* label /dev/sdc1 as RESCUE + +``` +parted ${DRIVE} +``` + +Create partitions in parted: +``` +mktable gpt +mkpart primary ext2 1 512MB +mkpart primary fat32 512MB 1024MB +set 2 boot on +``` + + +Format the partitions: +``` +mkfs.ext2 ${DRIVE}1 # this will contain the images. +mkfs.vfat ${DRIVE}2 # this will contain the UEFI bootloader and grub.cfg +e2label ${DRIVE}1 RESCUE +``` + +## Synchronize file to the USB stick + + +Sync images: +``` +mount ${DRIVE}1 /mnt/tmp +mkdir -p /mnt/tmp/images +rsync -av images/ /mnt/tmp/images/ +umount /mnt/tmp +``` + +Sync the grub configuration: +``` +mount ${DRIVE}2 /mnt/tmp +mkdir -p /mnt/tmp/EFI +rsync -av EFI/ /mnt/tmp/EFI/ +umount /mnt/tmp +``` + + + + + diff --git a/uefi-usb-boot-stick/images/README.md b/uefi-usb-boot-stick/images/README.md new file mode 100644 index 0000000..1bc67ed --- /dev/null +++ b/uefi-usb-boot-stick/images/README.md @@ -0,0 +1,3 @@ + +* initramdisks are dummies since they can be large and may be a security risk +* * * * * * * * kernel images are also dummies to reduce the size diff --git a/uefi-usb-boot-stick/images/buzzard/README.md b/uefi-usb-boot-stick/images/buzzard/README.md new file mode 100644 index 0000000..dcd56b7 --- /dev/null +++ b/uefi-usb-boot-stick/images/buzzard/README.md @@ -0,0 +1,4 @@ + +Symbolic links work too. This reduces maintenance since this allows you to use +initrd.img and vmlinuz as names in the grub.cfg, and only requires updating of +symlinks to move to another version. diff --git a/uefi-usb-boot-stick/images/buzzard/initramfs-3.10.0-1160.80.1.el7.x86_64.img b/uefi-usb-boot-stick/images/buzzard/initramfs-3.10.0-1160.80.1.el7.x86_64.img new file mode 100644 index 0000000..e69de29 diff --git a/uefi-usb-boot-stick/images/buzzard/initrd.img b/uefi-usb-boot-stick/images/buzzard/initrd.img new file mode 120000 index 0000000..7d79d06 --- /dev/null +++ b/uefi-usb-boot-stick/images/buzzard/initrd.img @@ -0,0 +1 @@ +initramfs-3.10.0-1160.80.1.el7.x86_64.img \ No newline at end of file diff --git a/uefi-usb-boot-stick/images/buzzard/vmlinuz b/uefi-usb-boot-stick/images/buzzard/vmlinuz new file mode 120000 index 0000000..6e36839 --- /dev/null +++ b/uefi-usb-boot-stick/images/buzzard/vmlinuz @@ -0,0 +1 @@ +vmlinuz-3.10.0-1160.80.1.el7.x86_64 \ No newline at end of file diff --git a/uefi-usb-boot-stick/images/buzzard/vmlinuz-3.10.0-1160.80.1.el7.x86_64 b/uefi-usb-boot-stick/images/buzzard/vmlinuz-3.10.0-1160.80.1.el7.x86_64 new file mode 100755 index 0000000..e69de29 diff --git a/uefi-usb-boot-stick/images/colibri/initrd.img b/uefi-usb-boot-stick/images/colibri/initrd.img new file mode 100644 index 0000000..e69de29 diff --git a/uefi-usb-boot-stick/images/colibri/vmlinuz b/uefi-usb-boot-stick/images/colibri/vmlinuz new file mode 100644 index 0000000..e69de29 diff --git a/uefi-usb-boot-stick/images/rocky/initrd.img b/uefi-usb-boot-stick/images/rocky/initrd.img new file mode 100644 index 0000000..e69de29 diff --git a/uefi-usb-boot-stick/images/rocky/vmlinuz b/uefi-usb-boot-stick/images/rocky/vmlinuz new file mode 100644 index 0000000..e69de29