[PATCH] x86_64: add systemd-boot images
Jonas Lochmann
openwrt at jonaslochmann.de
Tue Dec 30 10:51:22 PST 2025
Am Tue, Dec 30, 2025 at 06:30:43PM +0100, schrieb Stefan Hellermann:
> I tested this with a small x86/64 config in libvirt / Virt Manager on
> Fedora. It boots up fine in a virtual machine with UEFI enabled and secure
> boot disabled.
>
> Systemd-boot is smaller than grub, sizes:
> openwrt-x86-64-generic-squashfs-rootfs.img.gz with grub2-efi: 4371163
> openwrt-x86-64-generic-squashfs-rootfs.img.gz with systemd-boot: 4124862
> (-5.6%, -240.5kB)
> openwrt-x86-64-generic-squashfs-combined-efi.img.gz: 10761442
> openwrt-x86-64-generic-squashfs-systemd-boot.img.gz: 9964810 (-7.4%, -778kB)
>
> => Nice! But probably doesn't matter on x86 :-)
I know.
> But: sysupgrade the virtual machine to the same image fails:
>
> # sysupgrade /tmp/openwrt-x86-64-generic-squashfs-systemd-boot.img.gz
> Tue Dec 30 17:45:38 CET 2025 upgrade: Image metadata not present
> Tue Dec 30 17:45:38 CET 2025 upgrade: Invalid image type
> Image check failed.
>
> sysupgrade to the grub2-efi Image is ok:
>
> # sysupgrade /tmp/openwrt-x86-64-generic-squashfs-combined-efi.img.gz
> Tue Dec 30 18:14:42 CET 2025 upgrade: Image metadata not present
> Tue Dec 30 18:14:42 CET 2025 upgrade: with offset=0 devname=vda
> Tue Dec 30 18:14:42 CET 2025 upgrade: Reading partition table from
> bootdisk...
> Tue Dec 30 18:14:42 CET 2025 upgrade: Extract boot sector from the image
> Tue Dec 30 18:14:42 CET 2025 upgrade: Reading partition table from image...
> Tue Dec 30 18:14:42 CET 2025 upgrade: Saving config files...
> Tue Dec 30 18:14:42 CET 2025 upgrade: Commencing upgrade. Closing all shell
> sessions.
> Tue Dec 30 18:14:42 CET 2025 upgrade: Sending TERM to remaining processes
> ...
> Tue Dec 30 18:14:46 CET 2025 upgrade: Sending KILL to remaining processes
> ...
> stage2 (3617): drop_caches: 3
> Tue Dec 30 18:14:52 CET 2025 upgrade: Switching to ramdisk...
> EXT4-fs (loop0): unmounting filesystem d13e0cae-a45a-42aa-a617-60f90bd2a9b1.
> Tue Dec 30 17:14:52 UTC 2025 upgrade: Performing system upgrade...
> [...]
You need to force it. The platform specific (x86) upgrade code looks
for certain magic bytes - I assume grub itself or data in the bios boot
partition. I already know that cross upgrading between grub and
systemd-boot works. The only limitation is that old builds without the
code that adjusts the systemd-boot config file keep the wrong root
partition parameter from the new image during the upgrade.
> Compiling entire systemd to get systemd-boot seems a bit wasteful to me, but
> my patch to prevent this is bad. I removed Build/Install, since it kept
> compiling everything.
I don't know how much of systemd building one can disable to still get
systemd-boot. We could think about using more from systemd, but I don't
think that would be a good fit for OpenWrt.
More information about the openwrt-devel
mailing list