ukify: Add support for .ucode UKI section

This commit teaches ukify how to build a .ucode section into UKIs. This
section is functionally an initrd, intended for microcode updates.
This commit is contained in:
Tobias Fleig
2024-04-19 06:28:47 -07:00
parent 590ac4bd27
commit d380337dc5
2 changed files with 21 additions and 0 deletions
+11
View File
@@ -67,6 +67,7 @@
<para>Additional sections will be inserted into the UKI, either automatically or only if a specific
option is provided. See the discussions of
<varname>Microcode=</varname>/<option>--microcode=</option>,
<varname>Cmdline=</varname>/<option>--cmdline=</option>,
<varname>OSRelease=</varname>/<option>--os-release=</option>,
<varname>DeviceTree=</varname>/<option>--devicetree=</option>,
@@ -302,6 +303,16 @@
<xi:include href="version-info.xml" xpointer="v254"/></listitem>
</varlistentry>
<varlistentry>
<term><varname>Microcode=<replaceable>UCODE</replaceable></varname></term>
<term><option>--microcode=<replaceable>UCODE</replaceable></option></term>
<listitem><para>Path to initrd containing microcode updates. If not specified, the section
will not be present.</para>
<xi:include href="version-info.xml" xpointer="v256"/></listitem>
</varlistentry>
<varlistentry>
<term><varname>Cmdline=<replaceable>TEXT</replaceable>|<replaceable>@PATH</replaceable></varname></term>
<term><option>--cmdline=<replaceable>TEXT</replaceable>|<replaceable>@PATH</replaceable></option></term>
+10
View File
@@ -303,6 +303,7 @@ class Uname:
DEFAULT_SECTIONS_TO_SHOW = {
'.linux' : 'binary',
'.initrd' : 'binary',
'.ucode' : 'binary',
'.splash' : 'binary',
'.dtb' : 'binary',
'.cmdline' : 'text',
@@ -855,6 +856,7 @@ def make_uki(opts):
('.splash', opts.splash, True ),
('.pcrpkey', pcrpkey, True ),
('.initrd', initrd, True ),
('.ucode', opts.microcode, True ),
# linux shall be last to leave breathing room for decompression.
# We'll add it later.
@@ -1279,6 +1281,14 @@ CONFIG_ITEMS = [
config_push = ConfigItem.config_list_prepend,
),
ConfigItem(
'--microcode',
metavar = 'UCODE',
type = pathlib.Path,
help = 'microcode file [.ucode section]',
config_key = 'UKI/Microcode',
),
ConfigItem(
('--config', '-c'),
metavar = 'PATH',