summaryrefslogtreecommitdiffstats
path: root/discover/boot.c
diff options
context:
space:
mode:
authorMaxiwell S. Garcia <maxiwell@linux.ibm.com>2019-09-23 19:30:24 -0300
committerJeremy Kerr <jk@ozlabs.org>2020-01-25 11:54:50 +0800
commit7b108dfe3a4788801537ce48b67a0d69c1b25d7f (patch)
tree38565b770c554f3f3cd3a315c183e2e358458c12 /discover/boot.c
parent3513c7f934d97b1db34c5e4e1ce9c995844764bd (diff)
downloadtalos-petitboot-7b108dfe3a4788801537ce48b67a0d69c1b25d7f.tar.gz
talos-petitboot-7b108dfe3a4788801537ce48b67a0d69c1b25d7f.zip
discover: Check if the kernel image has Ultravisor support
The PPC kernel image has an ELF Note 'namespace' called 'PowerPC' to store capabilities and information which can be used by a bootloader or userland. The capabilities can be accessed using the 'type' PPC_ELFNOTE_CAPABILITIES which returns a bitmap as 'descriptor' field. Bit 0 in this bitmap indicates that the powerpc kernel binary knows how to run in an ultravisor-enabled system. So, using this bit, the petitboot can decide to abort the boot if the kernel is incompatible, avoiding the crash later. This validation only occours on PowerPC ultravisor-system and if the config 'preboot check' in UI screen is enabled. Signed-off-by: Maxiwell S. Garcia <maxiwell@linux.ibm.com>
Diffstat (limited to 'discover/boot.c')
-rw-r--r--discover/boot.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/discover/boot.c b/discover/boot.c
index 20de0a3..00507b7 100644
--- a/discover/boot.c
+++ b/discover/boot.c
@@ -448,6 +448,24 @@ static void cleanup_cancellations(struct boot_task *task,
talloc_free(task);
}
+static bool preboot_check(struct boot_task *task)
+{
+ const char *local_image = (task->local_image_override) ?
+ task->local_image_override : task->local_image;
+
+ char *preboot_check_err_msg = NULL;
+ bool preboot_check_ret = platform_preboot_check(local_image,
+ &preboot_check_err_msg);
+
+ if (preboot_check_err_msg) {
+ update_status(task->status_fn, task->status_arg,
+ STATUS_ERROR, "%s", preboot_check_err_msg);
+ talloc_free(preboot_check_err_msg);
+ }
+
+ return preboot_check_ret;
+}
+
static void boot_process(struct load_url_result *result, void *data)
{
struct boot_task *task = data;
@@ -471,6 +489,9 @@ static void boot_process(struct load_url_result *result, void *data)
run_boot_hooks(task);
+ if (!preboot_check(task))
+ return;
+
update_status(task->status_fn, task->status_arg, STATUS_INFO,
_("Performing kexec load"));
OpenPOWER on IntegriCloud