From: Lennart Poettering Date: Fri, 11 Feb 2022 13:12:09 +0000 (+0100) Subject: bootspec: parse/show devicetree-overlay field too X-Git-Tag: v251-rc1~293^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdc5c0429982a0b072736f0031bd61caf48a4193;p=thirdparty%2Fsystemd.git bootspec: parse/show devicetree-overlay field too It has been defined in the boot loader spec, and is the only field we currently don't parse, hence fix that. --- diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index edc9ef4be96..d94a2a586ba 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -450,6 +450,7 @@ static int boot_entry_show(const BootEntry *e, bool show_as_default) { e->root, *s, &status); + if (!strv_isempty(e->options)) { _cleanup_free_ char *t = NULL, *t2 = NULL; _cleanup_strv_free_ char **ts = NULL; @@ -468,9 +469,16 @@ static int boot_entry_show(const BootEntry *e, bool show_as_default) { printf(" options: %s\n", t2); } + if (e->device_tree) boot_entry_file_list("devicetree", e->root, e->device_tree, &status); + STRV_FOREACH(s, e->device_tree_overlay) + boot_entry_file_list(s == e->device_tree_overlay ? "devicetree-overlay" : NULL, + e->root, + *s, + &status); + return -status; } diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index 1f2bab3fb84..cbc356e4722 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -51,6 +51,7 @@ static void boot_entry_free(BootEntry *entry) { free(entry->efi); strv_free(entry->initrd); free(entry->device_tree); + strv_free(entry->device_tree_overlay); } static int boot_entry_load( @@ -144,7 +145,15 @@ static int boot_entry_load( r = strv_extend(&tmp.initrd, p); else if (streq(field, "devicetree")) r = free_and_strdup(&tmp.device_tree, p); - else { + else if (streq(field, "devicetree-overlay")) { + _cleanup_strv_free_ char **l = NULL; + + l = strv_split(p, NULL); + if (!l) + return log_oom(); + + r = strv_extend_strv(&tmp.device_tree_overlay, l, false); + } else { log_notice("%s:%u: Unknown line \"%s\", ignoring.", path, line, field); continue; } diff --git a/src/shared/bootspec.h b/src/shared/bootspec.h index 81845f47e37..8032c99ed5e 100644 --- a/src/shared/bootspec.h +++ b/src/shared/bootspec.h @@ -34,6 +34,7 @@ typedef struct BootEntry { char *efi; char **initrd; char *device_tree; + char **device_tree_overlay; } BootEntry; typedef struct BootConfig {