pmaports/main
Clayton Craft 72bd769dcb
main/systemd-boot: new aport (MR 4484)
EFI bootloader from systemd, with hacks to build it on Alpine/pmOS.
Cross compilation (using a meson cross file) is used for building
32-bit version on x86_64, for systems that have a 32-bit EFI. Everything
else assumes that the EFI arch matches the CPU arch.

Besides supporting all the archs we need, another major goal was to
minimize the number of changes to systemd's build system required to
build only the bootloader, so that maintaining/rebasing isn't *too*
painful...

I am adding this to the "main" category, because I don't think there's a
way to add it to Alpine. It requires cross compiling to x86 on x86_64
(to support 32-bit EFI on this arch), and Alpine doesn't support this.
It requires stuff in pmaports/cross.

--- Research notes ---

I started looking at all of this because I wanted to come up with a
single way to boot Linux via EFI, that supports all (or as many as possible)
devices in pmaports. I looked at quite a few different options, and have
some notes below about my observations and conclusions for each.

Of everything I looked at, systemd-boot was the clear winner that met
the most requirements ("pro" below) with the fewest downsides ("con"
below).

Using a Unified Kernel Image (UKI) was a close second place, however
systemd-boot can also support booting UKI images quite easily (while
also giving us more flexibility to boot other things easily too), so I
think it wins over UKI.

The capitalization (or lack thereof) of the "pro" and "con" markers
below is significant: "PRO" / "CON" are major pros or cons for each
point (e.g. a major downside that blocks using the option), and
"pro"/"con" are minor (e.g. a downside that I'm willing to overlook.)

---- Requirements ----

- Arch support:
        - x86_64
        - x86 (nice to have, but not sure if necessary...)
        - armv7
        - aarch64
        - riscv64
- EFI support:
        - support 32-bit EFI on x86_64 CPU (includes being able to build
          32-bit .efi app on x86_64)
- Easy to configure
- Easy to maintain
        - Any changes to the bootloader required to get it working in
          pmOS
        - Config for it

---- Evaluated options ----

------ grub ------
   - (PRO) can target all required archs
   - (CON) grub can't be installed in pmb chroot, it calls grub-install and
     that fails due to something missing in /dev. Maybe this could be worked
     around in pmb?
   - (CON) grub-mkimage exe is integrated in grub package, grub-efi depends on
     grub
      - don't want to install all of grub just for 1 exe and/or the EFI modules
      - downsides of installing all of grub is that I think it can mislead
        users into thinking we use grub the "normal way". this might cause them
        to have the wrong expectations and break pmOS boot on their
        system
      - have POC "fixing" this
      - I'm not sure upstream Alpine will like this, it's ugly
   - (CON) grub x86 EFI support for x86_64 is currently in pmaports, that's
     pretty ugly.
      - IMHO forking grub (or grub components) for this purpose signals
        to me that grub is the wrong tool for this job

------- kernel's efistub -------
   - (PRO) already included in the kernel, nothing else required
   - (pro) initrd and dtb can be passed in the kernel cmdline...
     however....
   - (CON) kernel cmdline can only be set at compile time
   - (con) not all kernels may have EFISTUB set?
   - (con) can't do measured/secure boot
   - (con) requires a fairly recent kernel on aarch w/ efi_zboot support
     enabled since we compress the kernel

------- UKI -------
   - (PRO) very simple, 1 file thing
   - (PRO) supports adding dtb, setting kernel cmdline and so on
   - (pro) can do measured/secure boot
   - (CON) requires an EFI stub loader
      - can't find a stub loader that meets all requirements (other than
        the one from systemd-boot...)
   - (con) requires efi-mkuki or dealing with objcopy directly (eww)
   - (con) requires a fairly recent kernel on aarch w/ efi_zboot support

------- limine -------
   - (PRO) easy to install/configure, already have boot-deploy and pmaports
     patches
   - (PRO) can be cross compiled easily
      - evidence is in aports
      - ...but I couldn't reproduce building aarch64 and riscv64 on x86_64
   - (pro) can do measured/secure boot (I think?)
   - (CON) doesn't target all required archs
      - can't do "linux boot" on aarch64, only "chainload"
      - what about using chainload everywhere?
         - requires using efistub in kernel
         - what about dtb= and upstream recommendation to not use it except for
           debug?
         - no kernel compression support on aarch64
         - see efi-stub.txt kernel doc
   - (CON) vendors libgcc to support cross compilation
      - probably not a good idea to trust binaries produced in microsoft
        github's CI for some random project

