EFI support

Lars Karlslund <[email protected]> Wed, 15 May 2024 13:32:52 +0200
Newsgroups gmane.linux.leaf.devel
Message-ID <CAEYKQFtYgARqc-n=xjabVN2ZVnfH=2sdyAUQJ=2VJ+Li3+0sYw@mail.gmail.com>
Hello,

While BIOS/CSM is still supported on a lot of hardware, some vendors are
starting to ship UEFI only enabled firmware, which is problematic due to
some missing support not being baked into the linux kernels that ships with
LEAF.

I've been experimenting a bit with this, and have come up with a solution
that allows my USB-keys to support both BIOS and UEFI at the same time, by
creating an EFI-partition for GRUB2/EFI and also installing GRUB2/BIOS on
the primary FAT partition that contains all the regular files from LEAF.

The only thing that is missing is support for EFI framebuffer. This is
required if you want to have a physical monitor with text output - which I
really like both for diagnostics or in error conditions. As it is now the
existing kernel boots, but you get no output on the screen after the
bootloader.

With a custom compiled kernel everything works fine, so I was wondering if
I could persuade maintainers to add the missing .config entries to the
stock shipped kernels? They don't take up much space and should not
interfere with systems that are running under BIOS mode.

These are the entries that I used:

CONFIG_ACPI_BGRT=y
CONFIG_ACPI_PRMT=y
CONFIG_APERTURE_HELPERS=y
CONFIG_BOOT_VESA_SUPPORT=y
CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y
CONFIG_EFI_CUSTOM_SSDT_OVERLAYS=y
CONFIG_EFI_DXE_MEM_ATTRIBUTES=y
CONFIG_EFI_EARLYCON=y
CONFIG_EFI_ESRT=y
CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER=y
CONFIG_EFI_MIXED=y
CONFIG_EFI_RUNTIME_WRAPPERS=y
CONFIG_EFI_STUB=y
CONFIG_EFIVAR_FS=m
CONFIG_EFI_VARS_PSTORE=y
CONFIG_EFI=y
CONFIG_FB_CFB_COPYAREA=y
CONFIG_FB_CFB_FILLRECT=y
CONFIG_FB_CFB_IMAGEBLIT=y
CONFIG_FB_CMDLINE=y
CONFIG_FB_DEFERRED_IO=y
CONFIG_FB_EFI=y
CONFIG_FB_NOTIFY=y
CONFIG_FB_SYS_COPYAREA=y
CONFIG_FB_SYS_FILLRECT=y
CONFIG_FB_SYS_FOPS=y
CONFIG_FB_SYS_IMAGEBLIT=y
CONFIG_FB=y
CONFIG_FIRMWARE_EDID=y
CONFIG_FONT_8x16=y
CONFIG_FONT_8x8=y
CONFIG_FONT_SUPPORT=y
CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_INIT_STACK_NONE=y
CONFIG_SYSFB=y
CONFIG_XEN_EFI=y
CONFIG_XEN_FBDEV_FRONTEND=y

If there is interest, I can also share the script that I've made that
prepares new USB-keys for this - it partitions, formats, decompresses LEAF,
installs bootloader etc.

FYI my use of LEAF is for a customer that has been using it for more than
10 years, and have 40-50 office firewalls deployed. All configuration is
maintained in a central database, and complete firewalls are deployed
pre-configured with everything needed as tgz files for either new USB-keys
or online updates to existing systems.


Best regards,

Lars