]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: Use objcopy to align sections
authorJan Janssen <medhefgo@web.de>
Sat, 1 Jan 2022 15:37:27 +0000 (16:37 +0100)
committerJan Janssen <medhefgo@web.de>
Sun, 2 Jan 2022 18:58:56 +0000 (19:58 +0100)
Not aligning these can create gaps in the section table. Some
firmware does not handle this nicely resulting in secure boot
signature fails.
Using objcopy ensures that any new sections in the future will be
properly aligned.

Fixes: #21956
src/boot/efi/meson.build
src/boot/efi/secure-boot.c

index ab970001e4d4a5c9031e03b11b486f34c9ab21a8..8587b11cd6b15f90bcc9ac240088f0e7746cc108 100644 (file)
@@ -405,6 +405,7 @@ foreach tuple : [['systemd_boot.so', systemd_boot_efi_name, systemd_boot_objects
                            '-j', '.sdata',
                            '-j', '.sdmagic',
                            '-j', '.text',
+                           '--section-alignment=512',
                            efi_format,
                            '@INPUT@', '@OUTPUT@'],
                 install : true,
index efea1457195ac1427117d9f136ddc4c6bc3767a0..ab2d256031af78712b87bfdde84a2441e8b16811 100644 (file)
@@ -30,7 +30,7 @@ SecureBootMode secure_boot_mode(void) {
 }
 
 #ifdef SBAT_DISTRO
-static const char sbat[] _used_ _section_ (".sbat") _align_ (512) =
+static const char sbat[] _used_ _section_(".sbat") =
         "sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md\n"
         SBAT_PROJECT ",1,The systemd Developers," SBAT_PROJECT "," PROJECT_VERSION "," PROJECT_URL "\n"
         SBAT_PROJECT "." SBAT_DISTRO "," STRINGIFY(SBAT_DISTRO_GENERATION) "," SBAT_DISTRO_SUMMARY "," SBAT_DISTRO_PKGNAME "," SBAT_DISTRO_VERSION "," SBAT_DISTRO_URL "\n";