]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: add new EFI variable exposing feature set of boot loader
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Oct 2018 14:51:46 +0000 (16:51 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 16 Nov 2018 14:47:18 +0000 (15:47 +0100)
We keep adding new features, let's advertise to the host OS what these
are in a new variable LoaderFeatures.

It works a bit like OsIndicationsSupported, but is about Loader
features.

man/systemd-boot.xml
src/boot/efi/boot.c

index e1d1910c910d3e2ed92afdb3b5e94073fa2e763f..e5374269706b393554b6e9e646c0777ddbe77a5e 100644 (file)
         loader.</para></listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><varname>LoaderFeatures</varname></term>
+
+        <listitem><para>A set of flags indicating the features the boot loader supports. Set by the boot loader. Use
+        <citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> to view this
+        data.</para></listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><varname>LoaderFirmwareInfo</varname></term>
         <term><varname>LoaderFirmwareType</varname></term>
index b2fa8f1e2a55224b29ef8da0f5259322a07dcdcf..909cf914a63b209a21e06c315d04b2837091d8c3 100644 (file)
@@ -2072,6 +2072,14 @@ static VOID config_write_entries_to_variable(Config *config) {
 }
 
 EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
+        static const UINT64 loader_features =
+                (1ULL << 0) | /* I honour the LoaderConfigTimeout variable */
+                (1ULL << 1) | /* I honour the LoaderConfigTimeoutOneShot variable */
+                (1ULL << 2) | /* I honour the LoaderEntryDefault variable */
+                (1ULL << 3) | /* I honour the LoaderEntryOneShot variable */
+                (1ULL << 4) | /* I support boot counting */
+                0;
+
         _cleanup_freepool_ CHAR16 *infostr = NULL, *typestr = NULL;
         CHAR8 *b;
         UINTN size;
@@ -2095,6 +2103,8 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
         typestr = PoolPrint(L"UEFI %d.%02d", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff);
         efivar_set(L"LoaderFirmwareType", typestr, FALSE);
 
+        (void) efivar_set_raw(&loader_guid, L"LoaderFeatures", &loader_features, sizeof(loader_features), FALSE);
+
         err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (VOID **)&loaded_image,
                                 image, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
         if (EFI_ERROR(err)) {