···251251 machine.succeed("test -e /boot/efi/nixos/.extra-files/efi/netbootxyz/netboot.xyz.efi")
252252 '';
253253 };
254254+255255+ # See: [Firmware file size bug] in systemd/default.nix
256256+ uefiLargeFileWorkaround = makeTest {
257257+ name = "uefi-large-file-workaround";
258258+259259+ nodes.machine = { pkgs, ... }: {
260260+ imports = [common];
261261+ virtualisation.efi.OVMF = pkgs.OVMF.overrideAttrs (old: {
262262+ # This patch deliberately breaks the FAT driver in EDK2 to
263263+ # exhibit (part of) the firmware bug that we are testing
264264+ # for. Files greater than 10MiB will fail to be read in a
265265+ # single Read() call, so systemd-boot will fail to load the
266266+ # initrd without a workaround. The number 10MiB was chosen
267267+ # because if it were smaller than the kernel size, even the
268268+ # LoadImage call would fail, which is not the failure mode
269269+ # we're testing for. It needs to be between the kernel size
270270+ # and the initrd size.
271271+ patches = old.patches or [] ++ [ ./systemd-boot-ovmf-broken-fat-driver.patch ];
272272+ });
273273+ };
274274+275275+ testScript = ''
276276+ machine.wait_for_unit("multi-user.target")
277277+ '';
278278+ };
254279}
+10
pkgs/os-specific/linux/systemd/default.nix
···190190 ./0017-inherit-systemd-environment-when-calling-generators.patch
191191 ./0018-core-don-t-taint-on-unmerged-usr.patch
192192 ./0019-tpm2_context_init-fix-driver-name-checking.patch
193193+194194+ (fetchpatch {
195195+ # https://github.com/systemd/systemd/pull/25948
196196+ #
197197+ # [Firmware file size bug]: Some UEFI firmwares fail on large
198198+ # reads. Now that systemd-boot loads initrd itself, systems with
199199+ # such firmware won't boot without this fix
200200+ url = "https://github.com/systemd/systemd/commit/3ed1d966f00b002ed822ca9de116252bd91fe6c3.patch";
201201+ hash = "sha256-pwXrLTScqgnvfddlzUBZpwsoMrvRLcZPp6e4whMcyL4=";
202202+ })
193203 ] ++ lib.optional stdenv.hostPlatform.isMusl (
194204 let
195205 oe-core = fetchzip {