]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: Add .osrel section
authorJan Janssen <medhefgo@web.de>
Thu, 4 Nov 2021 09:37:25 +0000 (10:37 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 5 Nov 2021 21:11:43 +0000 (22:11 +0100)
This allows starting systemd-boot from \EFI\Linux for easier testing
and bisection without risking an unbootable system as the user does not
need to replace their working loader.

src/boot/efi/boot.c
src/boot/efi/meson.build

index 296efdd4892a9de899c5b6cca8215e6767782af8..5992a28cdd0bc4ea629b815956b1dcf0be8b3a43 100644 (file)
 /* magic string to find in the binary image */
 _used_ _section_(".sdmagic") static const char magic[] = "#### LoaderInfo: systemd-boot " GIT_VERSION " ####";
 
+/* Makes systemd-boot available from \EFI\Linux\ for testing purposes. */
+_used_ _section_(".osrel") static const char osrel[] =
+        "ID=systemd-boot\n"
+        "VERSION=\"" GIT_VERSION "\"\n"
+        "NAME=\"systemd-boot " GIT_VERSION "\"\n";
+
 enum loader_type {
         LOADER_UNDEFINED,
         LOADER_EFI,
index 40b0ab0dbd8256ca7ad954829c629aed5218cf17..cdf31c7fd851c4869f82fe7bf5e8a75b55ed1062 100644 (file)
@@ -323,14 +323,15 @@ if have_gnu_efi
                         input : so,
                         output : tuple[1],
                         command : [objcopy,
-                                   '-j', '.text',
-                                   '-j', '.sdata',
-                                   '-j', '.sbat',
-                                   '-j', '.sdmagic',
                                    '-j', '.data',
                                    '-j', '.dynamic',
                                    '-j', '.dynsym',
+                                   '-j', '.osrel',
                                    '-j', '.rel*',
+                                   '-j', '.sbat',
+                                   '-j', '.sdata',
+                                   '-j', '.sdmagic',
+                                   '-j', '.text',
                                    efi_format,
                                    '@INPUT@', '@OUTPUT@'],
                         install : true,