From patchwork Wed Jan 13 11:11:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 362077 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp427854jap; Wed, 13 Jan 2021 03:12:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZSO+toS1Lpbp5a8fhAME0apfwyAgN/NlwYY+1CkFdrBqpTMcyN5ocqFUyANMzMIho9Qwc X-Received: by 2002:a17:906:29cd:: with SMTP id y13mr1214279eje.453.1610536343565; Wed, 13 Jan 2021 03:12:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610536343; cv=none; d=google.com; s=arc-20160816; b=GOa3vc2rpuKFRLljGtbKZgX5QJAuA4ZwnkuQRj9MzNqiGfc47GIwXEJDVst4lk36UV DK3BMpOuW0dQ5aHjMZ3oItjB/HPKkP0c8GuUXK6N5jo6NH45JKpLmFUOmoi+Y0GCqPEg jW4VPFgtESpX/2wclRLyxIIx+8339ANbbEPuXAgs5/Sx1zmRBU0SSaocU8KlOZZR2sVk XNN4UhSap1JqbYqU4tOhC2Ohw0eWyThDOmaVdsIEsky75vwHODFPMJRTT0kpW4YslRpt NE7umDfdZUglPy0CwFDwZJlSPFPZDpSUqixEqtHMKYhRRXuIPlxRrh11ntoDjErNLnzj pEjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=14TnePlIK7QrOjuO8nJc+ZP7/oA6x3UGx8t67WWo1WI=; b=NTkysrMlhrw9UaEPtqyh7sexjP/rRPb0mR0rNDbowcpX3/xN8idfz6Nwq1Rw3C+grm 2t9/5vqWvk8jOvC0K9Acpfii64uJKpsCN57XXM7wHIx+5CjcNJlw4n6hdjOBdcu0ocOr J0YiWhWmpTyiMGlHCkmdtF2Jr48dEpItRlFOIV1nibkMJoSsYW0fsQWKiDWT+LOLeh/A tADAWT5W7LmQhSrdOtR5n3NisTPE3PjJSbN5Drik75SWTuZaj6ya2bEzLu/ZlFucXdqf lu6CuvRcS/rQotmM+94HS5xZGihSnuOgW9NCP7fgO8yr5ZG+Uy2FsgRnwMySKz4CVG1f 3JIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nS3/w28s"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id w11si849052ejc.533.2021.01.13.03.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 03:12:23 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="nS3/w28s"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B685F82652; Wed, 13 Jan 2021 12:12:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nS3/w28s"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 78BAE8261E; Wed, 13 Jan 2021 12:11:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2BA36825C4 for ; Wed, 13 Jan 2021 12:11:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x42f.google.com with SMTP id q18so1694289wrn.1 for ; Wed, 13 Jan 2021 03:11:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=14TnePlIK7QrOjuO8nJc+ZP7/oA6x3UGx8t67WWo1WI=; b=nS3/w28sG0hKvuDQ6dQteqkfza1/7/abnc3OW1qAlA5+1SY8B/S8KWUszosDhIvXEk 5Eqcj168bnOrPvzdbEjVor2bmtweGV+qNGroyJVS3EK1cLTROc+SSWJ8bU/YqHMTzO65 sIIJ8RMO5OoYkA2J0kezeFox4RquVSZI24iyKFjRW3tMN28KDd5xg+MtvUI8k9ETlafN UEKnMXE2Me+Tr9Ey7oJJoim9XWAcSLuGPGcO+q+Ch3iqs43av+rlUYCtE9C2hIhK9R2U 1ts6n+lsszE6e8I2FmzfKP0xlYngxQSjxXVd+gBQOyWzJce873KXJpixAe/QIZ4L5FaL QGTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=14TnePlIK7QrOjuO8nJc+ZP7/oA6x3UGx8t67WWo1WI=; b=Z4EfI1gdNJSOQsS8nbm7zB0zlHxS3qnW3BIJ0SId2kGjge7x8NOLTYknDxjkwZpZ6/ zb00+0pLIC2pVu5fqEvKNmvregYBUOhvxcUld7WlGjQcm9lwaZFOZ0vU87sfLBCD8RiD r6Al0qlKbcFgTE40CKJur4YLMpLvTGVgTz03RHYRSsORthpgCMb61E74b01nggWJwURL RtDF8jB0539JNKahfYaH0czIT0ZXZsKJOj41jUq3Ly/sqC49sIAgsvRK0Bwi7eb8uIX0 QJV26VGN36LZGaGyE5R9rUPfSTS8MkC+N3HBdMnpEZr3K5EcAOH63VJKbu0ULa0mZf0/ 4Mkw== X-Gm-Message-State: AOAM533ZwdgkziK+arTsEgAG2cfgAJZ2M7ywZfY2iEM6q1iHL0DDv4bz ZNTFl2PAFhWeVUtPAjW8HxD3oQ== X-Received: by 2002:adf:a551:: with SMTP id j17mr1984227wrb.217.1610536313720; Wed, 13 Jan 2021 03:11:53 -0800 (PST) Received: from apalos.home ([2a02:587:4667:3e9:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id r2sm2589869wrn.83.2021.01.13.03.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 03:11:53 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: takahiro.akashi@linaro.org, Ilias Apalodimas , Alexander Graf , u-boot@lists.denx.de Subject: [RFC PATCH 1/3] efi_loader: Introduce helper functions for EFI Date: Wed, 13 Jan 2021 13:11:47 +0200 Message-Id: <20210113111149.64567-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.30.0.rc2 In-Reply-To: <20210113111149.64567-1-ilias.apalodimas@linaro.org> References: <20210113111149.64567-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean A following patch introduces a different logic for loading initrd's based on the EFI_LOAD_FILE2_PROTOCOL. Since similar logic can be applied in the future for other system files (i.e DTBs), let's add some helper functions which will retrieve and parse file paths stored in EFI load options. Signed-off-by: Ilias Apalodimas --- include/efi_helper.h | 23 ++++++ lib/efi_loader/efi_helper.c | 146 ++++++++++++++++++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 include/efi_helper.h create mode 100644 lib/efi_loader/efi_helper.c -- 2.30.0.rc2 diff --git a/include/efi_helper.h b/include/efi_helper.h new file mode 100644 index 000000000000..4e6bd2f036df --- /dev/null +++ b/include/efi_helper.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2020, Linaro Limited + */ + +#if !defined _EFI_HELPER_H_ +#define _EFI_HELPER_H + +#include +#include + +enum load_option_dp_type { + BOOT_IMAGE_DP, + INITRD_DP, + DTB_DP, +}; + +void *efi_get_var(u16 *name, const efi_guid_t *vendor, efi_uintn_t *size); +struct efi_device_path *efi_get_fp_from_boot(int idx); +struct efi_device_path *efi_dp_instance_by_idx(struct efi_device_path *dp, + efi_uintn_t *size, int idx); + +#endif diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c new file mode 100644 index 000000000000..e2437a4f698b --- /dev/null +++ b/lib/efi_loader/efi_helper.c @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020, Linaro Limited + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * efi_get_var() - read value of an EFI variable + * + * @name: variable name + * @start: vendor GUID + * @size: size of allocated buffer + * + * Return: buffer with variable data or NULL + */ +void *efi_get_var(u16 *name, const efi_guid_t *vendor, efi_uintn_t *size) +{ + efi_status_t ret; + void *buf = NULL; + + *size = 0; + ret = efi_get_variable_int(name, vendor, NULL, size, buf, NULL); + if (ret == EFI_BUFFER_TOO_SMALL) { + buf = malloc(*size); + ret = efi_get_variable_int(name, vendor, NULL, size, buf, NULL); + } + + if (ret != EFI_SUCCESS) { + free(buf); + *size = 0; + return NULL; + } + + return buf; +} + +/** + * efi_dp_instance_by_idx() - Get a file path with a specific index + * + * @name: device path array + * @size: size of the discovered device path + * @idx: index of the device path + * + * Return: device path or NULL. Caller must free the returned value + */ + +struct +efi_device_path *efi_dp_instance_by_idx(struct efi_device_path *dp, + efi_uintn_t *size, int idx) +{ + struct efi_device_path *instance = NULL; + efi_uintn_t instance_size = 0; + + if (!efi_dp_is_multi_instance(dp)) + return NULL; + + while (idx >= 0 && dp) { + instance = efi_dp_get_next_instance(&dp, &instance_size); + if (idx && instance) { + efi_free_pool(instance); + instance_size = 0; + instance = NULL; + } + idx--; + } + *size = instance_size; + + return instance; +} + +/** + * create_boot_var_indexed() - Return Boot#### name were #### is replaced by + * the value of BootCurrent + * + * @var_name: variable name + * @var_name_size: size of var_name + * + * Return: Status code + */ +static efi_status_t create_boot_var_indexed(u16 var_name[], size_t var_name_size) +{ + efi_uintn_t boot_order_size; + efi_status_t ret; + u16 boot_order; + u16 *pos; + + boot_order_size = sizeof(boot_order); + ret = efi_get_variable_int(L"BootCurrent", + &efi_global_variable_guid, NULL, + &boot_order_size, &boot_order, NULL); + if (ret != EFI_SUCCESS) + goto out; + + pos = efi_create_indexed_name(var_name, var_name_size, "Boot", + boot_order); + if (!pos) { + ret = EFI_OUT_OF_RESOURCES; + goto out; + } + +out: + return ret; +} + +/** + * efi_get_fp_from_var() - Retrieve and return a device path from an EFI + * Boot### variable + * + * @idx: index of the instance to retrieve + * + * Return: device path of NULL. Caller must free the returned value + */ +struct efi_device_path *efi_get_fp_from_boot(int idx) +{ + struct efi_device_path *file_path; + struct efi_load_option lo; + void *var_value = NULL; + efi_uintn_t size; + efi_status_t ret; + u16 var_name[16]; + + ret = create_boot_var_indexed(var_name, sizeof(var_name)); + if (ret != EFI_SUCCESS) + return NULL; + + var_value = efi_get_var(var_name, &efi_global_variable_guid, &size); + if (!var_value) + return NULL; + + efi_deserialize_load_option(&lo, var_value, &size); + file_path = efi_dp_instance_by_idx(lo.file_path, &size, idx); + if (!file_path) { + printf("Instance not found\n"); + return NULL; + } + + return file_path; +} From patchwork Wed Jan 13 11:11:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 362078 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp427995jap; Wed, 13 Jan 2021 03:12:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfXZLrJMqvM9cywvsyRlGCzCuMrZxcCEOXHycl06N3b5q+QviSMZCE+qwomYa7KB8X/2U3 X-Received: by 2002:a17:907:546:: with SMTP id wk6mr1164598ejb.238.1610536354461; Wed, 13 Jan 2021 03:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610536354; cv=none; d=google.com; s=arc-20160816; b=BEsnbuIikEncqcfZG/jlvuT9cIsx1seYSKtIkrJDY4Xrxh1svTxSBF64esZ+Dmoh3/ GDm7NnQreb4tMXvuV60e7K5GnTuQ0kRg0OH+uNBhut2e9pUp9bCYjqi62bc/gzcPSDXD +swH4y6ozJpjFvESicG52JbNhtLEpjaHpGtG6QQluA+y6HM5vJMyyNVh7i2JrSu9EznA mgo7f3mnDl7nxikeZLVY9prHtbJfcm+47NCpaF2Po+9076Hsn2PmkQPKehOzg6z61PSK v5nLGBWVaGXtzBIhn+qO1+OAPgaM13MB4xX5k4vh3/bjt2NLEbNHLBz3OxYdi7IPRZsY IU5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MlWFyK7kR9qIzm1zkAYQ3ZukL55kyxRaumkmjaMu5O0=; b=XUyKbmRpH2WEm0vIzigfHWNQspMdhAw5TKdm81T9scV3SB6JInZAw6CpHRdDjO8B1d QQb+8rBBU3PK6cHJD5/FGzoYXPMNY2XHboR9jUn3pIMD9LAYl2F/2pbBKbUlfrz2ra3u mHvUKqcgwpBVF+3rqfkhVCmxR1cQ6YCymIXEbLwzdXBYryRJlI6AcpJrW7REZRLF3UKP do1EBUV0pBQcC0u9nQfkcnQbj7/3g3k/HfUgq+odOeC35NmVRkqjOM3vzPnqGG1GMoIr azlw1xOTtlaSKYUJSgCIoMzGN1P3HZ8mGqao0WNZoSMztXV/Dis7QM6XKoP6GksBjwMr yxWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o4bUeYiJ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id x26si845016edv.178.2021.01.13.03.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 03:12:34 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o4bUeYiJ; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D83E48263A; Wed, 13 Jan 2021 12:12:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="o4bUeYiJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BA84F825D9; Wed, 13 Jan 2021 12:12:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A9A87825D9 for ; Wed, 13 Jan 2021 12:11:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x436.google.com with SMTP id t30so1698058wrb.0 for ; Wed, 13 Jan 2021 03:11:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MlWFyK7kR9qIzm1zkAYQ3ZukL55kyxRaumkmjaMu5O0=; b=o4bUeYiJ3iSGjoBZxwGPLOT23TitXFhV0p8sb+E/fiFWLyHzKEK3GW14m9mE7lt5JV DE/64Tw7f+AgXSomBB46Tn0F4DNS+EbGSztuHStCt0lG69B6a4JGFLDkk5lM56m8MXSL 6dzfWkIECALFxKtWLP88T4lccWYAGbBG7su0dQCgVz41yDj27/bYrmR44I0fMm/myco+ QGCyLLSRBu9GQvhlt9FOZ4+YADWl4k2WPLDAnqQtM5QrVt9CV9JO3QLH9scZc2VSGqKM yoM35CmYTybuNuPPc9Il+drJS7djlMD6IAUtYMNBlFn0kIHdoVoEqQN/0T/jQm/khNMG 25Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MlWFyK7kR9qIzm1zkAYQ3ZukL55kyxRaumkmjaMu5O0=; b=Qcg/enZQIVPy4Mmdh6YkvektKg6lmBSXnBcvArv6ULRQsQaOMpv5Nda3aqfxfIlUVk NWV1ObPutdmbB0wvhfOuj+CCl78PYeIkPoq8lJcGu+MVORNzImJmPLbKCMkwziOW/3Y4 Ei+Qt7evrmTAzzJuql5DcdaH9RomP5uUnYOLTowwi7EppkoJQqA0/g3JmNaHGqllvt2x RFprGh7+mSoPW29iNyEIfxLdRj5ucDmqUNn66ocToqQbgTES5KjO31LVAOuSYDjsxIJo a0CxgvXTTWtLCHth/3DBM6kmAMBuu8F8ekhfrjXQEGfSfeeTiB2aEbw9FTfoJsarLN4o cGkQ== X-Gm-Message-State: AOAM533jBaSy2X/nbIUJ7XsPLTwhjfQdTCGeDV2CL9lJNG3rKULok5PT isrqlO/oP140ESeoM23G81BcIw== X-Received: by 2002:a5d:4a4e:: with SMTP id v14mr2044140wrs.80.1610536315275; Wed, 13 Jan 2021 03:11:55 -0800 (PST) Received: from apalos.home ([2a02:587:4667:3e9:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id r2sm2589869wrn.83.2021.01.13.03.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 03:11:54 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: takahiro.akashi@linaro.org, Ilias Apalodimas , Alexander Graf , u-boot@lists.denx.de Subject: [RFC PATCH 2/3] efi_loader: efi_loader: Replace config option for initrd loading Date: Wed, 13 Jan 2021 13:11:48 +0200 Message-Id: <20210113111149.64567-3-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.30.0.rc2 In-Reply-To: <20210113111149.64567-1-ilias.apalodimas@linaro.org> References: <20210113111149.64567-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Up to now we install EFI_LOAD_FILE2_PROTOCOL to load an initrd unconditionally. Although we correctly return various EFI exit codes depending on the file status (i.e EFI_NO_MEDIA, EFI_NOT_FOUND etc), the kernel loader, only falls back to the cmdline interpreted initrd if the protocol is not installed. This creates a problem for EFI installers, since they won't be able to load their own initrd and continue the installation. It also makes the feature hard to use, since we can either have a single initrd or we have to recompile u-boot if the filename changes. So let's introduce a different logic that will decouple the initrd path from the config option we currently have. When defining a UEFI BootXXXX we can use the filepathlist and store a file path pointing to our initrd. Specifically the EFI spec describes: "The first element of the array is a device path that describes the device and location of the Image for this load option. Other device paths may optionally exist in the FilePathList, but their usage is OSV specific" When the EFI application is launched through the bootmgr, we'll try to interpret the extra device path. If that points to a file that exists on our disk, we'll now install the load_file2 and the efi-stub will be able to use it. This opens up another path using U-Boot and defines a new boot flow. A user will be able to control the kernel/initrd pairs without explicit cmdline args or GRUB. Signed-off-by: Ilias Apalodimas --- cmd/bootefi.c | 3 + include/efi_loader.h | 1 + lib/efi_loader/Kconfig | 13 +-- lib/efi_loader/efi_bootmgr.c | 3 + lib/efi_loader/efi_load_initrd.c | 154 ++++++++++++++++--------------- 5 files changed, 91 insertions(+), 83 deletions(-) -- 2.30.0.rc2 diff --git a/cmd/bootefi.c b/cmd/bootefi.c index fdf909f8da2c..053927d5d986 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -357,6 +357,9 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options) free(load_options); + if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD)) + efi_initrd_deregister(); + return ret; } diff --git a/include/efi_loader.h b/include/efi_loader.h index 4719fa93f06d..5d2e161963c3 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -432,6 +432,7 @@ efi_status_t efi_net_register(void); /* Called by bootefi to make the watchdog available */ efi_status_t efi_watchdog_register(void); efi_status_t efi_initrd_register(void); +void efi_initrd_deregister(void); /* Called by bootefi to make SMBIOS tables available */ /** * efi_acpi_register() - write out ACPI tables diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index fdf245dea30b..597a3ee86c88 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -307,14 +307,11 @@ config EFI_LOAD_FILE2_INITRD help Expose a EFI_FILE_LOAD2_PROTOCOL that the Linux UEFI stub can use to load the initial ramdisk. Once this is enabled using - initrd= will stop working. - -config EFI_INITRD_FILESPEC - string "initramfs path" - default "host 0:1 initrd" - depends on EFI_LOAD_FILE2_INITRD - help - Full path of the initramfs file, e.g. mmc 0:2 initramfs.cpio.gz. + initrd= will stop working. The protocol will only be + installed if bootmgr is used and the file is found on the defined + path. A boot entry of Boot0001 will try to match Initrd0001 and use + it. Initrd EFI variable format should be ' ' + i.e 'mmc 0:1 boot/initrd' config EFI_SECURE_BOOT bool "Enable EFI secure boot support" diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index 0fe503a7f376..aa5d521535ee 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -222,6 +222,9 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle, ret = efi_set_variable_int(L"BootCurrent", &efi_global_variable_guid, attributes, sizeof(n), &n, false); + /* try to register load file2 for initrd's */ + if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD)) + ret |= efi_initrd_register(); if (ret != EFI_SUCCESS) { if (EFI_CALL(efi_unload_image(*handle)) != EFI_SUCCESS) diff --git a/lib/efi_loader/efi_load_initrd.c b/lib/efi_loader/efi_load_initrd.c index b9ee8839054f..bb0c5e63b65c 100644 --- a/lib/efi_loader/efi_load_initrd.c +++ b/lib/efi_loader/efi_load_initrd.c @@ -5,7 +5,9 @@ #include #include +#include #include +#include #include #include #include @@ -39,41 +41,10 @@ static const struct efi_initrd_dp dp = { } }; -/** - * get_file_size() - retrieve the size of initramfs, set efi status on error - * - * @dev: device to read from, e.g. "mmc" - * @part: device partition, e.g. "0:1" - * @file: name of file - * @status: EFI exit code in case of failure - * - * Return: size of file - */ -static loff_t get_file_size(const char *dev, const char *part, const char *file, - efi_status_t *status) -{ - loff_t sz = 0; - int ret; - - ret = fs_set_blk_dev(dev, part, FS_TYPE_ANY); - if (ret) { - *status = EFI_NO_MEDIA; - goto out; - } - - ret = fs_size(file, &sz); - if (ret) { - sz = 0; - *status = EFI_NOT_FOUND; - goto out; - } - -out: - return sz; -} +static efi_handle_t efi_initrd_handle; /** - * efi_load_file2initrd() - load initial RAM disk + * efi_load_file2_initrd() - load initial RAM disk * * This function implements the LoadFile service of the EFI_LOAD_FILE2_PROTOCOL * in order to load an initial RAM disk requested by the Linux kernel stub. @@ -93,21 +64,15 @@ efi_load_file2_initrd(struct efi_load_file_protocol *this, struct efi_device_path *file_path, bool boot_policy, efi_uintn_t *buffer_size, void *buffer) { - char *filespec; efi_status_t status = EFI_NOT_FOUND; - loff_t file_sz = 0, read_sz = 0; - char *dev, *part, *file; - char *pos; - int ret; + struct efi_device_path *initrd_path = NULL; + struct efi_file_info *info = NULL; + struct efi_file_handle *f; + efi_uintn_t bs; EFI_ENTRY("%p, %p, %d, %p, %p", this, file_path, boot_policy, buffer_size, buffer); - filespec = strdup(CONFIG_EFI_INITRD_FILESPEC); - if (!filespec) - goto out; - pos = filespec; - if (!this || this != &efi_lf2_protocol || !buffer_size) { status = EFI_INVALID_PARAMETER; @@ -125,51 +90,82 @@ efi_load_file2_initrd(struct efi_load_file_protocol *this, goto out; } - /* - * expect a string with three space separated parts: - * - * * a block device type, e.g. "mmc" - * * a device and partition identifier, e.g. "0:1" - * * a file path on the block device, e.g. "/boot/initrd.cpio.gz" - */ - dev = strsep(&pos, " "); - if (!dev) + initrd_path = efi_get_fp_from_boot(INITRD_DP); + if (!initrd_path) { + status = EFI_NOT_FOUND; goto out; - part = strsep(&pos, " "); - if (!part) + } + + /* Open file */ + f = efi_file_from_path(initrd_path); + if (!f) { + status = EFI_NOT_FOUND; goto out; - file = strsep(&pos, " "); - if (!file) + } + + /* Get file size */ + bs = 0; + EFI_CALL(status = f->getinfo(f, (efi_guid_t *)&efi_file_info_guid, + &bs, info)); + if (status != EFI_BUFFER_TOO_SMALL) { + status = EFI_DEVICE_ERROR; goto out; + } - file_sz = get_file_size(dev, part, file, &status); - if (!file_sz) + info = malloc(bs); + EFI_CALL(status = f->getinfo(f, (efi_guid_t *)&efi_file_info_guid, &bs, + info)); + if (status != EFI_SUCCESS) goto out; - if (!buffer || *buffer_size < file_sz) { + bs = info->file_size; + //efi_load_image_from_file + if (!buffer || *buffer_size < bs) { status = EFI_BUFFER_TOO_SMALL; - *buffer_size = file_sz; + *buffer_size = bs; } else { - ret = fs_set_blk_dev(dev, part, FS_TYPE_ANY); - if (ret) { - status = EFI_NO_MEDIA; - goto out; - } - - ret = fs_read(file, map_to_sysmem(buffer), 0, *buffer_size, - &read_sz); - if (ret || read_sz != file_sz) - goto out; - *buffer_size = read_sz; - - status = EFI_SUCCESS; + EFI_CALL(status = f->read(f, &bs, (void *)(uintptr_t)buffer)); + *buffer_size = bs; } out: - free(filespec); + free(info); + efi_free_pool(initrd_path); + EFI_CALL(f->close(f)); return EFI_EXIT(status); } +/** + * check_initrd() - Determine if the file defined as an initrd in Boot#### + * load_options device path is present + * + * Return: status code + */ +static efi_status_t check_initrd(void) +{ + struct efi_device_path *file_path; + struct efi_file_handle *f; + + /* + * if bootmgr is setup with and initrd, that will be the second + * device path instance in our load options located in Boot#### + */ + file_path = efi_get_fp_from_boot(INITRD_DP); + if (!file_path) + return EFI_NOT_FOUND; + + f = efi_file_from_path(file_path); + if (!f) { + efi_free_pool(file_path); + return EFI_NOT_FOUND; + } + + EFI_CALL(f->close(f)); + efi_free_pool(file_path); + + return EFI_SUCCESS; +} + /** * efi_initrd_register() - create handle for loading initial RAM disk * @@ -182,9 +178,12 @@ out: */ efi_status_t efi_initrd_register(void) { - efi_handle_t efi_initrd_handle = NULL; efi_status_t ret; + ret = check_initrd(); + if (ret != EFI_SUCCESS) + return ret; + ret = EFI_CALL(efi_install_multiple_protocol_interfaces (&efi_initrd_handle, /* initramfs */ @@ -196,3 +195,8 @@ efi_status_t efi_initrd_register(void) return ret; } + +void efi_initrd_deregister(void) +{ + efi_delete_handle(efi_initrd_handle); +} From patchwork Wed Jan 13 11:11:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 362079 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp428103jap; Wed, 13 Jan 2021 03:12:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7QEtu6ij0fAOebAjlLD9FmDXefoXCLb+sU7lNGc4NbZ5Wp5Y2DWwQjyCMjW6x8EDhQbFV X-Received: by 2002:a17:907:c01:: with SMTP id ga1mr1147109ejc.488.1610536365635; Wed, 13 Jan 2021 03:12:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610536365; cv=none; d=google.com; s=arc-20160816; b=sGaks18DdYyA6uL4dv0UyPJMJNrlRaCsaRSqbKHkJPkW/V6liarb888gvqbuhBPkto QBcZ4qEkz4rPlEoo4HZwVxcsSFgi1R+TcAx27yQx/4pigp/O0lYedWtBmzxvQWdhM3At Hc1dssd+GTjExNOKGXAFTpaeXDZNFSOAWV+mBwTQVxDg3rFRlC8YA+MHUBfvqhygt0QR 8leRSh49OGO6+lTPek/WKW1m5sHraXtcpCM/z7SU4FU/4R31G6hA5/PutA5yrJZljtME C1C2Psg3Ou/3zF4/wuGTlcm+tinQJTGWyetkIfUgMfeOp/KCK5bdVSzdQQcoUDoGMcSj r/8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fBK3v0d2ioh+ddkusX4EgOxnF0hLYP9doAyNXA0TK4s=; b=RJ0EZysRFm9BfhiioG2o9zhSznT9MmMX5mRBYBPsZrJSeXtZ5MJKumTG2m2ULmfp2Y 381bPY375ow025AX2zmB9Eig/XnIMrR3RafV6h78Xudl034q86DgGR/L1ibINJwpgVAg +H4j/rVHUbvxFaB9lJ5DY28JzkOsZ4g6CIX18APGzLA8OKnk/wLtcUuGi2Q/mat/8FGK ZGbxiiLy2AxcUe9GHht7qCoxyaYDfzFaekTNA3NU+KlrOnWOLQMPr65dxGHmR9wyCSFS M1uHKPIBaEgcJ7949Spb3UgkMfUP7qKvIeYd5fOALbXEYclQSfgAqjZarKvqXyBcpHWY LkLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Htd4or+U; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ch17si856870edb.430.2021.01.13.03.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 03:12:45 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Htd4or+U; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 548B482663; Wed, 13 Jan 2021 12:12:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Htd4or+U"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E1F318263A; Wed, 13 Jan 2021 12:12:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 20A448250D for ; Wed, 13 Jan 2021 12:11:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wm1-x331.google.com with SMTP id 3so1235138wmg.4 for ; Wed, 13 Jan 2021 03:11:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fBK3v0d2ioh+ddkusX4EgOxnF0hLYP9doAyNXA0TK4s=; b=Htd4or+UunScou/qSMvj+fUbwk/HJ5JEaF7OEnS+Yc+1Hqx+aGMsza9A8n6mJ03sI0 DYjPi3N4Of8bZSoS8YbNzyAYcZUGwQFGQOc7h9pylSLrxDNay2Tw7UnNM9oEolNZ+cC4 TPwcTtPTuE8tWBoiM+JYxOC9rpzoCP6/YI3zLRDY56oMnjtMv/MOdJMrgH5dsYyB7a6D tMU7qEYnMvsxbBPtEgwt5pY1JgpWhO60aGAPwr4JKs1KJnte7C/Q3SWMWo3/1UhuqYD2 VFtj5WDyweHWMtBrRP11DkXrCjpOFPLcqGKjWZrmtb91hd5941IkTYARTJNx2kXp9ux5 e9Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fBK3v0d2ioh+ddkusX4EgOxnF0hLYP9doAyNXA0TK4s=; b=Xn2p8SEhqwC+v/AVmzgZCq3CW4nIEETQpogfXFrGIk2XWru/T+8ofCBGQhwB3zAXQA UdvtWtH1AIVm/tcz6+KFWM9WPRu1c6KNVBeH+NBW3KsIAzlM7ZiIUP6+VrD4pZyoD/wg 65xi3HzXomDfBo2fuec2d5c12jd+OdjE7iDLN9U3bo+2Ee939COlNqDqDLEDNk1US2Me +qFMoBSB/fX4CHHXTFxLt2dguvO4JWWvsDL5Vvqgb3Xe9812JSYG9EgmO8MujbzEtbLk noe31NHGWz2p38bF6G1K7keXHM6IB/A1Cp5PrqemOyjsUx0hzMKmuNLvcK4ARKbl0mUA 0Uig== X-Gm-Message-State: AOAM533HENuv0W6ge8CrEelISwGvvN/TqAA4yxQFzfoMCpyXdDh8+YBd 3GZ0comLgOUSvQGW84G19BtAAw== X-Received: by 2002:a1c:4d05:: with SMTP id o5mr1745250wmh.85.1610536316736; Wed, 13 Jan 2021 03:11:56 -0800 (PST) Received: from apalos.home ([2a02:587:4667:3e9:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id r2sm2589869wrn.83.2021.01.13.03.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 03:11:56 -0800 (PST) From: Ilias Apalodimas To: xypron.glpk@gmx.de Cc: takahiro.akashi@linaro.org, Ilias Apalodimas , Alexander Graf , u-boot@lists.denx.de Subject: [RFC PATCH 3/3] efidebug: add multiple device path instances on Boot#### Date: Wed, 13 Jan 2021 13:11:49 +0200 Message-Id: <20210113111149.64567-4-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.30.0.rc2 In-Reply-To: <20210113111149.64567-1-ilias.apalodimas@linaro.org> References: <20210113111149.64567-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The UEFI spec allow a packed array of UEFI device paths in the FilePathList[] of an EFI_LOAD_OPTION. The first file path must describe the laoded image but the rest are OS specific. Previous patches parse the device path and try to use the second member of the array as an initrd. So let's modify efidebug slightly and install the second file described in the command line as the initrd device path. Signed-off-by: Ilias Apalodimas --- cmd/efidebug.c | 89 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 81 insertions(+), 8 deletions(-) -- 2.30.0.rc2 diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 5fb7b1e3c6a9..8d62981aca92 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#include #define BS systab.boottime #define RT systab.runtime @@ -782,6 +784,42 @@ static int do_efi_show_tables(struct cmd_tbl *cmdtp, int flag, return CMD_RET_SUCCESS; } +/** + * add_initrd_instance() - Append a device path to load_options pointing to an + * inirtd + * + * @argc: Number of arguments + * @argv: Argument array + * @file_path Existing device path, the new instance will be appended + * Return: Pointer to the device path or ERR_PTR + * + */ +static struct efi_device_path *add_initrd_instance(int argc, char *const argv[], + struct efi_device_path *file_path) +{ + struct efi_device_path *tmp_dp = NULL, *tmp_fp = NULL; + struct efi_device_path *final_fp = NULL; + efi_status_t ret; + + if (argc < 8) + return ERR_PTR(-EINVAL); + + ret = efi_dp_from_name(argv[6], argv[7], argv[8], &tmp_dp, + &tmp_fp); + if (ret != EFI_SUCCESS) { + printf("Cannot create device path for \"%s %s\"\n", + argv[6], argv[7]); + goto out; + } + + final_fp = efi_dp_append_instance(file_path, tmp_fp); + +out: + efi_free_pool(tmp_dp); + efi_free_pool(tmp_fp); + return final_fp ? final_fp : ERR_PTR(-EINVAL); +} + /** * do_efi_boot_add() - set UEFI load option * @@ -794,7 +832,11 @@ static int do_efi_show_tables(struct cmd_tbl *cmdtp, int flag, * * Implement efidebug "boot add" sub-command. Create or change UEFI load option. * - * efidebug boot add