------- stubbyboot -------
   - (PRO) a straight forward stub loader
   - (pro) can do measured/secure boot
   - (CON) doesn't target all required archs
   - (CON) cross compiling doesn't work.
      - gcc can't do 32-bit on x86_64 Alpine...
      - gnu-efi-dev needs to be fixed to package both 32-bit and 64-bit on x86_64...
         - have patch in ~/src/aports that kinda does it.. but needs to be
           fixed/finished
      - maybe limine-efi works with it?
         - tried, but fails due to missing efilib.h in limine-efi

------- systemd-stub -------
   - (PRO) another straight forward stub loader
   - (PRO) many (many) people using it, as part of systemd-boot
   - (pro) can do measured/secure boot
   - (con) requires a fairly recent kernel on aarch w/ efi_zboot support
     enabled since we compress the kernel
   - (con) doesn't target all required archs
      - but does claim to support most... missing armv7.. maybe it
        works?
   - (con) will end up maintaining some downstream patch to build it
      - hopefully the patch (if I can even make a working one!) is not too
        complex!
   - (CON) can't be built outside of systemd's silly large build system.
      - UPDATE: largely resolved this in pmaports
      - was able to build for native arch!
      - can't build 32-bit on x86_64, no gcc multilib support in Alpine...
        Couldn't get clang to work properly, but maybe it can somehow...
      - https://github.com/mintsuki/libgcc-binaries ? NO! (don't want
        bootloader binaries that depend on code compiled by microsoft /
        github...)

