Create UEFI boot USB: Difference between revisions

From Alpine Linux
(fix config)
(Add category UEFI)
 
(22 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Note | These manual steps aren't required anymore, as the latest release images can just be written to an USB like normal and will support UEFI booting}}
This article explains how to create an UEFI boot USB with parted and gummiboot.
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.
In this example we will use {{Path|/dev/sdX}}. This will be different depending on your system.


== Create GPT boot partition ==
== Create GPT boot partition ==


Install 'parted'
Install {{Pkg|parted}}
{{Cmd | apk add parted }}
{{Cmd | apk add parted }}


Create a single UEFI boot partitions.
Create a single UEFI boot partitions.
{{warning| this will erase all content of your `/dev/sdX`. Make sure that you use correct device}}
{{warning| This will erase all content of your {{Path|/dev/sdX}}. Make sure that you use correct device.}}


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


== Create fat32 filesystem ==
== Create fat32 filesystem ==
Line 19: Line 21:
Create a fat32 system with the name `Alpine`.
Create a fat32 system with the name `Alpine`.


{{Cmd | mkfs.vfat -n Alpine /dev/sdX1 }}
{{Cmd | mkfs.vfat -n ALPINE /dev/sdX1 }}
 


== Copy content of ISO image to filesystem ==
== 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.
It is possible to mount the iso image and copy files with {{codeline|cp}} or {{codeline|rsync}} and it is also possible to use {{codeline|7z}} to extract content from the iso. In this example I will use the {{codeline|uniso}} utility from {{Pkg|alpine-conf}} package.
 
{{Cmd | mount -t vfat /dev/sdX1 /mnt }}
{{Cmd | cd /mnt && uniso < /path/to/alpine-3.4.0-x86_64.iso }}
 
== Copy gummiboot efi binary ==
 
UEFI will look for a EFI/bootx64.efi as a fallback efi loader. We copy gummibootx64.efi to this location.
 
{{Cmd | mkdir -p /mnt/EFI/Boot }}
{{Cmd | apk add gummiboot }}
{{Cmd | 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 EFI/loader/entries }}


{{Cat | EFI/loader/loader.conf |default grsec
{{Cmd | mount -t vfat /dev/sdX1 /mnt
timeout 4
cd /mnt
}}
uniso < /path/to/alpine-3.8.2-x86_64.iso }}


The options are taken from {{Path|boot/syslinux/syslinux.cfg}}
== Unmount the partition ==
Finally umount the disk
{{Cmd | cd ~ && umount /mnt}}


{{Cat | EFI/loader/entries/grsec.conf |title    Alpine Linux
[[Category:Installation]] [[Category:UEFI]]
linux    /boot/vmlinuz-grsec
initrd  /boot/initramfs-grsec
options  modloop{{=}}/boot/modloop-grsec modules{{=}}loop,squashfs,sd-mod,usb-storage quiet
}}

Latest revision as of 10:09, 7 November 2023

Note: These manual steps aren't required anymore, as the latest release images can just be written to an USB like normal and will support UEFI booting

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.8.2-x86_64.iso

Unmount the partition

Finally umount the disk

cd ~ && umount /mnt