mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
bootctl: show whether a PE file is an addon in 'booctl kernel-identify'
This commit is contained in:
committed by
Yu Watanabe
parent
6573f0c82c
commit
3e0a3a0259
@@ -267,7 +267,8 @@
|
||||
<term><option>kernel-identify</option> <replaceable>kernel</replaceable></term>
|
||||
|
||||
<listitem><para>Takes a kernel image as argument. Checks what kind of kernel the image is. Returns
|
||||
one of <literal>uki</literal>, <literal>pe</literal>, and <literal>unknown</literal>.
|
||||
one of <literal>uki</literal>, <literal>addon</literal>, <literal>pe</literal>, and
|
||||
<literal>unknown</literal>.
|
||||
</para>
|
||||
|
||||
<xi:include href="version-info.xml" xpointer="v253"/></listitem>
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
static const char * const kernel_image_type_table[_KERNEL_IMAGE_TYPE_MAX] = {
|
||||
[KERNEL_IMAGE_TYPE_UNKNOWN] = "unknown",
|
||||
[KERNEL_IMAGE_TYPE_UKI] = "uki",
|
||||
[KERNEL_IMAGE_TYPE_ADDON] = "addon",
|
||||
[KERNEL_IMAGE_TYPE_PE] = "pe",
|
||||
};
|
||||
|
||||
@@ -159,6 +160,16 @@ int inspect_kernel(
|
||||
|
||||
t = KERNEL_IMAGE_TYPE_UKI;
|
||||
goto done;
|
||||
} else if (pe_is_addon(pe_header, sections)) {
|
||||
r = inspect_uki(fd, pe_header, sections, ret_cmdline, ret_uname, /* ret_pretty_name= */ NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (ret_pretty_name)
|
||||
*ret_pretty_name = NULL;
|
||||
|
||||
t = KERNEL_IMAGE_TYPE_ADDON;
|
||||
goto done;
|
||||
} else
|
||||
t = KERNEL_IMAGE_TYPE_PE;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
typedef enum KernelImageType {
|
||||
KERNEL_IMAGE_TYPE_UNKNOWN,
|
||||
KERNEL_IMAGE_TYPE_UKI,
|
||||
KERNEL_IMAGE_TYPE_ADDON,
|
||||
KERNEL_IMAGE_TYPE_PE,
|
||||
_KERNEL_IMAGE_TYPE_MAX,
|
||||
_KERNEL_IMAGE_TYPE_INVALID = -EINVAL,
|
||||
|
||||
Reference in New Issue
Block a user