------- DIY stub / bootloader -----
   - (PRO) **might** target all required archs and other meet
     requirements
   - (CON) lots of time required to learn, design, do, debug, test
   - (CON) lots of time required to learn, design, do, debug, test
   - (CON) lots of time required to learn, design, do, debug, test
   - (CON) (get the hint yet???)
   - (CON) written in C, probably (there's a rust EFI lib, lol...)

[ci:skip-build]: Already built successfully in CI
2023-10-16 12:16:41 +02:00
..
0xffff
abootimg
abuild-sign-noinclude
adsp-audio
asus-transformer-blobtools
boot-deploy boot-deploy: upgrade to 0.10.2 (MR 4358) 2023-08-29 22:14:17 +01:00
bootchart2 main/*: rebuild for Python 3.11 (MR 3745) 2022-12-18 10:26:36 +01:00
bootmac main/bootmac: update to 0.2.1 and add bluez-btmgmt dependency (MR 4416) 2023-09-27 07:58:21 +02:00
columbiad
crust main/crust: fix build with GCC 12 (MR 3676) 2022-11-28 23:59:34 +01:00
devicepkg-dev main/devicepkg-dev: install deviceinfo under /usr/share/deviceinfo (MR 4283) 2023-09-25 09:20:32 +02:00
devicepkg-utils main/devicepkg-utils: install default /etc/deviceinfo (MR 4283) 2023-09-25 09:20:32 +02:00
dtbtool main/dtbtool: switch to repository mirror (MR 4111) 2023-05-24 17:19:05 +02:00
dtbtool-exynos
dtbtool-sprd
extract-dtb main/extract-dtb: update pkgrel due to updated python version (MR 3867) 2023-02-15 08:20:28 +01:00
fbdebug
fbkeyboard
gcc4 main/gcc4: disable on riscv64 (MR 3583) 2022-10-25 08:31:09 +02:00
gcc6 main/gcc6: disable on riscv64 (MR 3583) 2022-10-25 08:31:21 +02:00
gesture
hello-world
hello-world-rust main/hello-world-rust: several tweaks (MR 4310) 2023-09-05 08:45:16 +02:00
hello-world-wrapper
hisi-wlan
hwtest main/*: rebuild for Python 3.11 (MR 3745) 2022-12-18 10:26:36 +01:00
keepfileopen
ldpath
librem5-agps librem5-agps: Add GUI support (MR 3968) 2023-03-23 08:03:30 +01:00
lk2nd main/lk2nd: add subpackage for quirky htc-memul (MR 4244) 2023-09-29 13:55:32 -07:00
lk2nd-msm8953 main/lk2nd-msm8953: upgrade to 0.3.5 (MR 4352) 2023-08-28 16:22:13 +02:00
make-dynpart-mappings make-dynpart-mappings: support new mkintifs paths (MR 3895) 2023-03-08 21:30:28 -08:00
mdss-fb-init-hack
mipi-dbi-cmd
mkbootimg-osm0sis main/mkbootimg-osm0sis: upgrade to 2021.08.06 (MR 3597) 2022-11-02 15:02:48 +01:00
mobile-config-firefox main/mobile-config-firefox: upgrade to 4.2.0 (MR 4403) 2023-09-18 21:19:36 +02:00
msm-fb-refresher main/msm-fb-refresher: support new mkintifs paths (MR 3895) 2023-03-08 21:30:28 -08:00
msm-firmware-loader main/msm-firmware-loader: upgrade to 1.3.0 (MR 4448) 2023-10-04 20:49:05 +02:00
mtk-mkimage
ofonoctl main/*: rebuild for Python 3.11 (MR 3745) 2022-12-18 10:26:36 +01:00
osk-sdl postmarketos-fde-unlocker: make unl0kr the default (MR 3279) 2023-10-03 21:07:35 +02:00
pbsplash main/pbsplash: upgrade to 0.3.1 (MR 3930) 2023-03-18 23:45:32 +00:00
postmarketos-android-recovery-installer main/postmarketos-android-recovery-installer: upgrade to 1.0.7 (MR 3646) 2022-11-18 08:03:08 +01:00
postmarketos-artwork main/postmarketos-artwork: add gnome wallpapers (MR 4156) 2023-06-06 17:50:04 +02:00
postmarketos-base main/postmarketos-base: adapt to new deviceinfo path (MR 4283) 2023-09-25 09:20:32 +02:00
postmarketos-base-eink postmarketos-base-eink: add gnome subpackage (MR 4142) 2023-07-05 22:13:31 +02:00
postmarketos-base-ui postmarketos-base-ui: kill/restart unudhcpd unconditionally (MR 4354) 2023-08-28 22:50:26 +02:00
postmarketos-base-ui-gnome main/postmarketos-base-ui-gnome: update wallaper (MR 4156) 2023-06-06 17:50:10 +02:00
postmarketos-boot-hwtest
postmarketos-bootsplash main/postmarketos-bootsplash: use source_deviceinfo (MR 4129) 2023-06-03 17:44:25 +02:00
postmarketos-config-nftables main/postmarketos-config-nftables: allow Wi-Fi Display traffic (MR 4391) 2023-09-14 20:40:33 +02:00
postmarketos-cros-common main/postmarketos-cros-common: new aport (MR 4295) 2023-08-01 13:52:44 +03:00
postmarketos-demos
postmarketos-initramfs main/postmarketos-initramfs: add new deviceinfo path to initramfs (MR 4283) 2023-09-25 09:20:32 +02:00
postmarketos-installkernel
postmarketos-keys
postmarketos-mkinitfs main/postmarketos-mkinitfs: fix trigger script (MR 4422) 2023-09-26 08:31:00 +02:00
postmarketos-mkinitfs-hook-apx main/postmarketos-mkinitfs-hook-apx: enable aarch64 (MR 4319) 2023-08-10 01:16:32 +03:00
postmarketos-mkinitfs-hook-console-shell main/postmarketos-mkinitfs-hook-console-shell: use source_deviceinfo from devicepkg-utils (MR 4129) 2023-06-03 17:44:25 +02:00
postmarketos-mkinitfs-hook-debug-shell main/postmarketos-mkinitfs-hook-debug-shell: fixes (MR 4204) 2023-09-08 17:15:05 +02:00
postmarketos-mkinitfs-hook-kernel-panic postmarketos-mkintifs-hook-kernel-panic: support new mkintifs paths (MR 3895) 2023-03-08 21:30:29 -08:00
postmarketos-mkinitfs-hook-maximum-attention postmarketos-mkinitfs-hook-maximum-attention: support new mkintifs paths (MR 3895) 2023-03-08 21:30:29 -08:00
postmarketos-mkinitfs-hook-netboot main/postmarketos-mkinitfs-hook-netboot: use custom IP address if available (MR 4350) 2023-08-27 19:19:28 +02:00
postmarketos-mkinitfs-hook-verbose-initfs postmarketos-mkinitfs-hook-verbose-initfs: support new mkintifs paths (MR 3895) 2023-03-08 21:30:30 -08:00
postmarketos-mvcfg
postmarketos-ondev main/postmarketos-ondev: upgrade to 0.8.2 (MR 4455) 2023-10-09 06:42:04 +02:00
postmarketos-release-upgrade main/postmarketos-release-upgrade: upgrade to 1.4.0 (MR 4163) 2023-06-07 11:49:35 +02:00
postmarketos-theme
postmarketos-tweaks main/postmarketos-tweaks: upgrade to 0.13.1 (MR 4100) 2023-05-19 16:07:31 +02:00
postmarketos-ui-asteroid main/postmarketos-ui-asteroid: launch mapplauncherd booster (MR 4063) 2023-05-10 11:54:20 +02:00
postmarketos-ui-bananui main/postmarketos-ui-bananui: new aport (MR 4457) 2023-10-09 18:19:59 +02:00
postmarketos-ui-console main/postmarketos-base-ui: networkmanager: depends on networkmanager{,-*} (MR 3749) 2023-01-06 21:53:28 +01:00
postmarketos-ui-fbkeyboard main/postmarketos-base-ui: networkmanager: depends on networkmanager{,-*} (MR 3749) 2023-01-06 21:53:28 +01:00
postmarketos-ui-framebufferphone main/postmarketos-ui-framebufferphone: take over maintainership (MR 4365) 2023-09-04 17:28:28 +02:00
postmarketos-ui-gnome main/postmarketos-ui-gnome: remove dep on wallpapers (MR 4156) 2023-06-06 17:50:10 +02:00
postmarketos-ui-gnome-mobile main/postmarketos-ui-gnome-mobile: Replace EoG with Loupe (MR 4342) 2023-08-24 09:52:16 +02:00
postmarketos-ui-i3wm ui-i3wm: Depend on wallpaper and polkit (MR 4179) 2023-06-15 22:28:17 +02:00
postmarketos-ui-kodi main/postmarketos-ui-kodi: enable shutdown/reboot/suspend options (MR 4065) 2023-05-09 10:01:32 -07:00
postmarketos-ui-lxqt main/postmarketos-ui-{lxqt,xfce4}: drop postmarketos-artwork-icons in $_pmb_recommends (MR 4364) 2023-09-01 12:40:05 +02:00
postmarketos-ui-mate main/postmarketos-ui-mate: add elogind-openrc to depends, enable service (MR 4020) 2023-05-03 15:56:56 +02:00
postmarketos-ui-phosh main/postmarketos-ui-phosh: Rebuild following url and pkgdesc update (MR 4385) 2023-09-08 17:33:17 +02:00
postmarketos-ui-plasma-bigscreen main/postmarketos-ui-plasma-bigscreen: follow breeze-icons rename (MR 4462) 2023-10-08 18:16:47 +02:00
postmarketos-ui-plasma-desktop main/postmarketos-base-ui: networkmanager: depends on networkmanager{,-*} (MR 3749) 2023-01-06 21:53:28 +01:00
postmarketos-ui-plasma-mobile main/postmarketos-ui-plasma-mobile: add plasma-welcome to _pmb_recommends (MR 4361) 2023-08-31 09:42:26 +02:00
postmarketos-ui-shelli main/postmarketos-base-ui: networkmanager: depends on networkmanager{,-*} (MR 3749) 2023-01-06 21:53:28 +01:00
postmarketos-ui-sway main/postmarketos-ui-sway: add elogind-openrc to depends, enable service (MR 4020) 2023-05-03 15:56:56 +02:00
postmarketos-ui-sxmo-de-dwm main/postmarketos-ui-sxmo-de-dwm: depends on sxmo-common (MR 4259) 2023-07-21 14:14:25 -07:00
postmarketos-ui-sxmo-de-sway main/postmarketos-ui-sxmo-de-sway: seatd dep moved to sxmo-utils-sway (MR 4271) 2023-07-22 10:18:28 -07:00
postmarketos-ui-weston main/postmarketos-ui-weston: add elogind-openrc to depends, enable service (MR 4020) 2023-05-03 15:56:56 +02:00
postmarketos-ui-xfce4 main/postmarketos-ui-{lxqt,xfce4}: drop postmarketos-artwork-icons in $_pmb_recommends (MR 4364) 2023-09-01 12:40:05 +02:00
postmarketos-update-depthcharge-kernel main/postmarketos-update-depthcharge-kernel: use source_deviceinfo (MR 4129) 2023-06-03 17:44:25 +02:00
postmarketos-update-kernel main/postmarketos-update-kernel: use source_deviceinfo (MR 4129) 2023-06-03 17:44:25 +02:00
postmarketos-welcome main/postmarketos-welcome: upgrade to 0.8.0 (MR 3997) 2023-04-06 16:39:35 -07:00
pxa-mkbootimg
qca-swiss-army-knife
qmi-ping
reboot-mode
shelli
shutdown-clear-rtc-wakealarm main/shutdown-clear-rtc-wakealarm: new aport (MR 3905) 2023-02-28 14:45:04 -08:00
sm-sparse-image-tool
swclock-offset main/swclock-offset: upgrade to 0.2.2 (MR 3714) 2022-12-13 21:31:17 -08:00
systemd-boot main/systemd-boot: new aport (MR 4484) 2023-10-16 12:16:41 +02:00
tizen-mkdzimage
ttyescape
u-boot-q8-a33-tablet inet-a33: new device (MR 4166) 2023-06-11 13:15:34 +02:00
unixbench main/unixbench: disable on riscv64 (MR 3588) 2022-10-26 09:24:38 +02:00
unl0kr main/unl0kr: upgrade to 2.0.2 (MR 4458) 2023-10-09 06:25:47 +02:00
watchdog-kick
wcnss-wlan
wl1251-cal