setup-disk: Honor BOOT_SIZE environment variable for EFI install
In setup-disk
, native_disk_install() and native_disk_install_lvm() will look at the environment variable BOOT_SIZE and use it to specify how much space to give to the boot partition. If BOOT_SIZE is not specified, there is a default. Like so:
local boot_size=${BOOT_SIZE:-100}
However, with EFI it's a fixed value with no option to override the size.
BOOT_SIZE=512
I don't think 512M is a magic number. After researching the minimum size for EFI, I have seen anything from 32M to 550M being quoted as the proper size. Personally, I've used 100M EFI partitions on Virtualbox and Intel NUC with no problems.
Some discussion on the topic: https://superuser.com/questions/1310927/what-is-the-absolute-minimum-size-a-uefi-system-partition-can-be#1310938
It would be nice if export BOOT_SIZE=XXX ; setup-alpine
could be made to work for EFI installs the same way it does for non-EFI.
The quickest fix seems to be the change shown below.
--- setup-disk.orig
+++ setup-disk
@@ -1435,7 +1435,7 @@
if is_efi || [ -n "$USE_EFI" ]; then
USE_EFI=1
DISKLABEL=gpt
- BOOT_SIZE=512
+ BOOT_SIZE=${BOOT_SIZE:-512}
BOOTFS=vfat
: ${BOOTLOADER:=grub}
fi
I've tested it on a Virtualbox install (with EFI enabled) using export BOOT_SIZE=100 ; setup-alpine
and it works as expected.
Alternatively, if one does not buy into the EFI must be 512M line of reasoning, BOOT_SIZE=512 can be removed from setup-disk and everything will work just fine.