complete installations. Please refer to [UEFI_and_BIOS section of this page](#UEFI_and_BIOS_definitions_and_introduction)
first.
Started in [Alpine 3.15 is able to setup UEFI and Secure Boot](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.15.0#UEFI_Secure_Boot)
only with grub install flavor, syslinux can able to install UEFI but only with few devices.
Some users need to setup non grub to work.
**[EFI System Partition](https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#EFI_system_partition)
are not the complete overall of the [UEFI](https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface),
it's just the need minimal infrastructure to property boot by and [UEFI modern machine](https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#Implementation_and_adoption)..**
> **Warning** check at the [UEFI mandatory partition mechanics](#uefi-mandatory-partition-mechanics) section of this document.
## Minimum Alpine partition scheme
Alpine Linux requires a root partition, but on UEFI systems an EFI, a
"System Partition" is also required. So a minimun of 3 partitions will be required.
The **EFI System Partition** will be the `/boot` one, it must contain a bootloader
program in. The current status of that mechanics to boot **in Alpine Linux are still
in development and has good basic support**. See [UEFI mandatory partition mechanics](#uefi-mandatory-partition-mechanics)
and [UEFI/GPT minimal layout](#uefi-gpt-minimal-layout) for details.
## Notes about the boot flags and boot partition
**UEFI booting does not involve any "boot" flag, that's it's a need only
for BIOS booting**. The UEFI booting relies solely on the boot entries in
NVRAM. Parted and its front-ends use a "boot" flag on GPT to indicate
that a partition is an "EFI system partition".
**A BIOS "boot partition for EFI" is only required when using GRUB for BIOS
booting from a GPT disk**. The partition has nothing to do and it must not be
formatted with a file system or mounted.
## Alpine disk layout for UEFI
You will need a disk layout that your system firmware is capable of
booting, you **will need a boot partition and a root partition**. Other
architectures may have different requirements and not all are supported,
please read next sections for details.
If you don't already know what filesystem format you want your boot
partition, choose **ext2**. The **root partition, and any additional
partitions or LVM volume groups, may be in any format that the kernel is
capable of reading**.
#### UEFI/GPT minimal layout
| Mount point | Partition | Partition type Purpose | Recommended minimum size | Formats |
Therefore, it is impossible to use any drive space beyond 2 TiB using
MBR layout. So if you're booting from it and use BIOS, you MUST use
MBR - and you simply can't use any space beyond that if your boot drive
is 2TB or bigger.
Modern motherboards (since approximately 2011 onwards) are using UEFI
natively, but most can emulate BIOS through the CSM (Compatibility
Support Module) to maintain support for BIOS-style booting.
# UEFI boot process explained
Well, let's start with installers. It'll read a UDF or FAT32-formatted
USB drive or DVD, and look for the file /efi/boot/bootx64.efi and run
it. An app, written in the UEFI "OS". It can be anything! Here's classic
text adventure Zork, as a UEFI app.
It's possible to make boot media which is valid for both UEFI and BIOS.
Unfortunately, in a slightly user-unfriendly twist, you (the user) need
to pick the right boot entry. For example, on the wife's PC, a USB stick
gets listed as both "UEFI: Sandisk Cruzer Edge" and "USB: Sandisk Cruzer
Edge". Just... make sure you pick the right entry. It's impossible to
change mode after this point.
It uses a different partitioning system called GPT instead of MBR, and
secondly it creates an extra \~100 meg partition called the "EFI System
Partition" - a FAT32 partition where the boot loader apps get installed
to (no more boot sectors).
Each OS will stick its boot loader somewhere in the ESP, then send a
signal to the firmware to write this new loader's location into the
CMOS. Each entry installed in this manner will get its own listing in
your "boot devices" list on the firmware - so if you installed MACOSX,
you'll have "MACOSX Boot Manager" as an entry next to your DVD drive and
hard drive after you reboot. This is why you don't do the old "unplug
drive A when installing a different OS to drive B" thing, or swap
cables, or anything like that. You should only have one ESP, the one on
drive A.
## UEFI mandatory partition mechanics
Regular UEFI boot has several lists of possible boot entries, stored in
UEFI config variables (normally in NVRAM), and boot order config
variables stored alongside them. Unfortunately, a lot of PC UEFI
implementations have got this wrong and so don't work properly.
The correct way for this to work when booting off local disk is for a
boot variable to point to a vendor-specific bootloader program in
`\EFI\$bootloader.efi` on the EFI System Partition (ESP), a specially
tagged partition (Some OS's formatted as Fat32.. that's are unnecessary
due it's just to able to poor OS's to boot like M$ Redmond OS's). The
current status of that mechanics to boot in Alpine Linux are still in
development and only basic support to existing made are provided.
## What's this infamous "Secure Boot"?
It's a way for your motherboard to prevent tampering of your OS (seems
stupidity of boot-sector viruses??? please!). The UEFI/BIOS provide a
list of certificates to trust that signed the OS kernels, then the firmware
enforces that everything involved with the boot process (not just the boot
loader, but the OS kernel itself, and all your device firmware like your
GPU BIOS) are signed with a trusted key.
It works using cryptographic checksums and signatures. It **stops your
system from booting unsigned code**. You can sign your own, and trust
the certificate you used to do that signing. Or you can get the boot
code signed by Microsoft - every motherboard has a small list of
pre-trusted certificates which almost (always) includes Microsoft's
certificates, which they currently let anyone use for a small fee.
Most of the programs that are expected to run in the UEFI environment
are boot loaders, but others exist too. There are also programs to deal
with firmware updates before operating system startup (like fwupdate and
fwupd), and other utilities may live here too.
Support **for [secure boot are since Alpine 3.15](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.15.0#UEFI_Secure_Boot)
realized by package `secureboot-hook` and `efi-mkkeys`, this means
that you must load a own signed kernel and put a own certificate** to the UEFI/BIOS.
Due the "Unsigned code curse", Alpine linux [EFI System Partition](https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#EFI_system_partition)
**are not the complete overall of the [UEFI](https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface),
it's just the need minimal infrastructure to property boot** it!
## How to boot unsigned code?
**Alpine users have to first disable Secure Boot to be able to install
Alpine Linux, cos since supported, it not handle their own certificate**
and the methods for doing this vary massively from one system to another,
making this potentially quite difficult for users.
This is due to Microsoft's actions as a Certification Authority (CA) for
Secure Boot. They sign programs/bootloaders on behalf of other trusted
organizations so that their programs will run, but at great cost.. and
there's nothing related to free software but affects to.. There's no
Alpine Linux Certification like are with other enterprise related Linux.
Support **for [secure boot are since Alpine 3.15](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.15.0#UEFI_Secure_Boot)
realized by package `secureboot-hook` and `efi-mkkeys`, this means
that you must load a own signed kernel and put a own certificate** to
the UEFI/BIOS and **not a real direct boot from fresh UEFI/BIOS list.**.
# Overall notes and conclusions
Currently Alpine UEFI and Secure Boot are very basic and enought to work,
but are just implementations and **not official UEFI listed so Secure Boot must be
disabled at first install**.
BIOS computers or **UEFI computers with Compatibility Support BIOS are
the easiest and most reliable way to install**, they do not need the
new EFI partition to boot nor new special files.
## Licensing clarifications
This document were started at oficial Alpine wiki, but was over 22:22, 18 August 2019,
so the wiki licence was pretty simple "are owned by creator" so cannot be redistribute
without the following license:
**CC BY-NC-SA**: the project allows reusers to distribute, remix, adapt, and build upon the material
in any medium or format for noncommercial purposes only, and only so long as attribution is given
to the creators involved. If you remix, adapt, or build upon the material, you must license the modified
material under identical terms, includes the following elements:
* **BY** – Credit must be given to the creator of each content respectivelly, starting at the first contributor.
* **NC** – Only noncommercial uses of the work are permitted, with exceptions if you fill an issue here!
* **SA** – Adaptations must be shared under the same terms, you must obey this terms and do not change it.