From patchwork Fri Nov 1 15:25:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005190 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=P6i0sESk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4TT1K8qz1xwc for ; Sat, 2 Nov 2024 02:26:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 918C788E42; Fri, 1 Nov 2024 16:26:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="P6i0sESk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A5B8388E2D; Fri, 1 Nov 2024 16:26:26 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (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 C8D62889EB for ; Fri, 1 Nov 2024 16:26:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a9a4031f69fso298934966b.0 for ; Fri, 01 Nov 2024 08:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474784; x=1731079584; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8ajO0kE4L7pLjYAYTWLV7R8mXk5S+6K44+EJo4R+uIc=; b=P6i0sESkiPoCTQb3EDx+U62apH5VEq1DB8Z0hvSoH5iBSPBmotMrIJf5TTVmlDtIbX fj+InHgq0IsUEA3zwZdSybrYz2ATFiMrAq1tr6xyB+qjFi5rmGNBK4F7KOUDbz4QQ5Ba MTm9AoYZUmi7kLLiHU3QdUwO6qcDPOS4nrviU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474784; x=1731079584; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8ajO0kE4L7pLjYAYTWLV7R8mXk5S+6K44+EJo4R+uIc=; b=JtaJkkdYv2jP5Xn3ObmmI4LHrT6ZdyPhZUS1nBAQN6GFdupYBA3bYVJ3pz/rLtoo1T niJWEI2gVtZxXYLchvks2Q2rRJYNp9N4qx4v9n2q/H3Q/yzunCx7TA44Ku1KPAJXGFUW GH5bO6895j+eMtrDHiUhVwtgwlw4kx2hczAORg/tap3iDnxXqN+SaEA0lYJ8pvGDhqI8 B7O4PLSFT6sPPbX86Wne9KcieHqozZsd6eL9bxA0FC3Qnjnx0Z8pH3ShubxgnQPaLQtN qZXEqoLucNiXL/DB/Ywl7aEDWsiEA7Q7bqzeIW+nZW2N2T9MjHHIDu2Txv+FZpmf+sBT oEww== X-Gm-Message-State: AOJu0Yy2IsPiEy1iUwjSCTjR/fOHorsCFeRZix/xygT2I39LMKWEO0to D+8EwxzizmwViwl4S80Mrf2Ns3GERV/0m6QyAUhsaC22YacXCL167syvG5YN2ZFyqU8J8GXIh9P DJPU7 X-Google-Smtp-Source: AGHT+IFZ3S/P7OUhHrMFNkDyYBZlVJ8QxkNng+eV1iZtAfnFWSXyAwMX2Kb+t+uD5DNCqlGgGvvUFA== X-Received: by 2002:a17:907:724d:b0:a9a:14fc:44a2 with SMTP id a640c23a62f3a-a9de5ee10admr680500766b.30.1730474783738; Fri, 01 Nov 2024 08:26:23 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Mattijs Korpershoek Subject: [PATCH v9 01/11] test: boot: Update bootflow_iter() for console checking Date: Fri, 1 Nov 2024 16:25:59 +0100 Message-ID: <20241101152614.238747-2-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean This test checks console output so should have the UTF_CONSOLE flag. Add it. Signed-off-by: Simon Glass --- (no changes since v1) test/boot/bootflow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 0d4e966892e..841729bd1ac 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -370,7 +370,7 @@ static int bootflow_iter(struct unit_test_state *uts) return 0; } -BOOTSTD_TEST(bootflow_iter, UTF_DM | UTF_SCAN_FDT); +BOOTSTD_TEST(bootflow_iter, UTF_DM | UTF_SCAN_FDT | UTF_CONSOLE); #if defined(CONFIG_SANDBOX) && defined(CONFIG_BOOTMETH_GLOBAL) /* Check using the system bootdev */ From patchwork Fri Nov 1 15:26:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005191 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=SX90xGCG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4Tf6jhcz1xwc for ; Sat, 2 Nov 2024 02:26:46 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F207E88CC9; Fri, 1 Nov 2024 16:26:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="SX90xGCG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 22C11892C6; Fri, 1 Nov 2024 16:26:29 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) (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 16245889EB for ; Fri, 1 Nov 2024 16:26:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2fb4af0b6beso34260151fa.3 for ; Fri, 01 Nov 2024 08:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474785; x=1731079585; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1MLwUEwpwAPcm3DdRqhIpLtME9Je19XPrbtX3c8w4o4=; b=SX90xGCGg1vfCkavyf0+LC2eqpbx49ZBE414uci9ea55hmlQD5PU5D0DzzrsG+dZ6D C74seVIHdrEnt1wvd3p6qKjTyaG4VcwJA7oXixVOMyuxB78iG5lPdyZKE0lujX4IaNos FTjKwx044H+dsT6TlVF2FBlQZcJZYdVExSm14= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474785; x=1731079585; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1MLwUEwpwAPcm3DdRqhIpLtME9Je19XPrbtX3c8w4o4=; b=SFNLRdRQPq+GP8XfkfBMfv/JoPNqpoNkVaEOiJ7hV65kFSw51tThT0s2VqfkYNLI+S y63jSZPV/kd1pg9mULyA1UDrdnTOZX7DTmLiRGeg9wEnDZhw3gEtZot5eAMpKVAlf9m3 2vkx+xrGWnfoTwWyP+T9Xgi2MjbCj6xKMrjLALI8+LangwubPz162VBXFJGmzcg4Gx2p qdGncVMTbVxO4LSSTJX3Agq/7znFjKVdH4qIw8eLKapLMaoFe7MPee9QUghv40KOjGry qWeyGc0cX1964RVNsK9SvgK8LTl2kiIfDFGIQB4L6GZzJ/SHmCZ5/jMC38H7dA81Rc+X +HoA== X-Gm-Message-State: AOJu0Yz6JSS2q3czb+dm50/7bQXWQM8QZcg5O03usDqPtKZVoWx28TCV JnInUmgfnB5cWCLsVAhCNofrqbzZD9rtSriWPSqGz9GxFKs3P/t/EcRPS44LDY/POU2dxUWl2P+ NGBY4 X-Google-Smtp-Source: AGHT+IGZgTOHsSd+IXUT4WiOPj0GqenRAM3Z/EWCLkCKHCZPe2M9oMbmiurMcMr/iWoGWWcLjaP0PQ== X-Received: by 2002:a05:651c:220d:b0:2fb:6509:b6ba with SMTP id 38308e7fff4ca-2fedb813ba8mr36126751fa.33.1730474785365; Fri, 01 Nov 2024 08:26:25 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Caleb Connolly , Michal Simek Subject: [PATCH v9 02/11] efi_loader: Add a test app Date: Fri, 1 Nov 2024 16:26:00 +0100 Message-ID: <20241101152614.238747-3-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Add a simple app to use for testing. This is intended to do whatever it needs to for testing purposes. For now it just prints a message and exits boot services. There was a considerable amount of discussion about whether it is OK to call exit-boot-services and then return to U-Boot. This is not normally done in a real application, since exit-boot-services is used to completely disconnect from U-Boot. For now, this part is skipped. Signed-off-by: Simon Glass --- Changes in v10: - Drop call to exit-boot-services Changes in v9: - Update license - Fix 'sevices' typo Changes in v7: - Update commit message lib/efi_loader/Kconfig | 10 +++++++ lib/efi_loader/Makefile | 1 + lib/efi_loader/testapp.c | 64 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 lib/efi_loader/testapp.c diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 37572c82f54..44319729bda 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -584,6 +584,16 @@ config BOOTEFI_HELLO_COMPILE No additional space will be required in the resulting U-Boot binary when this option is enabled. +config BOOTEFI_TESTAPP_COMPILE + bool "Compile an EFI test app for testing" + default y + help + This compiles an app designed for testing. It is packed into an image + by the test.py testing frame in the setup_efi_image() function. + + No additional space will be required in the resulting U-Boot binary + when this option is enabled. + endif source "lib/efi/Kconfig" diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 8ec240cb864..7c8b2dd1ad6 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -20,6 +20,7 @@ apps-$(CONFIG_EFI_LOAD_FILE2_INITRD) += initrddump ifeq ($(CONFIG_GENERATE_ACPI_TABLE),) apps-y += dtbdump endif +apps-$(CONFIG_BOOTEFI_TESTAPP_COMPILE) += testapp obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o obj-$(CONFIG_EFI_BOOTMGR) += efi_bootmgr.o diff --git a/lib/efi_loader/testapp.c b/lib/efi_loader/testapp.c new file mode 100644 index 00000000000..1a2f9ef9b6c --- /dev/null +++ b/lib/efi_loader/testapp.c @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Hello world EFI application + * + * Copyright 2024 Google LLC + * Written by Simon Glass + * + * This test program is used to test the invocation of an EFI application. + * It writes a few messages to the console and then exits boot services + */ + +#include + +static const efi_guid_t loaded_image_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID; + +static struct efi_system_table *systable; +static struct efi_boot_services *boottime; +static struct efi_simple_text_output_protocol *con_out; + +/** + * efi_main() - entry point of the EFI application. + * + * @handle: handle of the loaded image + * @systab: system table + * Return: status code + */ +efi_status_t EFIAPI efi_main(efi_handle_t handle, + struct efi_system_table *systab) +{ + struct efi_loaded_image *loaded_image; + efi_status_t ret; + + systable = systab; + boottime = systable->boottime; + con_out = systable->con_out; + + /* Get the loaded image protocol */ + ret = boottime->open_protocol(handle, &loaded_image_guid, + (void **)&loaded_image, NULL, NULL, + EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (ret != EFI_SUCCESS) { + con_out->output_string + (con_out, u"Cannot open loaded image protocol\r\n"); + goto out; + } + + /* UEFI requires CR LF */ + con_out->output_string(con_out, u"U-Boot test app for EFI_LOADER\r\n"); + +out: + /* + * TODO: exit boot services so that this part of U-Boot can be tested + * + * map_size = 0; + * ret = boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size, + * &desc_version); + * boottime->exit_boot_services(handle, map_key); + */ + con_out->output_string(con_out, u"Exiting test app\n"); + ret = boottime->exit(handle, ret, 0, NULL); + + /* We should never arrive here */ + return ret; +} From patchwork Fri Nov 1 15:26:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005192 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=mjqHQVnP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4Tq4ZTBz1xwc for ; Sat, 2 Nov 2024 02:26:55 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7C8AF892D5; Fri, 1 Nov 2024 16:26:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="mjqHQVnP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B29388CC9; Fri, 1 Nov 2024 16:26:30 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) (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 886AC88E2D for ; Fri, 1 Nov 2024 16:26:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5cb74434bc5so2461832a12.0 for ; Fri, 01 Nov 2024 08:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474786; x=1731079586; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PVkqanoExg/W5ZFXEjGqu/ADcv5p/TLMf5DbkvHyR+I=; b=mjqHQVnPwpG90Uoz4K985jrIp0u1+Z+/0KJ2P8/HhB8VF6B4XY/1enNYgCq+32CuVD SXUtUVh7TnfbHXxmi5XoBKWrjoFauOH/Tick7a5qhlIHVqoy5UMxI9ZumHRANuVJjs6x 3DUVbV3gCAoEttQAO7oYSIBdHjhxlN5pkM/5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474786; x=1731079586; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PVkqanoExg/W5ZFXEjGqu/ADcv5p/TLMf5DbkvHyR+I=; b=JBs5KTlc2vLILINvRmRFdTcPPYFmcc/LbMWy9dmbkzFtCS2xKUCSk1ovyEJzDcyAw+ TE53Nh9+JHSa1v/c4nEKucznV1qZigxvxdKaZOu8r6HeQ8j0JyDm9/kwAaKopgXXD/Vg Svjjx2GMvlvVp2r7xaPo+i3My/HT3yyisz7qPkaWo9IJGux6iA5mHwFdcMEOjGmaknNT lbVHEu971Ns0FU7DGCADOlmFH/WuclmNq8ItbbVVgGwmkgenAmRKUOs7lWeUdyG2lBIV XNzXNDJ2Mv6Pi/DwTYcrZ3fZPskUJ88UwCkOj5IAp5hb6HDXyFOHjx3GcfM9AxoV/zGP NqDA== X-Gm-Message-State: AOJu0Yz7qCFXsgARa76juCZnDm0nd0ApYgLXcwKMcZ8x8w2QBbVh1I/f P4Xz7lE2SJDyMVmhLJsq4UeqmV7aZHyhGTSM0WtZGBkLX57pzt/W7co71JxQw1jAjFRzN8YY1Tx M9mIc X-Google-Smtp-Source: AGHT+IHdjyyEYMHRWCR0ecuus/TcV0I//tPqBOYoLceCxp1JiQOGu8xu7qWoCOO1lebqsmjTQ04w0w== X-Received: by 2002:a17:907:9603:b0:a9a:3da9:6a02 with SMTP id a640c23a62f3a-a9e658084cbmr344489766b.60.1730474786182; Fri, 01 Nov 2024 08:26:26 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass Subject: [PATCH v9 03/11] sandbox: Add a -N flag to control on-host behaviour Date: Fri, 1 Nov 2024 16:26:01 +0100 Message-ID: <20241101152614.238747-4-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Sandbox is its own architecture, but sometimes we want to mimic the host architecture, e.g. when running an EFI app not built by U-Boot. Add a -N/--native flag which tells sandbox to reflect the architecture of the host. Signed-off-by: Simon Glass --- (no changes since v8) Changes in v8: - Add new patch to control on-host behaviour arch/sandbox/cpu/start.c | 10 ++++++++++ arch/sandbox/include/asm/state.h | 1 + 2 files changed, 11 insertions(+) diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 81752edc9f8..2940768cd1c 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -449,6 +449,16 @@ static void setup_ram_buf(struct sandbox_state *state) gd->ram_size = state->ram_size; } +static int sandbox_cmdline_cb_native(struct sandbox_state *state, + const char *arg) +{ + state->native = true; + + return 0; +} +SANDBOX_CMDLINE_OPT_SHORT(native, 'N', 0, + "Use native mode (host-based EFI boot filename)"); + void state_show(struct sandbox_state *state) { char **p; diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index e7dc01759e8..dc21a623106 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -101,6 +101,7 @@ struct sandbox_state { bool disable_eth; /* Disable Ethernet devices */ bool disable_sf_bootdevs; /* Don't bind SPI flash bootdevs */ bool upl; /* Enable Universal Payload (UPL) */ + bool native; /* Adjust to reflect host arch */ /* Pointer to information for each SPI bus/cs */ struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS] From patchwork Fri Nov 1 15:26:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005193 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NHm4AWLn; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4V071V7z1xwc for ; Sat, 2 Nov 2024 02:27:04 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E1DC1892E5; Fri, 1 Nov 2024 16:26:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NHm4AWLn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3A2FA892D5; Fri, 1 Nov 2024 16:26:31 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (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 1DDE2892CF for ; Fri, 1 Nov 2024 16:26:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a9a628b68a7so298437966b.2 for ; Fri, 01 Nov 2024 08:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474788; x=1731079588; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DrSYNiwrHCHGEE9ONXAUiIqQj2adnt6lp+jzNlDeC0A=; b=NHm4AWLnR5WkqL1UIsqs6KDdhIOoPiWl3wT0U+EK7lre7/cgTGg9GeiyQh77nZEPV9 gvDdRnAOzlon1AMDpdW8VaDFtf9lizmb9/4CYfHK25aX1R1PCp+2Qmnh00YGkYbIaV21 B4pS/BQP/X9UrmRlxi2ghSj2SpZPh/bsFebU8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474788; x=1731079588; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DrSYNiwrHCHGEE9ONXAUiIqQj2adnt6lp+jzNlDeC0A=; b=M3OguIOIVafXzKzGluhhb8YWF8ZfysTOpiWqJgUcFbQZupmwLzJP1ezORUfvJWTJpK Qom14pptCFYOZzpBbNzEgB6ICBUs4Tt7Bfc0HC4wohNHhQjRHq9c6BtL2duVXQ72Xbrc dlmfrrhMKilN/tUkxE/AXrrDbBxdo/p03Y6GKzJ1l+p7obQJ+AwaO4D45BSQFjQoViuT lNtXL3DmCH+9HygTbTKZC+xARP5A1rQd3vM/iiLAItSN1leRZAYwpPC9PZZFtcDMDHl7 c5rOP1XXvL42GQeZ5HjuaYIhHL8VdFi3FmwhLxhStyUrld8uE3A0chfkVp0pKwMBNoU6 sKuw== X-Gm-Message-State: AOJu0YxhYOCAK6BtAXX7Xhy7DOK6Ugl6W+TRY2wN8GupMsLcro0dDGuk D7p80k49ZniMOZ4P1b10xrb9+oGxiSwCnYkT9y2wFypWi+shnxI6CxU5bP4XQ/1g7DaIz14ZHhK ZU+nA X-Google-Smtp-Source: AGHT+IGC9i7GLvRbKbvoqQ3qw600maPcr0XZC6wp37AekUmU0ycNAdjTaZGYrMB2kQ4/X0E8UUh7Tg== X-Received: by 2002:a17:907:25c1:b0:a9a:a5a:1d47 with SMTP id a640c23a62f3a-a9e65490e39mr407960466b.2.1730474788023; Fri, 01 Nov 2024 08:26:28 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:26 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Caleb Connolly , Mark Kettenis , Masahisa Kojima , Mattijs Korpershoek , Shantur Rathore , =?utf-8?q?Vincent_Stehl=C3=A9?= Subject: [PATCH v9 04/11] efi: Move default filename to a function Date: Fri, 1 Nov 2024 16:26:02 +0100 Message-ID: <20241101152614.238747-5-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Use a function to obtain the device EFI filename, so that we can control how sandbox behaves. Signed-off-by: Simon Glass --- (no changes since v9) Changes in v9: - Move the function into efi_helper.c Changes in v8: - Add new patch to move default filename to a function boot/bootmeth_efi.c | 4 +-- include/efi.h | 9 ++++++ include/efi_default_filename.h | 56 ---------------------------------- lib/efi_loader/efi_bootmgr.c | 10 ++++-- lib/efi_loader/efi_helper.c | 45 +++++++++++++++++++++++++++ test/boot/bootflow.c | 7 +++-- 6 files changed, 67 insertions(+), 64 deletions(-) delete mode 100644 include/efi_default_filename.h diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c index 2ad6d3b4ace..371b36d550b 100644 --- a/boot/bootmeth_efi.c +++ b/boot/bootmeth_efi.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -168,7 +168,7 @@ static int distro_efi_try_bootflow_files(struct udevice *dev, } strcpy(fname, EFI_DIRNAME); - strcat(fname, BOOTEFI_NAME); + strcat(fname, efi_get_basename()); if (bflow->blk) desc = dev_get_uclass_plat(bflow->blk); diff --git a/include/efi.h b/include/efi.h index f7419b80d4d..fef88e9c5d6 100644 --- a/include/efi.h +++ b/include/efi.h @@ -670,4 +670,13 @@ int efi_get_mmap(struct efi_mem_desc **descp, int *sizep, uint *keyp, */ void efi_show_tables(struct efi_system_table *systab); +/** + * efi_get_basename() - Get the default filename to use when loading + * + * E.g. this function returns BOOTAA64.EFI for an aarch target + * + * Return: Default EFI filename + */ +const char *efi_get_basename(void); + #endif /* _LINUX_EFI_H */ diff --git a/include/efi_default_filename.h b/include/efi_default_filename.h deleted file mode 100644 index 77932984b55..00000000000 --- a/include/efi_default_filename.h +++ /dev/null @@ -1,56 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * When a boot option does not provide a file path the EFI file to be - * booted is \EFI\BOOT\$(BOOTEFI_NAME).EFI. The architecture specific - * file name is defined in this include. - * - * Copyright (c) 2022, Heinrich Schuchardt - * Copyright (c) 2022, Linaro Limited - */ - -#ifndef _EFI_DEFAULT_FILENAME_H -#define _EFI_DEFAULT_FILENAME_H - -#include - -#undef BOOTEFI_NAME - -#ifdef CONFIG_SANDBOX - -#if HOST_ARCH == HOST_ARCH_X86_64 -#define BOOTEFI_NAME "BOOTX64.EFI" -#elif HOST_ARCH == HOST_ARCH_X86 -#define BOOTEFI_NAME "BOOTIA32.EFI" -#elif HOST_ARCH == HOST_ARCH_AARCH64 -#define BOOTEFI_NAME "BOOTAA64.EFI" -#elif HOST_ARCH == HOST_ARCH_ARM -#define BOOTEFI_NAME "BOOTARM.EFI" -#elif HOST_ARCH == HOST_ARCH_RISCV32 -#define BOOTEFI_NAME "BOOTRISCV32.EFI" -#elif HOST_ARCH == HOST_ARCH_RISCV64 -#define BOOTEFI_NAME "BOOTRISCV64.EFI" -#else -#error Unsupported UEFI architecture -#endif - -#else - -#if defined(CONFIG_ARM64) -#define BOOTEFI_NAME "BOOTAA64.EFI" -#elif defined(CONFIG_ARM) -#define BOOTEFI_NAME "BOOTARM.EFI" -#elif defined(CONFIG_X86_64) -#define BOOTEFI_NAME "BOOTX64.EFI" -#elif defined(CONFIG_X86) -#define BOOTEFI_NAME "BOOTIA32.EFI" -#elif defined(CONFIG_ARCH_RV32I) -#define BOOTEFI_NAME "BOOTRISCV32.EFI" -#elif defined(CONFIG_ARCH_RV64I) -#define BOOTEFI_NAME "BOOTRISCV64.EFI" -#else -#error Unsupported UEFI architecture -#endif - -#endif - -#endif diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index 431a38704e9..2ea20909491 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -11,10 +11,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include @@ -82,8 +82,12 @@ struct efi_device_path *expand_media_path(struct efi_device_path *device_path) &efi_simple_file_system_protocol_guid, &rem); if (handle) { if (rem->type == DEVICE_PATH_TYPE_END) { - full_path = efi_dp_from_file(device_path, - "/EFI/BOOT/" BOOTEFI_NAME); + char fname[30]; + + snprintf(fname, sizeof(fname), "/EFI/BOOT/%s", + efi_get_basename()); + full_path = efi_dp_from_file(device_path, fname); + } else { full_path = efi_dp_dup(device_path); } diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index 00167bd2a10..51e0c4852c5 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -12,18 +12,63 @@ #include #include #include +#include #include #include #include #include +#include #include #include +#ifdef CONFIG_SANDBOX + +#if HOST_ARCH == HOST_ARCH_X86_64 +#define BOOTEFI_NAME "BOOTX64.EFI" +#elif HOST_ARCH == HOST_ARCH_X86 +#define BOOTEFI_NAME "BOOTIA32.EFI" +#elif HOST_ARCH == HOST_ARCH_AARCH64 +#define BOOTEFI_NAME "BOOTAA64.EFI" +#elif HOST_ARCH == HOST_ARCH_ARM +#define BOOTEFI_NAME "BOOTARM.EFI" +#elif HOST_ARCH == HOST_ARCH_RISCV32 +#define BOOTEFI_NAME "BOOTRISCV32.EFI" +#elif HOST_ARCH == HOST_ARCH_RISCV64 +#define BOOTEFI_NAME "BOOTRISCV64.EFI" +#else +#error Unsupported UEFI architecture +#endif + +#else + +#if defined(CONFIG_ARM64) +#define BOOTEFI_NAME "BOOTAA64.EFI" +#elif defined(CONFIG_ARM) +#define BOOTEFI_NAME "BOOTARM.EFI" +#elif defined(CONFIG_X86_64) +#define BOOTEFI_NAME "BOOTX64.EFI" +#elif defined(CONFIG_X86) +#define BOOTEFI_NAME "BOOTIA32.EFI" +#elif defined(CONFIG_ARCH_RV32I) +#define BOOTEFI_NAME "BOOTRISCV32.EFI" +#elif defined(CONFIG_ARCH_RV64I) +#define BOOTEFI_NAME "BOOTRISCV64.EFI" +#else +#error Unsupported UEFI architecture +#endif + +#endif + #if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_LOAD_FILE2_INITRD) /* GUID used by Linux to identify the LoadFile2 protocol with the initrd */ const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID; #endif +const char *efi_get_basename(void) +{ + return BOOTEFI_NAME; +} + /** * efi_create_current_boot_var() - Return Boot#### name were #### is replaced by * the value of BootCurrent diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 841729bd1ac..7cfb217088e 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #ifdef CONFIG_SANDBOX #include @@ -184,8 +184,9 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts) ut_assert_nextline(" 3 efi media mmc 0 mmc1.bootdev.whole "); ut_assert_nextline(" ** No partition found, err=-2: No such file or directory"); ut_assert_nextline(" 4 extlinux ready mmc 1 mmc1.bootdev.part_1 /extlinux/extlinux.conf"); - ut_assert_nextline(" 5 efi fs mmc 1 mmc1.bootdev.part_1 /EFI/BOOT/" - BOOTEFI_NAME); + ut_assert_nextline( + " 5 efi fs mmc 1 mmc1.bootdev.part_1 /EFI/BOOT/%s", + efi_get_basename()); ut_assert_skip_to_line("Scanning bootdev 'mmc0.bootdev':"); ut_assert_skip_to_line( From patchwork Fri Nov 1 15:26:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005194 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=WRBvJ8eM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4VB6G4Kz1xwc for ; Sat, 2 Nov 2024 02:27:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E48F892F0; Fri, 1 Nov 2024 16:26:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="WRBvJ8eM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5231688606; Fri, 1 Nov 2024 16:26:33 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) (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 0B5E288E35 for ; Fri, 1 Nov 2024 16:26:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-539f58c68c5so4044975e87.3 for ; Fri, 01 Nov 2024 08:26:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474790; x=1731079590; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9/wuUET+lDOr1W47NyYJfWs7DKXW+VnrX8vcrxG7pQs=; b=WRBvJ8eMJcUyUq16W59ghJYd977DmD5VsdB7VnMzNqSOFjfWLZ6AowVHlgMNBnsMlC nOhpCkGfsbQnq99eFIXrgw49NubM/oHiEGK+AjhyF/ynMBcH233aIYG0BJhBuAWb8IQy f2JVwHAShYpoQD4Ssu0SdTT4+VWRSYDmBzvPE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474790; x=1731079590; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9/wuUET+lDOr1W47NyYJfWs7DKXW+VnrX8vcrxG7pQs=; b=aqKnDHYlE3/Y8PAsJxUA2lWg/colW71YXVK65DDyRWlPS1wxIv31+TZ5ydTna2k1qf SQ3BPn5sp9qcjV9Eugk4+q4eOGcztQ+m85Mk0bilIR+7BiRDFh9HJYqhVpk9mDMhkME6 r5ipX4NajFLvb+ov5E34hw6nphmyXTvSDGGuNleX0OVMnr0RTE+1JsKsGDW4jP2vgzLI VDsDXUrbPNtF9xosw2O4JN0w7Tp+AfaqLwrt8IRCVEXW56Awlm1hMcjhs9l+fZ0xOZq7 1iMKeulKLTUbn6hM6nsFfQqSkU6Cm0RGEuBxNrLmNWlUdb165htFr8ITQXYfXz5Ja4TG IB9A== X-Gm-Message-State: AOJu0YxEXztnDoZVWmADB3Limiyddsy3gZlleHcz+hIC6LG4l9PCO7lo zFELmjN2nLtZ3ACDgvKFBVjWnFDmWWOISzfF07GSeK7u9XjLsJjLb3uvEDsFzjtQ/8EvzNugKnI vLRSO X-Google-Smtp-Source: AGHT+IEXr+Vi5/R97m/H2BzF526okO5Zxhi/UCuzjrUnE/AgolKBYv0m62szNyWYS3T3kcL0Htjylw== X-Received: by 2002:a05:6512:10cc:b0:52e:fa5f:b6a7 with SMTP id 2adb3069b0e04-53d65de3310mr3683976e87.13.1730474789700; Fri, 01 Nov 2024 08:26:29 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Caleb Connolly , Mark Kettenis , Masahisa Kojima , Mattijs Korpershoek , Shantur Rathore , =?utf-8?q?Vincent_Stehl=C3=A9?= Subject: [PATCH v9 05/11] efi_loader: Move get_efi_pxe_arch() to efi_helper Date: Fri, 1 Nov 2024 16:26:03 +0100 Message-ID: <20241101152614.238747-6-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Move this function from the EFI bootmeth to the common efi_helper file. No functional change is intended. Signed-off-by: Simon Glass --- (no changes since v9) Changes in v9: - Split out into a separate change boot/bootmeth_efi.c | 25 ++----------------------- include/efi.h | 10 ++++++++++ lib/efi_loader/efi_helper.c | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c index 371b36d550b..f836aa655f5 100644 --- a/boot/bootmeth_efi.c +++ b/boot/bootmeth_efi.c @@ -25,32 +25,11 @@ #define EFI_DIRNAME "/EFI/BOOT/" -static int get_efi_pxe_arch(void) -{ - /* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */ - if (IS_ENABLED(CONFIG_ARM64)) - return 0xb; - else if (IS_ENABLED(CONFIG_ARM)) - return 0xa; - else if (IS_ENABLED(CONFIG_X86_64)) - return 0x6; - else if (IS_ENABLED(CONFIG_X86)) - return 0x7; - else if (IS_ENABLED(CONFIG_ARCH_RV32I)) - return 0x19; - else if (IS_ENABLED(CONFIG_ARCH_RV64I)) - return 0x1b; - else if (IS_ENABLED(CONFIG_SANDBOX)) - return 0; /* not used */ - - return -EINVAL; -} - static int get_efi_pxe_vci(char *str, int max_len) { int ret; - ret = get_efi_pxe_arch(); + ret = efi_get_pxe_arch(); if (ret < 0) return ret; @@ -239,7 +218,7 @@ static int distro_efi_read_bootflow_net(struct bootflow *bflow) ret = get_efi_pxe_vci(str, sizeof(str)); if (ret) return log_msg_ret("vci", ret); - ret = get_efi_pxe_arch(); + ret = efi_get_pxe_arch(); if (ret < 0) return log_msg_ret("arc", ret); arch = ret; diff --git a/include/efi.h b/include/efi.h index fef88e9c5d6..633f5b4acb5 100644 --- a/include/efi.h +++ b/include/efi.h @@ -679,4 +679,14 @@ void efi_show_tables(struct efi_system_table *systab); */ const char *efi_get_basename(void); +/** + * efi_get_pxe_arch() - Get the architecture value for PXE + * + * See: + * http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml + * + * Return: Architecture value + */ +int efi_get_pxe_arch(void); + #endif /* _LINUX_EFI_H */ diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index 51e0c4852c5..b8ece1c2e0c 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -21,6 +21,8 @@ #include #include +#undef BOOTEFI_NAME + #ifdef CONFIG_SANDBOX #if HOST_ARCH == HOST_ARCH_X86_64 @@ -69,6 +71,27 @@ const char *efi_get_basename(void) return BOOTEFI_NAME; } +int efi_get_pxe_arch(void) +{ + /* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */ + if (IS_ENABLED(CONFIG_ARM64)) + return 0xb; + else if (IS_ENABLED(CONFIG_ARM)) + return 0xa; + else if (IS_ENABLED(CONFIG_X86_64)) + return 0x6; + else if (IS_ENABLED(CONFIG_X86)) + return 0x7; + else if (IS_ENABLED(CONFIG_ARCH_RV32I)) + return 0x19; + else if (IS_ENABLED(CONFIG_ARCH_RV64I)) + return 0x1b; + else if (IS_ENABLED(CONFIG_SANDBOX)) + return 0; /* not used */ + + return -EINVAL; +} + /** * efi_create_current_boot_var() - Return Boot#### name were #### is replaced by * the value of BootCurrent From patchwork Fri Nov 1 15:26:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005195 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=aqXm793x; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4VP47NPz1xwc for ; Sat, 2 Nov 2024 02:27:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C1C86892CE; Fri, 1 Nov 2024 16:26:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="aqXm793x"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 54B3E892E6; Fri, 1 Nov 2024 16:26:35 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (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 7B70889300 for ; Fri, 1 Nov 2024 16:26:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a99cc265e0aso324827266b.3 for ; Fri, 01 Nov 2024 08:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474791; x=1731079591; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Otig4MT+7NE5EvZ3Wb6FUNyd4tXoWuPjhCR+dMjmZgI=; b=aqXm793xukan1/V990JshnhYTO06v9HYKK/GSkmEd+mSaJ6GyYQdpXchMV4RgWCZI+ crgUFl1D064nL8KKTR4fuKcSjgOn6+h6Ze58/kKpIvsD1235Nib/PdLDEsljiV/D7aAB dlMGiuI19Fshbsw48gFS++4Nqld6iQmn83GHE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474791; x=1731079591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Otig4MT+7NE5EvZ3Wb6FUNyd4tXoWuPjhCR+dMjmZgI=; b=BM59k7+0JSNgJ8JEP66sqxq+erdQ7Yg5iQDOjH0lH9vR7HGeVpeg5hikps6/le604z VBuA3wCenFNAFZEU43TGVX+Exdu5l/pF43OBpAP0H04980bEB6T8RrJJWls8JqaMf0A5 LZU1nApFYViAFywURMv4HNdpqP1fUe/t87ZxQtVBi6chGryHo8ULJNiJtGMDn8zRvj/4 6yD7JumUY7QfniXf8gkavB27FFRw4tyrjGzKUkfN8eJe/1bi+5kt/aMGNqm4ub3283wp J7x1rqje/10iaTSIVbfMQ40RksK1LlZEtWuBJVTVYgoh+A9CkOzzySoddnYPKS0CiiAI RQbQ== X-Gm-Message-State: AOJu0YxR2DQdJvra+hDO4KV5BErR+MwlSlO2limr1yubSIUQqZjpM/tI M9/WR6R3AalEhx/YDn9lb6TqPiXy6EpV0JyCP3HqRJ7g43yCXseqkP2xL2Jwg/+FblT7y4auT1h sqDOz X-Google-Smtp-Source: AGHT+IHrS9pCjGa6W/NmkWbMyO7xDrL9UtpDiZnfjf1xcrfcHQw7g4FNKGY498y4/p0+MRC1qoWsbA== X-Received: by 2002:a17:907:97cb:b0:a99:92d3:7171 with SMTP id a640c23a62f3a-a9de63327dbmr2272541366b.61.1730474791400; Fri, 01 Nov 2024 08:26:31 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Masahisa Kojima Subject: [PATCH v9 06/11] efi_loader: Allow reporting the host defaults Date: Fri, 1 Nov 2024 16:26:04 +0100 Message-ID: <20241101152614.238747-7-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Add an 'efidebug filename' command to report the default filename and PXE architecture. Signed-off-by: Simon Glass --- (no changes since v9) Changes in v9: - Split out into its own patch Changes in v8: - Add new patch to report host default-filename in native mode cmd/efidebug.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cmd/efidebug.c b/cmd/efidebug.c index bba984b2b75..ff6d118876d 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -536,6 +536,27 @@ static int do_efi_show_log(struct cmd_tbl *cmdtp, int flag, return CMD_RET_FAILURE; } + return 0; +} + +/** + * do_efi_show_defaults() - show UEFI default filename and PXE architecture + * + * @cmdtp: Command table + * @flag: Command flag + * @argc: Number of arguments + * @argv: Argument array + * Return: CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure + * + * Implement efidebug "defaults" sub-command. + * Shows the default EFI filename and PXE architecture + */ +static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag, + int argc, char *const argv[]) +{ + printf("Default boot path: EFI\\BOOT\\%s\n", efi_get_basename()); + printf("PXE arch: 0x%02x\n", efi_get_pxe_arch()); + return CMD_RET_SUCCESS; } @@ -1589,6 +1610,8 @@ static struct cmd_tbl cmd_efidebug_sub[] = { "", ""), U_BOOT_CMD_MKENT(dh, CONFIG_SYS_MAXARGS, 1, do_efi_show_handles, "", ""), + U_BOOT_CMD_MKENT(defaults, CONFIG_SYS_MAXARGS, 1, do_efi_show_defaults, + "", ""), U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images, "", ""), U_BOOT_CMD_MKENT(log, CONFIG_SYS_MAXARGS, 1, do_efi_show_log, "", ""), @@ -1688,6 +1711,8 @@ U_BOOT_LONGHELP(efidebug, " - show UEFI drivers\n" "efidebug dh\n" " - show UEFI handles\n" + "efidebug defaults\n" + " - show default EFI filename and PXE architecture\n" "efidebug images\n" " - show loaded images\n" "efidebug log\n" From patchwork Fri Nov 1 15:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005196 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=etcMYYFC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4Vb5cQmz1xwc for ; Sat, 2 Nov 2024 02:27:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 24AF9892EA; Fri, 1 Nov 2024 16:26:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="etcMYYFC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2473789301; Fri, 1 Nov 2024 16:26:37 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (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 DC7C588606 for ; Fri, 1 Nov 2024 16:26:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a93c1cc74fdso285200966b.3 for ; Fri, 01 Nov 2024 08:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474793; x=1731079593; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YI+V/ztQgHnzvzla7o6fXvbMDxKa/O/Qph3dpr60HGQ=; b=etcMYYFCcvguoE4BQeQbnD6stawi5iFay2P+LKESbks6NzUEfHXjr/ssN43aBAJidM alL05Oq9PTwbp/haN2Lif8dG1PWywC1yIM5GknXdKlgButRtDpO9PZ3VaJrB6BdLVQbk HEDO8vKqbBiHQvTZu5ARi/YZFuIjdqaefJnOI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474793; x=1731079593; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YI+V/ztQgHnzvzla7o6fXvbMDxKa/O/Qph3dpr60HGQ=; b=p+xMjyp081XrSh+7g9urNrvGsoURYVO3TwsN7NdiCX+qSlf4VU4OtCXUE8Mo/MwqEY xcyC8uAstOqVqL51Yt8thXBza3wcj3A1A8rVlSOfLeD0bKTSesbkucAV/dKmxyoXjOrh xhses+OxeOwJB3KP+hwFr2pefyHzp8eMZ4FBb7DGfYqcMxP8qE92nPneTLde+LJj4kCD rLNRDa+Gt0+dZTh27RhzbS6PqZ9Nz/iRrVaALGMYfscLZZZSf41caiZkhHpnmEQXUVxg 2OYZu9Zx/caGGf36Kb6F1/3elTI+xrnyn5zxu5u1tEjcrRYuenAvUdnQ0n9yhtq7/WUQ XxIg== X-Gm-Message-State: AOJu0YxAklzXo3U8TCPpKrkmtRXAvRI+B9x1/SRJgDBJyJj3sq5DFYKC gRb6zGVsJOJ+QnMUkcsJWSH2G4nnSbu4LMn1tUkuDNgiYq6LnnSXKIqgMEmd/UxgUj/8Wyy8xLt PYV6P X-Google-Smtp-Source: AGHT+IG6jmZKsqWfLwqxo+wivHBA9aNRD4ijtxku05Nr0nZEtVheBurOX3F03tCUyb1qfeckgRpKzw== X-Received: by 2002:a17:906:c145:b0:a80:f840:9004 with SMTP id a640c23a62f3a-a9e6553bf86mr394656366b.12.1730474792889; Fri, 01 Nov 2024 08:26:32 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Caleb Connolly , Mark Kettenis , Masahisa Kojima , Sughosh Ganu , =?utf-8?q?Vincent_Stehl=C3=A9?= Subject: [PATCH v9 07/11] sandbox: Report host default-filename in native mode Date: Fri, 1 Nov 2024 16:26:05 +0100 Message-ID: <20241101152614.238747-8-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean When the --native flag is given, pretend to be running the host architecture rather than sandbox. Allow the same control for PXE too. Signed-off-by: Simon Glass --- (no changes since v9) Changes in v9: - Separate into separate patches Changes in v8: - Add new patch to report host default-filename in native mode include/efi.h | 15 +++++++++++++++ lib/efi_loader/efi_helper.c | 35 ++++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/include/efi.h b/include/efi.h index 633f5b4acb5..817bc56c835 100644 --- a/include/efi.h +++ b/include/efi.h @@ -679,6 +679,21 @@ void efi_show_tables(struct efi_system_table *systab); */ const char *efi_get_basename(void); +#ifdef CONFIG_SANDBOX +#include +#endif + +static inline bool efi_use_host_arch(void) +{ +#ifdef CONFIG_SANDBOX + struct sandbox_state *state = state_get_current(); + + return state->native; +#else + return false; +#endif +} + /** * efi_get_pxe_arch() - Get the architecture value for PXE * diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index b8ece1c2e0c..ab5678eb66c 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -23,27 +23,31 @@ #undef BOOTEFI_NAME -#ifdef CONFIG_SANDBOX - #if HOST_ARCH == HOST_ARCH_X86_64 -#define BOOTEFI_NAME "BOOTX64.EFI" +#define HOST_BOOTEFI_NAME "BOOTX64.EFI" +#define HOST_PXE_ARCH 0x6 #elif HOST_ARCH == HOST_ARCH_X86 -#define BOOTEFI_NAME "BOOTIA32.EFI" +#define HOST_BOOTEFI_NAME "BOOTIA32.EFI" +#define HOST_PXE_ARCH 0x7 #elif HOST_ARCH == HOST_ARCH_AARCH64 -#define BOOTEFI_NAME "BOOTAA64.EFI" +#define HOST_BOOTEFI_NAME "BOOTAA64.EFI" +#define HOST_PXE_ARCH 0xb #elif HOST_ARCH == HOST_ARCH_ARM -#define BOOTEFI_NAME "BOOTARM.EFI" +#define HOST_BOOTEFI_NAME "BOOTARM.EFI" +#define HOST_PXE_ARCH 0xa #elif HOST_ARCH == HOST_ARCH_RISCV32 -#define BOOTEFI_NAME "BOOTRISCV32.EFI" +#define HOST_BOOTEFI_NAME "BOOTRISCV32.EFI" +#define HOST_PXE_ARCH 0x19 #elif HOST_ARCH == HOST_ARCH_RISCV64 -#define BOOTEFI_NAME "BOOTRISCV64.EFI" +#define HOST_BOOTEFI_NAME "BOOTRISCV64.EFI" +#define HOST_PXE_ARCH 0x1b #else -#error Unsupported UEFI architecture +#error Unsupported Host architecture #endif -#else - -#if defined(CONFIG_ARM64) +#if defined(CONFIG_SANDBOX) +#define BOOTEFI_NAME "BOOTSBOX.EFI" +#elif defined(CONFIG_ARM64) #define BOOTEFI_NAME "BOOTAA64.EFI" #elif defined(CONFIG_ARM) #define BOOTEFI_NAME "BOOTARM.EFI" @@ -59,8 +63,6 @@ #error Unsupported UEFI architecture #endif -#endif - #if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_LOAD_FILE2_INITRD) /* GUID used by Linux to identify the LoadFile2 protocol with the initrd */ const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID; @@ -68,11 +70,14 @@ const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID; const char *efi_get_basename(void) { - return BOOTEFI_NAME; + return efi_use_host_arch() ? HOST_BOOTEFI_NAME : BOOTEFI_NAME; } int efi_get_pxe_arch(void) { + if (efi_use_host_arch()) + return HOST_PXE_ARCH; + /* http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xml */ if (IS_ENABLED(CONFIG_ARM64)) return 0xb; From patchwork Fri Nov 1 15:26:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005197 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=iN6jckzZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4Vn2DfWz1xwc for ; Sat, 2 Nov 2024 02:27:45 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8CD8B89308; Fri, 1 Nov 2024 16:26:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="iN6jckzZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 62FE5892CF; Fri, 1 Nov 2024 16:26:37 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (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 8103089305 for ; Fri, 1 Nov 2024 16:26:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5cec831fcafso166931a12.0 for ; Fri, 01 Nov 2024 08:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474794; x=1731079594; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nBfnH7LRa1wmXlnGKLPlGvt83UHs5xbCaYXMlmnt34g=; b=iN6jckzZ40zdmPoAVvtrd4SEzpIutYbtRCA8juJeLJGyZeZ21lFe29DPtKm48smtUj VbYk4ZMl45CLF3HeG2K+azQFNuG0ELL17B5l8wLVVViYiT0eUhMSCEPczdmTPma9v10h pR7B9poDeVFcuhf2Nvmf6P58tvPIkKnETVK94= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474794; x=1731079594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nBfnH7LRa1wmXlnGKLPlGvt83UHs5xbCaYXMlmnt34g=; b=FiCIKSWP6GsAUm0S8EdbRwfjiSn2CjCK7TONdI65pD/wqlVUtuTaFsVHE0b6xdfx8a iiOLwmZn1DmQZ8iPvVFVmTV3lVHvLE9/HrtONMGO5Tr1oVxNf+0DSnG1ZNC+qQeDj7U1 xMAyABegI0OZqosj1ZamII8LdTk6gSfuuyuWCmLLQ1uR5NT/KVpCAd9sutScN9bpqwyE GXopNf1OynGNEZv5diVPGU3ZhVzw83enDMhn1tNZZEHS7Ti3JhzTC0s+QWfwBjEuymwq RnoRSgg/w1KNNQAVRDxxZRMhBozBoKPXz8cCC8Hgw9hdtcEvQhfNHyp6L4X8HlMSeBce KzKg== X-Gm-Message-State: AOJu0YyDJmOPvOj5HTjHcs6faHX13uBC61OM01RAwHazvSF1bRstThwU X9El/amOJz/TYUaMOpLa0+d46Rp48hpJWdC/v0bBsXCAKEf9eTW0PuHtPhWje4pjK663yTKi/FF vxLmB X-Google-Smtp-Source: AGHT+IEZYqBVH8gAbTY3tTTI+qbVrG1yvKw6jeb5XdjRs5mtjObn/M5ZDmzCc6YwtXt6n+J4oJ5WEg== X-Received: by 2002:a17:907:3d90:b0:a9a:26dd:16bc with SMTP id a640c23a62f3a-a9de5c91003mr2506834766b.5.1730474793814; Fri, 01 Nov 2024 08:26:33 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:33 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Mark Kettenis , Masahisa Kojima , Sughosh Ganu Subject: [PATCH v9 08/11] efi_loader: Drop sandbox PXE architecture Date: Fri, 1 Nov 2024 16:26:06 +0100 Message-ID: <20241101152614.238747-9-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Rather than returning 0, just return an error, since sandbox is not used with PXE at present. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- (no changes since v9) Changes in v9: - Add new patch to drop sandbox PXE architecture lib/efi_loader/efi_helper.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index ab5678eb66c..bf96f61d3d0 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -91,8 +91,6 @@ int efi_get_pxe_arch(void) return 0x19; else if (IS_ENABLED(CONFIG_ARCH_RV64I)) return 0x1b; - else if (IS_ENABLED(CONFIG_SANDBOX)) - return 0; /* not used */ return -EINVAL; } From patchwork Fri Nov 1 15:26:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005198 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=cGAOmad0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4Vy1ZZcz1xwc for ; Sat, 2 Nov 2024 02:27:54 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 44FD08931F; Fri, 1 Nov 2024 16:26:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="cGAOmad0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C90E288E35; Fri, 1 Nov 2024 16:26:39 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) (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 1857F892FF for ; Fri, 1 Nov 2024 16:26:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5c95a962c2bso2681319a12.2 for ; Fri, 01 Nov 2024 08:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474796; x=1731079596; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kzWagHBBz3KBiquXdYdA9F9aQZ11VSxRtZTZmBlZBms=; b=cGAOmad0vZx0MiKd1AcoxW0J5iKrvH+iOEJzKmfjXiRCVT6JF318/j6Tb/OhqEb1sT +myNU1bVg3pw8dosD7yb5xnK2wyvybtzxk/K83dVRhEFxIUkL2uOSJklTQveF9WKEcKR AVqVmvaK/u1ljiQesRCOQwjM4zqKaAoYphIDk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474796; x=1731079596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kzWagHBBz3KBiquXdYdA9F9aQZ11VSxRtZTZmBlZBms=; b=DtuVXtjosAPxFssPJlYNtLTzYTREE4v2XOWkT1IUg2mE+u6c0gjEN1tHCFAcb/709v v2+3RJ5GuUlXaeJzY3zzfVWuPsjTiVUfuzAHEpUf4+45funWIMbeE/1ZhMeq2uddPT8e ikJ7E+H9TObMXNP1HbxUo3aLUulFA77id3aQtdheYHxqgzjj/4LRFSSnzNFv2R60moqE GxwT5cmNhgF2j1qwxCohhv4mbcqN4zXR/ZVs5HsCfOk24YaJHCjocKOxjoRrw9bNSEwJ UJa3jYcxiund1jRc3wYfCIWgCG/92oOKcAhBrhyCthWuIJKppPfVEaPMTnsZ5ry0C0fl pkWw== X-Gm-Message-State: AOJu0YxKr9sMvgA/eC+bAgS+hcofnuI03Gu5a8S31hp8ACwSxP/NjhJq FGreA+D6LecSx6xvQWns7s6Kc5s/yzg+Lpp7+kQ2H29kqgQi1GcG+ut2XimtJdnwZKkaVa7NfTD iRCwd X-Google-Smtp-Source: AGHT+IFQX98BqvIUbmiv8wcX/iYLEDp9ohBer/HaMIbzQ91jDV6HIe7QI9MSpazX+DT5hM72S76E2A== X-Received: by 2002:a17:907:7e84:b0:a9a:123d:3f1a with SMTP id a640c23a62f3a-a9e508d4af3mr631619866b.17.1730474796073; Fri, 01 Nov 2024 08:26:36 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , Dan Carpenter , Jiaxun Yang Subject: [PATCH v9 09/11] sandbox: virtio: Disable the sandbox virtio blk device Date: Fri, 1 Nov 2024 16:26:07 +0100 Message-ID: <20241101152614.238747-10-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean This is not implemented so cannot actually be used to read blocks. Disable it until it is implemented, to avoid causing a hang with EFI, which probes every available BLK device. Signed-off-by: Simon Glass Reviewed-by: Tom Rini Issue: https://source.denx.de/u-boot/u-boot/-/issues/37 --- (no changes since v6) Changes in v6: - Drop the patch to disable sandbox virtio blk with EFI - Add new patch to disable the sandbox virtio blk device arch/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/Kconfig b/arch/Kconfig index 8f1f4667012..c39efb4d0a2 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -212,7 +212,8 @@ config SANDBOX imply VIRTIO_MMIO imply VIRTIO_PCI imply VIRTIO_SANDBOX - imply VIRTIO_BLK + # Re-enable this when fully implemented + # imply VIRTIO_BLK imply VIRTIO_NET imply DM_SOUND imply PCI_SANDBOX_EP From patchwork Fri Nov 1 15:26:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005199 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=HZjH23XC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4W82HTDz1xwc for ; Sat, 2 Nov 2024 02:28:04 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B047289328; Fri, 1 Nov 2024 16:26:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="HZjH23XC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D0F2C89328; Fri, 1 Nov 2024 16:26:41 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (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 504F689318 for ; Fri, 1 Nov 2024 16:26:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5c9634c9160so2394369a12.2 for ; Fri, 01 Nov 2024 08:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474798; x=1731079598; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9H65k0giveLvlhzuqrS6iHDi+1WZR7CvNyRrj3qcOsw=; b=HZjH23XCXpWmPH9wIsHB/osY1ByHnXU0uwn7+qksvCwe7WxlMrxr18RdZq7PMuE6Mv vJZtH8rnupwblclW62QzGFMqhC/HVOsxW5BIcVeD876hAedNRFzlx+erSQEwwLHlTNTY v8t9rzVMjWwZI/MHBoD8tElUVMB5nCtU0dFVU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474798; x=1731079598; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9H65k0giveLvlhzuqrS6iHDi+1WZR7CvNyRrj3qcOsw=; b=f97jeRcjJVvrDLXF1KX8FGooxbWhlIKyCWVagdos3hWciINZEeQNlO2MpoMsG2fXtO 0zk55ndk8syrP/NIGtXlR1te3yBzY/2aFElOXxrW/yqoHZ9/rkMT/2qQS3/ZznhYhxIN uwqHIPDtbg0LASnq2SqtTNz/3W6Pu5FsaKS3timebjzamZ2UkKkw4sQio9LkWIOC424l ShOMgZRa+P2xan8jE6h3H4lslvLwxKL9x9ykoVV9FbR6eRr6W1HyudMjl+RH76MsaXxc KFZz9/BiR8//K7iz9POYUyPX83QX3dhEAs1A6Mh1QFzMa0YQr9Ddh2FARm1gbMEp59vh Mlig== X-Gm-Message-State: AOJu0Yw9eD4/T/ZIUa2n/WNrIpyzEy+LGqSPmqYOObHSPcpXuNqwgG+U v1N9OilhemxhA2ADnxf4fF6kxAfWrmgR8Om7ySvaBwInhDSSbcY8sc5E/ZydsglsQgSiz0+17tA EGh+L X-Google-Smtp-Source: AGHT+IGkj18Lcn82SnmYlYLHSVNPj24fdK7dX70r+yjr18/HL3voFOBrvjwf1hoxu2kCGcvAMThOCA== X-Received: by 2002:a17:907:7e8b:b0:a8d:2faf:d33d with SMTP id a640c23a62f3a-a9de5d6f1ecmr2351360766b.9.1730474797676; Fri, 01 Nov 2024 08:26:37 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:36 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Algapally Santosh Sagar , Caleb Connolly , Christian Marangi , Francis Laniel , Guillaume La Roque , Jerome Forissier , Julien Masson , Marek Vasut , Mattijs Korpershoek , Patrick Rudolph , Sean Anderson , Sughosh Ganu , Yang Xiwen Subject: [PATCH v9 10/11] test: efi: boot: Set up an image suitable for EFI testing Date: Fri, 1 Nov 2024 16:26:08 +0100 Message-ID: <20241101152614.238747-11-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Create a new disk for use with tests, which contains the new 'testapp' EFI app specifically intended for testing the EFI loader. Attach it to the USB device, since most testing is currently done with mmc. Initially this image will be used to test the EFI bootmeth. Fix a stale comment in prep_mmc_bootdev() while we are here. For now this uses sudo and a compressed fallback file, like all the other bootstd tests. Once this series is in, the patch which moves this to use user-space tools will be cleaned up and re-submitted. Signed-off-by: Simon Glass --- Here is the patch to avoid sudo and CI fallback: [1] https://patchwork.ozlabs.org/project/uboot/patch/ 20240802093322.15240-1-richard@nod.at/ (no changes since v9) Changes in v9: - Mark the image as complete after writing it arch/sandbox/dts/test.dts | 2 +- test/boot/bootdev.c | 18 +++++++++- test/boot/bootflow.c | 2 +- test/py/tests/bootstd/flash1.img.xz | Bin 0 -> 4924 bytes test/py/tests/test_ut.py | 53 ++++++++++++++++++++++++---- 5 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 test/py/tests/bootstd/flash1.img.xz diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 3017b33d67b..dee280184b1 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1515,7 +1515,7 @@ flash-stick@1 { reg = <1>; compatible = "sandbox,usb-flash"; - sandbox,filepath = "testflash1.bin"; + sandbox,filepath = "flash1.img"; }; flash-stick@2 { diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c index 369105ca4cf..c892854b227 100644 --- a/test/boot/bootdev.c +++ b/test/boot/bootdev.c @@ -221,6 +221,10 @@ static int bootdev_test_order(struct unit_test_state *uts) /* Use the environment variable to override it */ ut_assertok(env_set("boot_targets", "mmc1 mmc2 usb")); ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); + + /* get the usb device which has a backing file (flash1.img) */ + ut_asserteq(0, bootflow_scan_next(&iter, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ut_asserteq(5, iter.num_devs); ut_asserteq_str("mmc1.bootdev", iter.dev_used[0]->name); @@ -260,7 +264,11 @@ static int bootdev_test_order(struct unit_test_state *uts) ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); ut_asserteq(2, iter.num_devs); - /* Now scan past mmc1 and make sure that the 3 USB devices show up */ + /* + * Now scan past mmc1 and make sure that the 3 USB devices show up. The + * first one has a backing file so returns success + */ + ut_asserteq(0, bootflow_scan_next(&iter, &bflow)); ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ut_asserteq(6, iter.num_devs); ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); @@ -322,6 +330,10 @@ static int bootdev_test_prio(struct unit_test_state *uts) /* 3 MMC and 3 USB bootdevs: MMC should come before USB */ ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); + + /* get the usb device which has a backing file (flash1.img) */ + ut_asserteq(0, bootflow_scan_next(&iter, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ut_asserteq(6, iter.num_devs); ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); @@ -339,6 +351,10 @@ static int bootdev_test_prio(struct unit_test_state *uts) bootflow_iter_uninit(&iter); ut_assertok(bootflow_scan_first(NULL, NULL, &iter, BOOTFLOWIF_HUNT, &bflow)); + + /* get the usb device which has a backing file (flash1.img) */ + ut_asserteq(0, bootflow_scan_next(&iter, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ut_asserteq(7, iter.num_devs); ut_asserteq_str("usb_mass_storage.lun0.bootdev", diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 7cfb217088e..d7e94c8cc59 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -534,7 +534,7 @@ static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev, order[2] = mmc_dev; - /* Enable the mmc4 node since we need a second bootflow */ + /* Enable the requested mmc node since we need a second bootflow */ root = oftree_root(oftree_default()); node = ofnode_find_subnode(root, mmc_dev); ut_assert(ofnode_valid(node)); diff --git a/test/py/tests/bootstd/flash1.img.xz b/test/py/tests/bootstd/flash1.img.xz new file mode 100644 index 0000000000000000000000000000000000000000..29b78c62a9bf264fa8b795b82b432bf3ab4e2765 GIT binary patch literal 4924 zcmeI0X*d*W8^_0*H8g}6dyF*-i8PUAWUM3mp5^3V?6Qq*EN4(;8yri7vacz7wlLY5 zk|ks}H1-jicl+|b*Hzc4_dVzR)aU2Ap69v$*M0y0zw17|8fa<`08lRD>NLm!{AA|= z0D#Y>r2-O3kn)Qa0Dw3>fp$#gTZJ7`&p3FrG%i|A3T@230$3p2{8kcKY}m@*6z=4eUeY7SMOpXLyfos&tjkY1B9 ziyV5|&-HS$S#CA!H!$RW@VUFW)itlBvUXNf-JpoA78rT3R@7bP!WJo;5~ds4PO6E( zvn1wZqUU`xBK-g<6|BMZ>?C;hI8$26xcy<&Ze)17W7kDEaX(33hN`e?3-QWBN0VVB ziKV367SuRcEy7`G7QNJ++Uiltd8>WeuOe6c)38l(;qZ262eApikQeXbdU$lq5`lz9(7F+ ziIIaJ&N%q&77si&_paL$e~qIHPxiiKYC4b4kpy@25jI9v^yh`UXr^gpKkdV7PU&C| zN~Z4?(3Cr~MKrV(G6u242aWsQ2c`C|q|+-4PoZ0=wfCowa*cZ_1Po;B;(|C_d!4Pf zZyM$2W_bE%r(e@7xK1<&(PG5*vsSA~eV@H9$ayk(J0X78Wa?VeY!j2He#31U6&ibk zbJy;${?0|RAqlw(H^{uMW7gj(EN?ZW|mTt|gPG z$ZHsz{Ek&IGA1v1T9k#Zs}^d-`l`NM58Ux`EzE3RpQl>>Ir=~z3A9s}V9m1VOX z*-?$_&6wtR43a-^t0nkjuy20}8Rae#m$*metLP0*+>tL|i&(v$AQu&I?tN<$flcD! zRLz3e-9;MmN!K`Zch6hGstDO6B+n~t$$4O{9_tmEK@r0bSFgzeZZAseZGSjtdTS$) z{eD}qYtK#TK$UU%$Fz{D>JspxwpOXB^{-(8#FSAbE<9sH2ccHuofxjbgjmyC2b7bh zf!{E2^3z&BUH%MIe?Mt?2S19#69;mlDIc^Md2l#v2=RvVh&krOr>e(IENjUoO$^K2 zPGL_Qq74PSfIiaKiSix-%rV!}T5)LuLYw$by02cFiCcAeuBj{xbOBYZO0=o+)2t0IOErZ>v1+3ksz*R&=R7syRY}{K4X>I-jRPY>tgnRh zRENG%l0Z5&g-xG_5^MYAtC&JIvclB@S}}YH$y~V1i{bpE;?`>qh2}kSiUn=(U~JS# zDh7=dOWG0fJ>+bs#^_*9-&IZ|GX1A_DABC-H%4gCk>+RJ6~l!`)W)1SYB>v|e|d%fvpas>n7=q#gy)i&$;7``xUcK~ z7ya)45*uF^=37r2FhOc^NzG)+-xe$en|G*Uu{Ti6i?YvT#;#th4ox$PvK{eRa$*^| z_Sz)v$!3wqtgf{`IFk-z*nxgUySu2Po-ZJ@<1+zZ)xm3fA?2paG3}70}PNpb=l-*k7`BpNhRce~5Bwowny>UpGw#-SgwOqotR}kuzU+kP^c} zW=_}nKn7- zWQ;~#B<>$c$x|s<^ofO?Kj!{Gj0`x*{9bOc4N*q2>v);P1;WBGt9>cin&J!R53i{YUJz*(f zA=iRkc*&P+*lnCZb>hl?3nC}`d;5#ILI>e_+cP`T`{ec$`%XOmyU-YaXn)z8omQt_ zG+^{v6RqeKT9?4+(Cf9`Bu_#uyy^f2$&wD14@!cHs+rz%p2$PJ($X4jb`J_EzS%*- z1p|{@$?(fj7ZLaNkTk%F=%G$h5!pQz`uR*xHqq^eqH<{YL`zzN zL@L|w@SUj5l-U$tn56qfNQKdK*$$8$MTjzw^smL{fname}']) def setup_bootmenu_image(cons): @@ -549,6 +551,44 @@ def test_ut_dm_init(u_boot_console): with open(fn, 'wb') as fh: fh.write(data) + +def setup_efi_image(cons): + """Create a 20MB disk image with an EFI app on it""" + devnum = 1 + basename = 'flash' + fname, mnt = setup_image(cons, devnum, 0xc, second_part=True, + basename=basename) + + loop = None + mounted = False + complete = False + try: + loop = mount_image(cons, fname, mnt, 'ext4') + mounted = True + efi_dir = os.path.join(mnt, 'EFI') + mkdir_cond(efi_dir) + bootdir = os.path.join(efi_dir, 'BOOT') + mkdir_cond(bootdir) + efi_src = os.path.join(cons.config.build_dir, + f'lib/efi_loader/testapp.efi') + efi_dst = os.path.join(bootdir, 'BOOTSBOX.EFI') + with open(efi_src, 'rb') as inf: + with open(efi_dst, 'wb') as outf: + outf.write(inf.read()) + complete = True + except ValueError as exc: + print(f'Falled to create image, failing back to prepared copy: {exc}') + + finally: + if mounted: + u_boot_utils.run_and_log(cons, 'sudo umount --lazy %s' % mnt) + if loop: + u_boot_utils.run_and_log(cons, 'sudo losetup -d %s' % loop) + + if not complete: + copy_prepared_image(cons, devnum, fname, basename) + + @pytest.mark.buildconfigspec('cmd_bootflow') @pytest.mark.buildconfigspec('sandbox') def test_ut_dm_init_bootstd(u_boot_console): @@ -559,6 +599,7 @@ def test_ut_dm_init_bootstd(u_boot_console): setup_cedit_file(u_boot_console) setup_cros_image(u_boot_console) setup_android_image(u_boot_console) + setup_efi_image(u_boot_console) # Restart so that the new mmc1.img is picked up u_boot_console.restart_uboot() From patchwork Fri Nov 1 15:26:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2005200 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bNgHjHzz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xg4WM1gbyz1xwc for ; Sat, 2 Nov 2024 02:28:15 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2377489338; Fri, 1 Nov 2024 16:26:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="bNgHjHzz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3804389328; Fri, 1 Nov 2024 16:26:42 +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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (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 E652188606 for ; Fri, 1 Nov 2024 16:26:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a9e71401844so85025266b.3 for ; Fri, 01 Nov 2024 08:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1730474798; x=1731079598; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qHtntjWNF+7w5nj8Q8tUU/Kwixuss3EtSctRHRbjdpc=; b=bNgHjHzzXcF7uowQwvJb2ZPscO37Tn2G0hAXAzx+h0mf/xLhc/9R9cszx3eTeeE+P/ gkG6JayPfpM6izS7W89JlwrwABj1chehOMDp+CjHiNz7UfOUakUMvYKZKvRAUzv69vd8 cXrIuTg9sBLv8nGrOoma8ZtMqShtl45aP2sCk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730474798; x=1731079598; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qHtntjWNF+7w5nj8Q8tUU/Kwixuss3EtSctRHRbjdpc=; b=D+0RbSYdM4Eo0CHHeb44vL76+cj6mDpaFguchHjEug1XQXRbNmYA/O8bI62teWZrba V61MVEyvx7qUatdwbRYR8lN4Xg3DgaDwJIUfwx8Dw86LFJMAom7dlcGuGyEgXTof+C95 k2eR9li/5luSDxfPF9XR1sW/ha6CLX3w/cmfjEpM4fVwhuXDGESjWuSQQaxcdSuejIGA H/IRCk+82+owBcC/YPwbfHwv4icyegQ/dM/XQi4h9+iBk49LVBcBuum2fWHX3QNl35CO u8j6Wn8dB2cYuik2jX5f7tv1qBomDde8rj9NVm74MhQc7ic+pK11m/1G/Q8fzSflFov4 2BdA== X-Gm-Message-State: AOJu0Yz9pDtQhIIlLj9XVp7pbtwpCPoj8EfJaXfFqO5ww08W2wb84Yd+ JwXGCUbYr3OHQDOeBRVeFagrPsA7WI00oSt0AtSpvqo5KoyQy8GVh16zEZAZuj5VaEJlrhpAO2i wdr16 X-Google-Smtp-Source: AGHT+IEojdO5ogr3TafFuen9Ih+FHTeT/VrCvX7RWN3LF1vZhx4y9p0Uoom2iJF8/J03T5Jm0KpBFQ== X-Received: by 2002:a17:907:6d09:b0:a9a:122b:e545 with SMTP id a640c23a62f3a-a9e5093f0b3mr747101866b.32.1730474798572; Fri, 01 Nov 2024 08:26:38 -0700 (PDT) Received: from chromium.org ([87.215.50.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e5649454csm190269466b.8.2024.11.01.08.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 08:26:38 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Ilias Apalodimas , Heinrich Schuchardt , Simon Glass , AKASHI Takahiro , Mattijs Korpershoek Subject: [PATCH v9 11/11] test: efi: boot: Add a test for the efi bootmeth Date: Fri, 1 Nov 2024 16:26:09 +0100 Message-ID: <20241101152614.238747-12-sjg@chromium.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241101152614.238747-1-sjg@chromium.org> References: <20241101152614.238747-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Add a simple test of booting with the EFI bootmeth, which runs the app and checks that it can call 'exit boot-services' (to check that all the device-removal code doesn't break anything) and then exit back to U-Boot. This uses a disk image containing the testapp, ready for execution by sandbox when needed. Signed-off-by: Simon Glass --- Note that this uses the same mechanism as for the other images which are created. Once this series lands I will update[1] and revisit. [1] https://patchwork.ozlabs.org/project/uboot/patch/ 20240802093322.15240-1-richard@nod.at/ (no changes since v9) Changes in v9: - Fix 'sevices' typo Changes in v7: - Drop patches already applied - Drop patch 'Disable ANSI output for tests' - Rebase on -master Changes in v6: - Deal with sandbox CONFIG_LOGF_FUNC - Rebase on -next - Drop patches previously applied - Drop mention of helloworld since it is no-longer used by this test Changes in v4: - Add efi_loader tag to some patches - Split out non-EFI patches into a different series Changes in v2: - Add many new patches to resolve all the outstanding test issues test/boot/bootflow.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index d7e94c8cc59..df2caa91693 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #ifdef CONFIG_SANDBOX #include @@ -31,6 +32,9 @@ extern U_BOOT_DRIVER(bootmeth_android); extern U_BOOT_DRIVER(bootmeth_cros); extern U_BOOT_DRIVER(bootmeth_2script); +/* Use this as the vendor for EFI to tell the app to exit boot services */ +static u16 __efi_runtime_data test_vendor[] = u"U-Boot testing"; + static int inject_response(struct unit_test_state *uts) { /* @@ -1217,3 +1221,55 @@ static int bootflow_android(struct unit_test_state *uts) return 0; } BOOTSTD_TEST(bootflow_android, UTF_CONSOLE); + +/* Test EFI bootmeth */ +static int bootflow_efi(struct unit_test_state *uts) +{ + /* disable ethernet since the hunter will run dhcp */ + test_set_eth_enable(false); + + /* make USB scan without delays */ + test_set_skip_delays(true); + + bootstd_reset_usb(); + + ut_assertok(bootstd_test_drop_bootdev_order(uts)); + ut_assertok(run_command("bootflow scan", 0)); + ut_assert_skip_to_line( + "Bus usb@1: scanning bus usb@1 for devices... 5 USB Device(s) found"); + + ut_assertok(run_command("bootflow list", 0)); + + ut_assert_nextlinen("Showing all"); + ut_assert_nextlinen("Seq"); + ut_assert_nextlinen("---"); + ut_assert_nextlinen(" 0 extlinux"); + ut_assert_nextlinen( + " 1 efi ready usb_mass_ 1 usb_mass_storage.lun0.boo /EFI/BOOT/BOOTSBOX.EFI"); + ut_assert_nextlinen("---"); + ut_assert_skip_to_line("(2 bootflows, 2 valid)"); + ut_assert_console_end(); + + ut_assertok(run_command("bootflow select 1", 0)); + ut_assert_console_end(); + + systab.fw_vendor = test_vendor; + + ut_asserteq(1, run_command("bootflow boot", 0)); + ut_assert_nextline( + "** Booting bootflow 'usb_mass_storage.lun0.bootdev.part_1' with efi"); + if (IS_ENABLED(CONFIG_LOGF_FUNC)) + ut_assert_skip_to_line(" efi_run_image() Booting /\\EFI\\BOOT\\BOOTSBOX.EFI"); + else + ut_assert_skip_to_line("Booting /\\EFI\\BOOT\\BOOTSBOX.EFI"); + + /* TODO: Why the \r ? */ + ut_assert_nextline("U-Boot test app for EFI_LOADER\r"); + ut_assert_nextline("Exiting test app"); + ut_assert_nextline("Boot failed (err=-14)"); + + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(bootflow_efi, UTF_CONSOLE);