Create UEFI boot USB: Difference between revisions

From Alpine Linux
(Update instructions for modern Alpine images which already include grub-efi)
No edit summary
Line 26: Line 26:


{{Cmd | mount -t vfat /dev/sdX1 /mnt
{{Cmd | mount -t vfat /dev/sdX1 /mnt
  cd /mnt
  cd /mnt && uniso < /path/to/alpine-3.4.0-x86_64.iso }}
uniso < /path/to/alpine-3.4.0-x86_64.iso }}
 
== Copy gummiboot efi binary ==
 
{{note| Gummiboot has been forked in Alpine Linux since it has been [https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/ consumed by systemd upstream].}}
 
UEFI will look for a {{Path|EFI/bootx64.efi}} as a fallback efi loader. We copy {{Path|gummibootx64.efi}} to this location.
 
{{Cmd | mkdir -p /mnt/EFI/Boot
apk add gummiboot
cp /usr/lib/gummiboot/gummibootx64.efi /mnt/EFI/Boot/bootx64.efi }}
 
== Create configuration files for boot loader ==
 
We need create some configuration files for gummiboot.
{{Cmd | mkdir -p loader/entries }}
 
{{Cat | loader/loader.conf |default alpine
timeout 4
}}
 
The options are taken from {{Path|boot/syslinux/syslinux.cfg}}
 
{{Cat | loader/entries/alpine.conf |title    Alpine Linux
linux    /boot/vmlinuz-hardened
initrd  /boot/initramfs-hardened
options  modloop{{=}}/boot/modloop-hardened modules{{=}}loop,squashfs,sd-mod,usb-storage quiet
}}


== Unmount the partition ==
Finally umount the disk
Finally umount the disk
{{Cmd | cd ~ && umount /mnt}}
{{Cmd | cd ~ && umount /mnt}}


[[Category:Installation]]
[[Category:Installation]]

Revision as of 13:35, 30 December 2018

This article explains how to create an UEFI boot USB with parted and gummiboot.

In this example we will use /dev/sdX. This will be different depending on your system.

Create GPT boot partition

Install parted

apk add parted

Create a single UEFI boot partitions.

Warning: This will erase all content of your /dev/sdX. Make sure that you use correct device.


parted --script /dev/sdX mklabel gpt parted --script --align=optimal /dev/sdX mkpart ESP fat32 1MiB 100% parted --script /dev/sdX set 1 boot on

Create fat32 filesystem

Create a fat32 system with the name `Alpine`.

mkfs.vfat -n ALPINE /dev/sdX1

Copy content of ISO image to filesystem

It is possible to mount the iso image and copy files with cp or rsync and it is also possible to use 7z to extract content from the iso. In this example I will use the uniso utility from alpine-conf package.

mount -t vfat /dev/sdX1 /mnt cd /mnt && uniso < /path/to/alpine-3.4.0-x86_64.iso

Copy gummiboot efi binary

Note: Gummiboot has been forked in Alpine Linux since it has been consumed by systemd upstream.

UEFI will look for a EFI/bootx64.efi as a fallback efi loader. We copy gummibootx64.efi to this location.

mkdir -p /mnt/EFI/Boot apk add gummiboot cp /usr/lib/gummiboot/gummibootx64.efi /mnt/EFI/Boot/bootx64.efi

Create configuration files for boot loader

We need create some configuration files for gummiboot.

mkdir -p loader/entries

Contents of loader/loader.conf

default alpine timeout 4

The options are taken from boot/syslinux/syslinux.cfg

Contents of loader/entries/alpine.conf

title Alpine Linux linux /boot/vmlinuz-hardened initrd /boot/initramfs-hardened options modloop=/boot/modloop-hardened modules=loop,squashfs,sd-mod,usb-storage quiet

Finally umount the disk

cd ~ && umount /mnt