From patchwork Thu Nov 7 21:31:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008155 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=FrGy00sa; 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 4XkwJf37kLz1xyk for ; Fri, 8 Nov 2024 08:32:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 948BE88901; Thu, 7 Nov 2024 22:32:06 +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="FrGy00sa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EA53988DB2; Thu, 7 Nov 2024 22:32:05 +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.4 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-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (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 B8A9B8878A for ; Thu, 7 Nov 2024 22:32:03 +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-il1-x136.google.com with SMTP id e9e14a558f8ab-3a6bc0600f9so5647035ab.1 for ; Thu, 07 Nov 2024 13:32:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015122; x=1731619922; 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=zrE0taTI7pdVEJdlucuJEWGPP0bBZAvBX82ok3msXOE=; b=FrGy00saFfRAxGN2pg+dbcSn6KISSrrU93cFti+6gXlY6jS7NKfuPcmHW9IzcAXpgD JZ80ZCBO9VrgcD5+UJewy9B1KMpQrhToTyElSuvGGnGFcbvrvnB/Ycyh/c3aXctRsl0W mxxdp7H7U/KBzlMLO63Z20YoDvSIsBNQBMcEg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015122; x=1731619922; 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=zrE0taTI7pdVEJdlucuJEWGPP0bBZAvBX82ok3msXOE=; b=wxU+ZF7QeWrWsEnhFjzpaapBiQ7mHvu7X7+pwsJUvRBgqLFhY54p/b+zxZoQplLj6b Wn/tO/wvPhtt1wSXgj7VuYRm2r4DopFYbtC6QFHuGfFZd6su2KrQ296nYUI5z1kmR73I whCj9nWHLM/BMgw3bsdH+9VKqkjsnYCTAH4ZMNL+ed2XV656f3I1WEw4mnUInjgZaBSr EMQk1RBFih1glKuDt2Jo01ZKo66BSM5qhi3jkTblhW3HIGsKBRoKdDovbSYQnOWSOx+v xxP3vBY+w0+uvERhuCA67cT2M4ZvV/fbxTCm2ozCd+Dp1SeoGtOWZQH7SuFK4wlipXiw TPyA== X-Gm-Message-State: AOJu0YxvnTIDV0Ag/hJts6POsgHj+d4yiRqgiVmZDLqP/+Ac3I+LdcII QVzGkBgHOSS3rVhN6I1TgFUaTK2CnHTJhwdXdXNHO6/XgmdaFuN1+p7C5m6HURw/qLOLh9gpZhc = X-Google-Smtp-Source: AGHT+IEREL9cIjDlUrfGYR/UC5lSvBKwQzGCmHtG+mHQfhvaQVoPAxEIKqAQdUhOPbUba2N58xT78A== X-Received: by 2002:a92:c264:0:b0:3a6:bb77:a362 with SMTP id e9e14a558f8ab-3a6f199037bmr9698495ab.4.1731015121828; Thu, 07 Nov 2024 13:32:01 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:00 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , AKASHI Takahiro , Caleb Connolly , Michal Simek Subject: [PATCH v10 01/10] efi_loader: Add a test app Date: Thu, 7 Nov 2024 14:31:41 -0700 Message-Id: <20241107213150.1711962-2-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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 066f0ca0da7..58d49789f12 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -567,6 +567,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 00d18966f9e..87131ab911d 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 Thu Nov 7 21:31:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008156 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=dUrQ7SzR; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XkwJt3V4Zz1xxq for ; Fri, 8 Nov 2024 08:32:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E996189083; Thu, 7 Nov 2024 22:32:09 +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="dUrQ7SzR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 33E868878A; Thu, 7 Nov 2024 22:32:09 +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.4 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-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (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 12C7888E00 for ; Thu, 7 Nov 2024 22:32:07 +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-il1-x12d.google.com with SMTP id e9e14a558f8ab-3a6adaee7acso5280665ab.0 for ; Thu, 07 Nov 2024 13:32:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015125; x=1731619925; 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=wbfatyAXrs4s7Gt3G9iTgDgJAawmN4+jl1dticW00ZA=; b=dUrQ7SzRLw//c8m16D0nR2xaZoLqzhj/zujp/oq1WZrida6cQttMGvxgkNG8zpYv65 AqO2dbOxifROuKf/PNdqawC1Nom825pl9Q6XNa6EGOLSFOqB8qDi7dsef6FaeK0mQn9e Ur3uhZ2ofUAIiMBkMra8enAEKNwYM+32UAtu4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015125; x=1731619925; 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=wbfatyAXrs4s7Gt3G9iTgDgJAawmN4+jl1dticW00ZA=; b=caEdg9MCptbwpoWd9qzPg7f0rV2TK1VI0tmICPQYW6yF+CoOtXpBDK1SmYN7yuIome OvHL8aLKH2a/bqeR2gy+AmC3TyBUI7b4p/izfEK/r5qV4xwLFuHxreKj4u6TKMyhPoi/ V8OYAiwtpyEENXs7DCmskmV0JzEHLkWhvF54Z/U5GJO/LNQdRkvUyaEIeyGX0cJAHXMY yO/MEZuMgLP6QTXc6QHfhIq/ltfNN6AMPLkQE93Nh+X4E/dR/zybtcIx0+kseoEy+MUv u7oXP+Lvy7TUw9f/HWN60KaB4FRLZLHaYecPrivovq71jxN6l6DfgpwDMd6U5gNDKlUN bndg== X-Gm-Message-State: AOJu0YxeOV1npR+Jr9rV9N0wPuomkIxkuo+1JTthsbZldToGJMRqUpKp gv4xjcDCeaqw+kOqMlnK8h8wBLTHBzIdcvAsT3KGcKm2f4wnq6RL7jxCKludmhBIZB+MRbY1soA = X-Google-Smtp-Source: AGHT+IErGn1UxcGmBXRkCoGC+0S4HHZQFX50PaoI8TgHCDJgbRbhAeMe7/ST8Uvu22322s/YuzQ3RA== X-Received: by 2002:a92:ca46:0:b0:3a6:b34f:c1de with SMTP id e9e14a558f8ab-3a6f19e85aamr9225005ab.14.1731015124797; Thu, 07 Nov 2024 13:32:04 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:03 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass Subject: [PATCH v10 02/10] sandbox: Add a -N flag to control on-host behaviour Date: Thu, 7 Nov 2024 14:31:42 -0700 Message-Id: <20241107213150.1711962-3-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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 Thu Nov 7 21:31:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008157 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=d+fBmrWU; 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 4XkwK202wYz1xxq for ; Fri, 8 Nov 2024 08:32:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 50C9788B4B; Thu, 7 Nov 2024 22:32:14 +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="d+fBmrWU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 598D988730; Thu, 7 Nov 2024 22:32:12 +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.4 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-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (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 06ADB891BC for ; Thu, 7 Nov 2024 22:32:10 +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-io1-xd35.google.com with SMTP id ca18e2360f4ac-83aac75fcceso49970239f.0 for ; Thu, 07 Nov 2024 13:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015128; x=1731619928; 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=1Fo78y6DPUayqBnRFaxfcKJUVdRfdTYhKuQuH9qRXOY=; b=d+fBmrWU00WX/MqVgxWzDDuz2WSCpFOWLHuNcvJPMCaGMpCPPOAvsRMS5V+HPrOz1B vaMDd2vPqK9nJgCAeFdJosUynGwU42bTmiuEO5fnDweZETushKR3htWuw9ybF/Z0N33s +QXkE6kqkaPIxwk4p1SdFBnZJl7IRyqt9Ntlo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015128; x=1731619928; 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=1Fo78y6DPUayqBnRFaxfcKJUVdRfdTYhKuQuH9qRXOY=; b=nUx+gKYHiuKPPW86HtI9GqVFIO6zWEQeYY5jX6ODdxd2W/c6dI4+r1gj7rZynG+5VY hNkjC0roZdVUqf4daaPW6U6pqDN8xb7blKJBCd3AZdOFBZr7Dax5cVnArCC6pHfoWxiw Owtrj+7j31fpTUlH0stxicrFmDxEetNuJvnPXplLSdPpqzCxlS3iNkFht1RdMjxk/M1F bUCLfwAT+wFy1jaqJmJZ0oba5cK62nzFxbX4jD27Bg8aLyuddt3nl91dzJwH8jex+921 SK1vBkuvqhAoyXBV20L2eEc+pHILrpQseCHr8sZL55/tb4PIscZjhSJMG8zlxmTxBLjz JFGg== X-Gm-Message-State: AOJu0YwU6gn9OglN/zCdK13Wh7frgBU5xBZ9JbFem781SZb1rnyM+pZ8 Ap2fvHQxANxRq2o0OykGg3SfjlSaHtc3VSibLN18WGoVZcySFxIlnjdthafDynMfSky35GoFOKk = X-Google-Smtp-Source: AGHT+IHexym2oYbgCGaLd3paUiB5I99sPo2KwyQzjAUMk3SFIEOjkxLBm2toit4FOVHdhLHOaTEeSA== X-Received: by 2002:a05:6e02:178b:b0:3a6:ac98:2c7b with SMTP id e9e14a558f8ab-3a6f1a62066mr6803355ab.24.1731015128064; Thu, 07 Nov 2024 13:32:08 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.32.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:06 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , AKASHI Takahiro , Caleb Connolly , Mark Kettenis , Masahisa Kojima , Mattijs Korpershoek , Shantur Rathore , Sughosh Ganu , =?utf-8?q?Vincent_Stehl=C3=A9?= Subject: [PATCH v10 03/10] efi: Move default filename to a function Date: Thu, 7 Nov 2024 14:31:43 -0700 Message-Id: <20241107213150.1711962-4-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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 84640cf7b25..ecdf7210750 100644 --- a/include/efi.h +++ b/include/efi.h @@ -669,4 +669,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 f9b5988a06e..8c51a6ef2ed 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 2f859c40adb..372bbab6b8d 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 Thu Nov 7 21:31:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008158 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=P9yj/SGe; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XkwKC1ZDgz1xxq for ; Fri, 8 Nov 2024 08:32:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A7F0888B1F; Thu, 7 Nov 2024 22:32:16 +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="P9yj/SGe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8709288FE5; Thu, 7 Nov 2024 22:32:15 +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.4 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-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 143EF88B0A for ; Thu, 7 Nov 2024 22:32:13 +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-il1-x129.google.com with SMTP id e9e14a558f8ab-3a6bba54722so5631635ab.2 for ; Thu, 07 Nov 2024 13:32:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015131; x=1731619931; 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=Oe6qhq9Cwo7Oo36VUqafHOpB86g+vUkQmZeNcaI1/24=; b=P9yj/SGegSHoC6Z1W7UD1QR8e1UnVnMQhXs+VSkojk7KaT27pRo7akb8MRRvXc1ENI Z2faMDYwQzQsUDJuB4GlwnB+SyMCIxGePGGxbH1kRESuZZSbepTV7lzUrxw+SfLJRzf2 LABWV+y7eHX//UNOHD/cqE+KRjnDZPHvz068U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015131; x=1731619931; 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=Oe6qhq9Cwo7Oo36VUqafHOpB86g+vUkQmZeNcaI1/24=; b=nYC9M5ep5kacAvynKrQU9JHl5BGhoLrLE4YpaeTtHorzp2he/79acngawOOPQew32h 5q3jYEYmLKedpPpg49Psa75G9a0lySElF+4WmvYVKYUN0OTQMiL1eGYZZw9GI6404PE0 2aXaCnk9tmSkdSyRU2HIdmzICTu9Oamc6m/6nR59tOpoilabMpGnKIY1KuksHf4fxtYD zIoBZEJbKBZDxeGwJThJEpejMsRH2boJpcgVY0rZej7U1FB/aONkKBEx/RbabhWkOpRD CpwWRPRSg97oxXkjniExlIEBqU+G5tdei3KhnGq1vaJxtmteGafEvSSPNhECenz6I5y5 BhQA== X-Gm-Message-State: AOJu0YwLPIJF1zukXH4SMmySckkjR6dLmH589RGyGCuUOA/1FxQ9M9u/ E60iGLvZdkRmSSNRzEHAut6+/QTmkIIeAHX9jctGCjdP0Eaf4bCuV3rjxXQMWUzaPeb6Gm9G5XE = X-Google-Smtp-Source: AGHT+IEXnl+64Wt2UB/K+5eyn/bvrk5zuWUW+SAwvBp1+YmdPu4b6jl6jr3E4kpWmOgO4+po1vbzYA== X-Received: by 2002:a05:6e02:214f:b0:3a6:aade:e328 with SMTP id e9e14a558f8ab-3a6f19a03d1mr9418355ab.4.1731015131258; Thu, 07 Nov 2024 13:32:11 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:09 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , AKASHI Takahiro , Caleb Connolly , Mark Kettenis , Masahisa Kojima , Mattijs Korpershoek , Shantur Rathore , Sughosh Ganu , =?utf-8?q?Vincent_Stehl=C3=A9?= Subject: [PATCH v10 04/10] efi_loader: Move get_efi_pxe_arch() to efi_helper Date: Thu, 7 Nov 2024 14:31:44 -0700 Message-Id: <20241107213150.1711962-5-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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 ecdf7210750..789a64eda9d 100644 --- a/include/efi.h +++ b/include/efi.h @@ -678,4 +678,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 Thu Nov 7 21:31:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008159 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=Llqe/p6y; 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 4XkwKM5twCz1xxq for ; Fri, 8 Nov 2024 08:32:55 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 07A44891E1; Thu, 7 Nov 2024 22:32:19 +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="Llqe/p6y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6EE1688EFB; Thu, 7 Nov 2024 22:32:17 +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.4 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-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (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 548EE88B55 for ; Thu, 7 Nov 2024 22:32:15 +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-il1-x12f.google.com with SMTP id e9e14a558f8ab-3a6e960fb5dso4884675ab.0 for ; Thu, 07 Nov 2024 13:32:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015133; x=1731619933; 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=Tn/0/A7n+HuijX8hUWUXLO1lNv0YNth+jJU4Rj7zQyA=; b=Llqe/p6ybiFR3Yec0dsozgPjxOkLUW54tsNIZg/ULJmvBAoo5GhPvpqqJmDenvdP3P uw8FhfQtR4rTg/F7tJH0ngLcj+IrDFNnj7gwnNwJRno0hHvgYcoOIufbYdk/pKoukDQ+ XCrCITbsBfFZMHugce1+N39jRb5FIRDmt3VLY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015133; x=1731619933; 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=Tn/0/A7n+HuijX8hUWUXLO1lNv0YNth+jJU4Rj7zQyA=; b=MOEy/MJE9AuET9jWzwOJFH0O1FYsEjnQfRhJwQ2TeqZu2Yvwh9FH86llJ82UhftrEq xLhEspsKU5oJxvJnFiVSXuiHmMdQIuBvm0YK6dZORZFBBlLg7YB9PwjcDIBw7RVGQ3N1 HSTKzlhHF3OTeLlhKeRqVlavx4ib8iifTuJpiToKCfFzHuBV+0faNkG/suIEA6WkclDL doBWRc8JgPEBLaFHeYherif+fHe1pUbcnPvhBF3AQ0O7AHkjjLoFAVvvf0uGHzqyK0iE BP8mDHOF9yL8sJz8sF2cMInLQT9YAehykSI6FyMkT9flCjNpo94nR76ic0sDPyxDdCql 2UOw== X-Gm-Message-State: AOJu0Yy8q0VQTYImuIFznUo1kEDiCTfwUHyxrRPEaNes526YYKsHmLFY HIC3iX+xvhUNOvijL53Q+FI+60FgbMnkrwwx6w5wGEJ4F5jsF22nEvO82khMURPmIORTuxPj+BI = X-Google-Smtp-Source: AGHT+IEuvGsfkjxNEu8RAlAoM9PX+MXbOOf1UCIb+0wPVerXpNus9AQeR24SAVV29Z34rCk9GldPVg== X-Received: by 2002:a92:c244:0:b0:3a6:ab32:7417 with SMTP id e9e14a558f8ab-3a6f1994673mr7982835ab.1.1731015133488; Thu, 07 Nov 2024 13:32:13 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:12 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , AKASHI Takahiro , Masahisa Kojima Subject: [PATCH v10 05/10] efi_loader: Allow reporting the host defaults Date: Thu, 7 Nov 2024 14:31:45 -0700 Message-Id: <20241107213150.1711962-6-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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 e040fe75fa1..02f1e080e88 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -511,6 +511,27 @@ static int do_efi_show_images(struct cmd_tbl *cmdtp, int flag, return CMD_RET_SUCCESS; } +/** + * 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; +} + static const char * const efi_mem_type_string[] = { [EFI_RESERVED_MEMORY_TYPE] = "RESERVED", [EFI_LOADER_CODE] = "LOADER CODE", @@ -1561,6 +1582,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(memmap, CONFIG_SYS_MAXARGS, 1, do_efi_show_memmap, @@ -1653,6 +1676,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 memmap\n" From patchwork Thu Nov 7 21:31:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008160 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=jl4wbnpD; 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 4XkwKY1Y0Nz1xxq for ; Fri, 8 Nov 2024 08:33:05 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5BAD988B16; Thu, 7 Nov 2024 22:32: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=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="jl4wbnpD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D204D88EFB; Thu, 7 Nov 2024 22:32:22 +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.4 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-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (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 96A4B8903B for ; Thu, 7 Nov 2024 22:32:18 +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-il1-x129.google.com with SMTP id e9e14a558f8ab-3a3a5cd2a3bso5814445ab.3 for ; Thu, 07 Nov 2024 13:32:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015137; x=1731619937; 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=xHM05lc2g6c+8ywIRNdu20hIwPzUitBwpjrHu3MdV/c=; b=jl4wbnpDiKu57j5rG1+IgHA9+DHuB2Ap5z80ERvHE2VdMANd8OR0RiVytRAszdX22/ mIo/cGXJTrzaqrFRgnzR5ZM8eGRTvOwwdWVDnDFyhf3dClFNobiiPovQXDFuNIfJoA85 H6QM9MVpFRsGVf6LF0qiBs5gRVSHD8iG016m0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015137; x=1731619937; 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=xHM05lc2g6c+8ywIRNdu20hIwPzUitBwpjrHu3MdV/c=; b=Pa/GfT+jBIyt7Bq0tV6LdpL83DxJBwR3ZMEAoA4AGETu3y01UpPM2lvhwduEAztcoc oOiMSSK2R2+y5xxjfNi7BFpW1WmhIiD15qHKaKpCekUQ38uJoBosP/vARaiH7JHSDPlj /q2ydvARMrU61SbRPGi9Li+ZyBZSK+DGJErQ7CyWD6sGdchcLGzqdfGtGLTfSCV2hVXN bbxt2MNULKxEOHYOGvWsqoE5gvTw/goMycVOIMwLsXc/bbSFrXCx5xfq5ofpqi42WwLD qdQLflekdVtXWMihw8n+Ktf8jylcLpWqBpB9fOgoTVtcZP1kAlqaipRhTuCAxPLRO5k1 9cmg== X-Gm-Message-State: AOJu0Yw9RlhkZUVGXJfUumYQ3dpbGtX7QlAOlWN6+izyxWpA/ZUl2LZT TqKaF5y8J3IG+vGY87c2RuguazHSQqvstRKuEaOZuuHIr1d9M9Uqr4w8dNHZ/xK9k9nbAiANkXg = X-Google-Smtp-Source: AGHT+IEEmDI3F5aH6Fzx7KhyRX00uwYJ1T2UmEoXAnl6IlVGup+DYltvy65qha68alKfEf6awsTHxQ== X-Received: by 2002:a05:6e02:18c7:b0:3a6:c09a:504b with SMTP id e9e14a558f8ab-3a6f1a590d2mr9616525ab.22.1731015136837; Thu, 07 Nov 2024 13:32:16 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.32.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:15 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , AKASHI Takahiro , Caleb Connolly , Mark Kettenis , Masahisa Kojima , Sughosh Ganu , =?utf-8?q?Vincent_Stehl=C3=A9?= Subject: [PATCH v10 06/10] sandbox: Report host default-filename in native mode Date: Thu, 7 Nov 2024 14:31:46 -0700 Message-Id: <20241107213150.1711962-7-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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 789a64eda9d..c559fda3004 100644 --- a/include/efi.h +++ b/include/efi.h @@ -678,6 +678,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 Thu Nov 7 21:31:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008161 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=Rra2X/gS; 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 4XkwKj6LHmz1xxq for ; Fri, 8 Nov 2024 08:33:13 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B201889021; Thu, 7 Nov 2024 22:32: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=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="Rra2X/gS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D99E988B55; Thu, 7 Nov 2024 22:32:23 +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.4 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-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) (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 C691288B0A for ; Thu, 7 Nov 2024 22:32:21 +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-il1-x136.google.com with SMTP id e9e14a558f8ab-3a6ababaaa9so5835765ab.1 for ; Thu, 07 Nov 2024 13:32:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015140; x=1731619940; 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=+x6nUERGgnxaokPVGNQ8SzhVd3ye8k7onJ6lP4YpOd8=; b=Rra2X/gSfZZ1hPvWUc+viUpRpA98UQIdFoZjlaTL0taMj+EG0rJMCCnxPfSlgqnEje cyMpny0rpI8LZS1actgQ8C5CT4gb6TMcPtOavIg3si/WAWHfyhrR1TXDDd4GnQeUgtxP dqZXr/jsfjJNWfk8xFpylsbr21PhJapDTQvYk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015140; x=1731619940; 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=+x6nUERGgnxaokPVGNQ8SzhVd3ye8k7onJ6lP4YpOd8=; b=rfSX9YyKkk1YyCy5j47brlyfyNMotKTgw5bX6ZlOthx93qA9a1X8RBzy75gFlUa1DB XfPHNNLJlWp7C7pOTXI2lwrJfTIKawrofxzHXqSppJvF1IJvgEIFnH/rYKHFeVs+xr6J /wW6vD4EeVbGgU/uf/XYcL8IQ1J0MAZ/BCMxdu72VvQ8R4m7G5dovxB6JfhwDTH5PV5w COyRu2MJylVWCe/fIu33xiPDd8JXAVC7VImV2iyz56qp7apCOw2Sg53loODgdvSrMLWU OR1hx76zL9uQiJdkFRqR4Hp6XyLxF5yBZ4fxJV5g5Wd70umzNKN9l50wFkhJrm1YlwdY igPg== X-Gm-Message-State: AOJu0YwuCMz8HJv773sSPajRybWEOhqvNSJXzqR354JYArE03WGeAIW9 8nYUDFW3Vhdy5uojBPT0W2qYRmfbs4N7WNiquQVg6wxKO2CTnLpBaUyWu5qdNWPutJrc/rupFw8 = X-Google-Smtp-Source: AGHT+IFzRa+MpT/UlmnlV/B5P8yWNu1VuyhX3e/z9HR0vZkXdZN4cxYZHYcyNzmvNx95iXSxH9LCLg== X-Received: by 2002:a05:6e02:13ac:b0:3a6:be66:ce53 with SMTP id e9e14a558f8ab-3a6f1a35505mr8370055ab.18.1731015139966; Thu, 07 Nov 2024 13:32:19 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.32.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:18 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , AKASHI Takahiro , Mark Kettenis , Masahisa Kojima , Sughosh Ganu Subject: [PATCH v10 07/10] efi_loader: Drop sandbox PXE architecture Date: Thu, 7 Nov 2024 14:31:47 -0700 Message-Id: <20241107213150.1711962-8-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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 --- (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 Thu Nov 7 21:31:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008162 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=Avd7Qy+i; 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 4XkwKx0cZLz1xyk for ; Fri, 8 Nov 2024 08:33:23 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 091E888FBB; Thu, 7 Nov 2024 22:32: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="Avd7Qy+i"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4804B88B0A; Thu, 7 Nov 2024 22:32:27 +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.4 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-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (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 D843589048 for ; Thu, 7 Nov 2024 22:32: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-il1-x12f.google.com with SMTP id e9e14a558f8ab-3a6ababa9f7so5943055ab.1 for ; Thu, 07 Nov 2024 13:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015143; x=1731619943; 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=5yAl18TpcL/FIJTPaWjyxbdo5khZJDAvqwQovQ0vqOQ=; b=Avd7Qy+iy/7ckmRU8cpgrBh+kWE7udjIgamjnrBgWkFl/bvg/dHoQbto4Aqgbapxvi wDP+ZzRjrp6NVbM1jtpozKmw+YEWgeC0KgB4JnkqEvzi/raeFM0TX3eOjP6TUw5Xy3hc R2KKDFx7dJbn0S+vfEoeRzF9tZI91w8voGFr0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015143; x=1731619943; 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=5yAl18TpcL/FIJTPaWjyxbdo5khZJDAvqwQovQ0vqOQ=; b=uXrzwFDj3sh9EiiQD4eJQX1pwvn/AiwyhlIA2IPrL4CeAeBJ8x07xwPvRKbY9Q9eTA 7yzWwoWRyHh/V2oYDfoz1Y0LX5FW6rTeAxvvayaOI+96vfIXgBUDzOA1QfYfEE4UGDwh dIhAkjukev+3+qbGhRSBUSzha0yM1DeqWus9L+X9wtaZBS+wthElTM5ydElcC09I16sM 9ep9D/XZ3kSocVKSpNbSmXRaO8Oyo/fCADTz1MPm6uucINoK9Xu345U86w63u22kMJpR LXvq3UJ1yLgOR+BkrdHy2+pFTzh14d9y5sxwlyx3sq8mvIadvqY5aoUS/juZoOBNpbbv dJoQ== X-Gm-Message-State: AOJu0YziST0/JOYWgmJZ5MA1Q3DbaC2OWcWayokoP9tiOTUn5x2OotrH 3oggYgET0LLGj4Zg+M/TtaodJgR6wyKcdGfpoTGzCOevSu8+2qyklnJJPQ5KdCfNAMNR6BejyC8 = X-Google-Smtp-Source: AGHT+IEzY+RhUM05FQEp8n3/vfOLk67Go+nz7Awetnv7ZIStP21udYOnAKQF1cED/XiQ0bukFIVgMA== X-Received: by 2002:a05:6e02:190e:b0:39b:330b:bb25 with SMTP id e9e14a558f8ab-3a6f19e2863mr8732795ab.12.1731015143067; Thu, 07 Nov 2024 13:32:23 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:21 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Dan Carpenter , Jiaxun Yang Subject: [PATCH v10 08/10] sandbox: virtio: Disable the sandbox virtio blk device Date: Thu, 7 Nov 2024 14:31:48 -0700 Message-Id: <20241107213150.1711962-9-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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 Thu Nov 7 21:31:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008163 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=eMTCDrU3; 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 4XkwL40XPZz1xxq for ; Fri, 8 Nov 2024 08:33:32 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 57535891BC; Thu, 7 Nov 2024 22:32: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=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="eMTCDrU3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 38FDA891BC; Thu, 7 Nov 2024 22:32: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.4 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-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (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 71DE68920A for ; Thu, 7 Nov 2024 22:32: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=sjg@chromium.org Received: by mail-il1-x12b.google.com with SMTP id e9e14a558f8ab-3a6be9bd626so5726285ab.2 for ; Thu, 07 Nov 2024 13:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015146; x=1731619946; 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=n6k5OFFhxwHhd2pJWkck0QX0Ou5TnkVywazQ+dv8xH0=; b=eMTCDrU38ENa65+cDUQsImONPYK1oRP6oKsLl+F2O6p8M2DG8YmXmlBHrk9vBU81B4 /6oU8lGo6nF64KqgTx3+Mnot93K9Um2Bn+dpStyyP84G2RXy/WuvPjLZINjy+J2oPU3V HtEVVPBpEqqYfVIyL69ZlAVAJDbN1Uu6g/xgc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015146; x=1731619946; 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=n6k5OFFhxwHhd2pJWkck0QX0Ou5TnkVywazQ+dv8xH0=; b=cIlGbOqtxPFSY8H/1qbTppWJcx0DHOA0YsWE03LOOajLMo5plPbdmhFcRKlpO6TYlQ Vkhs4nIHWvWBEpYiP7x0vByJnBjULn0jrJVfQLJ3M+72X8XcROzdMcNqiwmoiw/2puE0 NjorUWgEw4LxING4KIxBPv6+SbRW3DsqotTv7T3U78jh8eRKm6H4+BWt8ehUZySfjj2J MchecBDtcti7LEk0njb1asvxsvag9pz8CbyZMMWNBu339TJNNu3quD0UxiCTIu+u+uzc 6vfKs89v7sJlp2pALZPLiYrjB9Cbkk4xkWC5iVJncnqfG7cxRO2cF9OwUdPPRWWJfHhq iQUQ== X-Gm-Message-State: AOJu0YwIxMMhBR8uIWArEjilCknRrGO0AQrWXrMxKmJFC3e3V84/Jvux GPVWgNqXy5xA+UyPvcdPpzZ9FNQ6BpNyaiZx4aLRAuHArSZRvQTHsJ9ksmXymBjkm4VGBG6gfEg = X-Google-Smtp-Source: AGHT+IF1/n25KwPLDq8L7XpBr1ZKeps9lJwa5x22BAMZJTS9WOfqw7mUxcTGVEIlTUyMWcNZPenncQ== X-Received: by 2002:a05:6e02:17c6:b0:3a0:a80a:997c with SMTP id e9e14a558f8ab-3a6f1a25691mr8363215ab.19.1731015146451; Thu, 07 Nov 2024 13:32:26 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:25 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , AKASHI Takahiro , Caleb Connolly , Christian Marangi , Francis Laniel , Guillaume La Roque , Jerome Forissier , Julien Masson , Julius Lehmann , Marek Vasut , Mattijs Korpershoek , Patrick Rudolph , Sean Anderson , Sughosh Ganu , Yang Xiwen Subject: [PATCH v10 09/10] test: efi: boot: Set up an image suitable for EFI testing Date: Thu, 7 Nov 2024 14:31:49 -0700 Message-Id: <20241107213150.1711962-10-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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 369c611d924..8c44afd9297 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 372bbab6b8d..ac548e78ceb 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): @@ -547,6 +549,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): @@ -557,6 +597,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 Thu Nov 7 21:31:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2008164 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=D2OOxAoK; 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 4XkwLF192jz1xxq for ; Fri, 8 Nov 2024 08:33:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AC0258921E; Thu, 7 Nov 2024 22:32: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=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="D2OOxAoK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20D4B891BC; Thu, 7 Nov 2024 22:32:34 +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.4 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-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (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 89DAA88B0A for ; Thu, 7 Nov 2024 22:32: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-il1-x131.google.com with SMTP id e9e14a558f8ab-3a6be9bd626so5726575ab.2 for ; Thu, 07 Nov 2024 13:32:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1731015150; x=1731619950; 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=3OXbBxCYMzUi1W85OQUAKRr7kAwtxu5xEbW+fFay5rY=; b=D2OOxAoKYzXC+jpusIdIJIEhH0q2Z1KWHI1oNYp/8+de8VesSGEx+lOZ0YIiJTh49I lZphlzgIw07p0fst/R3+lNdz85GmDbkKw4ClzNjguFWGYf2qYNwIZ6pbxBwSyzI6ent+ XoflCNrNmq0krnXn6vhh5wEUie9/HR7HvdxB4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731015150; x=1731619950; 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=3OXbBxCYMzUi1W85OQUAKRr7kAwtxu5xEbW+fFay5rY=; b=uUgsEh7QsVJGEM3EBEqW5/8Qz0pBeLfgwHVj/Qz8e27FFnO18xqhAf3/oJRD5EmChU C1wTD2XvqZF31rfHcvdyObPel3h4S7wnZQo8nxUpBltIMY6Qw02GXzBdG8ETgxCGjAv6 3hsvtC6aghe36Xlsqb9AwBvPzsz929Hsz5yhPAb00noG7EKo8g1NoWF6sQvHPAME+JfK CSJOWe0Vu+IcRDnIkA/Xptk/ONtIdE/HvycNwjaFiTtG2PaqU8dOPzp0hYir4djanVLf OnnnClHE9Ap1vmoN821IrCsk11hJqMC1iH1p7L+/5QZvb4rVR+nlyo0mBGBzS98yVxfF qZhQ== X-Gm-Message-State: AOJu0YxmmUI5vghNwxBu2GtShdPb8GVi6NW8+pUJ6j7Nd/G/CLSBxa1B EG4+I4tOIN9NQwNJ+oyf51u6vx4O9OjB5znH6e8XoXeyt4x6qYpnsU7nStvbNwP5Rz5XOq1P/OE = X-Google-Smtp-Source: AGHT+IFNZGcaGh4YdwgTwOHQilEiHoLj+w9K50G0Sz/cCbcWbJZtn4kmgRgCd6wuoLlvDQww7kWiQg== X-Received: by 2002:a05:6e02:1a28:b0:3a6:cb15:42d2 with SMTP id e9e14a558f8ab-3a6f199ff59mr9170395ab.6.1731015149614; Thu, 07 Nov 2024 13:32:29 -0800 (PST) Received: from chromium.org (c-107-2-138-191.hsd1.co.comcast.net. [107.2.138.191]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a6ead30a79sm4831745ab.71.2024.11.07.13.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2024 13:32:28 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , AKASHI Takahiro , Mattijs Korpershoek Subject: [PATCH v10 10/10] test: efi: boot: Add a test for the efi bootmeth Date: Thu, 7 Nov 2024 14:31:50 -0700 Message-Id: <20241107213150.1711962-11-sjg@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241107213150.1711962-1-sjg@chromium.org> References: <20241107213150.1711962-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/ Changes in v10: - Rebase to -master - Specify the bootdev order, to avoid including cros device 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 | 67 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index ac548e78ceb..9397328609d 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,66 @@ 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) +{ + static const char *order[] = {"mmc1", "usb", NULL}; + struct bootstd_priv *std; + struct udevice *bootstd; + const char **old_order; + + ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd)); + std = dev_get_priv(bootstd); + old_order = std->bootdev_order; + std->bootdev_order = order; + + /* 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(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(); + + ut_assertok(bootstd_test_drop_bootdev_order(uts)); + + return 0; +} +BOOTSTD_TEST(bootflow_efi, UTF_CONSOLE);