Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4D915C19F28 for ; Sat, 30 Jul 2022 21:58:36 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EB82F8459B; Sat, 30 Jul 2022 23:54:25 +0200 (CEST) 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="fFs4HS/o"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A64598450E; Sat, 30 Jul 2022 23:53:54 +0200 (CEST) Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) (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 A5377844C5 for ; Sat, 30 Jul 2022 23:53:49 +0200 (CEST) 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-ot1-x329.google.com with SMTP id z12-20020a056830128c00b0061c8168d3faso5656209otp.7 for ; Sat, 30 Jul 2022 14:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=83Zfb6338q8V7hAu5qH6fcPGUi/HSqYg4qS3iZFUNAA=; b=fFs4HS/oVTH/Q8lIf0Ge3O4wO3DrN7XHxRURlNeQdKGI6Dw3pobOKPbS9qrxUAst// WY7J/McJJmgkfJXA0BpiKfObkho+NtvwpH/X368nKXFUUx4AMOnoVBFF1lH5qQ2urKal uXnAHuRpkQ4yW4GIvWqEgIF0b5T7OB9h8EjOo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=83Zfb6338q8V7hAu5qH6fcPGUi/HSqYg4qS3iZFUNAA=; b=6z76lQOt5JmqacoXBUb9t/s6SJlee9AbRdT9W/1TmTGJeauC1KYKV0lc8U3/NXOHys +pDiO92gAPcgdgqXggSOfoQYBmSfNIxVAFQu4Uz6pCQD/7UwR2S3DTqq3ltRb5jNIvES VYVyz2sE9dC1OSsO8eAvJlqKmumeiL2XsB9lArO+4DM4VGjBogmsoX9ImthV9pNaQ9lz 4C32QmeWEah7pMEUg/ylcYhzLLgrDhRRsfbaMuAeTz5V/htt6Ny3eI7UaAp/HI8sRwFK 8NuszmG90cD2cMtYVsPG00QPhmAuQKleqaK7DkIyeO7tRTIL3T+Yuvapb7BgLysgNQA5 69RA== X-Gm-Message-State: AJIora9Oii1wRoW/Hh/w66lvCc+SynxeE2llzxa+TPAO84JHeApbaCc9 mjm0i6hgG2kLJTXLWRz/sDXJ0Z6DgQXlJkEI X-Google-Smtp-Source: AGRyM1vKdDCQkETx/hfJktax2yNVyTWO/CgjNpib/cT0ne/jIx846TK4EDSQrzqyXRpnYeDWjgLmhQ== X-Received: by 2002:a05:6830:2908:b0:61d:26f8:94c5 with SMTP id z8-20020a056830290800b0061d26f894c5mr3705184otu.64.1659218021287; Sat, 30 Jul 2022 14:53:41 -0700 (PDT) Received: from sjg1.lan (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id 19-20020a544193000000b0032f75714af1sm1699656oiy.18.2022.07.30.14.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jul 2022 14:53:40 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Bin Meng , Simon Glass Subject: [PATCH v2 32/35] bootstd: Add vbe bootmeth into sandbox Date: Sat, 30 Jul 2022 15:52:34 -0600 Message-Id: <20220730215237.818368-27-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.455.g008518b4e5-goog In-Reply-To: <20220730215237.818368-1-sjg@chromium.org> References: <20220730215237.818368-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean Update sandbox to include the VBE bootmeth. Update a few existing tests to take account of this change, specifically that the new bootmeth now appears when scanning. Signed-off-by: Simon Glass --- (no changes since v1) arch/sandbox/dts/sandbox.dtsi | 13 ++++++++++ arch/sandbox/dts/test.dts | 15 +++++++++++ test/boot/Makefile | 4 +++ test/boot/bootflow.c | 47 ++++++++++++++++++++++++++++++++--- test/boot/bootmeth.c | 25 ++++++++++++++++--- 5 files changed, 96 insertions(+), 8 deletions(-) diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index aa22b8765c8..56e6b38bfa7 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -12,6 +12,19 @@ chosen { stdout-path = "/serial"; + + fwupd { + compatible = "simple-bus"; + firmware { + compatible = "fwupd,vbe-simple"; + cur-version = "1.2.3"; + bootloader-version = "2022.01"; + storage = "mmc1"; + area-start = <0x0>; + area-size = <0x1000000>; + skip-offset = <0x8000>; + }; + }; }; audio: audio-codec { diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index d1a8cc7bfb7..2761588f0da 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1387,6 +1387,21 @@ compatible = "denx,u-boot-fdt-test"; reg = <9 1>; }; + + fwupd { + compatible = "simple-bus"; + firmware0 { + compatible = "fwupd,vbe-simple"; + storage = "mmc1"; + area-start = <0x400>; + area-size = <0x1000>; + skip-offset = <0x200>; + state-offset = <0x400>; + state-size = <0x40>; + version-offset = <0x800>; + version-size = <0x100>; + }; + }; }; translation-test@8000 { diff --git a/test/boot/Makefile b/test/boot/Makefile index 1730792b5fa..9e9d5ae21f3 100644 --- a/test/boot/Makefile +++ b/test/boot/Makefile @@ -3,3 +3,7 @@ # Copyright 2021 Google LLC obj-$(CONFIG_BOOTSTD) += bootdev.o bootstd_common.o bootflow.o bootmeth.o + +ifdef CONFIG_OF_LIVE +obj-$(CONFIG_BOOTMETH_VBE_SIMPLE) += vbe_simple.o +endif diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 39c2c33dead..d2c42e8b060 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -90,7 +91,7 @@ static int bootflow_cmd_glob(struct unit_test_state *uts) ut_assertok(bootstd_test_drop_bootdev_order(uts)); console_record_reset_enable(); - ut_assertok(run_command("bootflow scan -l", 0)); + ut_assertok(run_command("bootflow scan -lG", 0)); ut_assert_nextline("Scanning for bootflows in all bootdevs"); ut_assert_nextline("Seq Method State Uclass Part Name Filename"); ut_assert_nextlinen("---"); @@ -122,7 +123,7 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts) ut_assertok(bootstd_test_drop_bootdev_order(uts)); console_record_reset_enable(); - ut_assertok(run_command("bootflow scan -ale", 0)); + ut_assertok(run_command("bootflow scan -aleG", 0)); ut_assert_nextline("Scanning for bootflows in all bootdevs"); ut_assert_nextline("Seq Method State Uclass Part Name Filename"); ut_assert_nextlinen("---"); @@ -233,7 +234,7 @@ static int bootflow_iter(struct unit_test_state *uts) /* The first device is mmc2.bootdev which has no media */ ut_asserteq(-EPROTONOSUPPORT, - bootflow_scan_first(&iter, BOOTFLOWF_ALL, &bflow)); + bootflow_scan_first(&iter, BOOTFLOWF_ALL | BOOTFLOWF_SKIP_GLOBAL, &bflow)); ut_asserteq(2, iter.num_methods); ut_asserteq(0, iter.cur_method); ut_asserteq(0, iter.part); @@ -242,7 +243,7 @@ static int bootflow_iter(struct unit_test_state *uts) ut_asserteq(0, bflow.err); /* - * This shows MEDIA even though there is none, since int + * This shows MEDIA even though there is none, since in * bootdev_find_in_blk() we call part_get_info() which returns * -EPROTONOSUPPORT. Ideally it would return -EEOPNOTSUPP and we would * know. @@ -384,6 +385,44 @@ static int bootflow_iter_disable(struct unit_test_state *uts) } BOOTSTD_TEST(bootflow_iter_disable, UT_TESTF_DM | UT_TESTF_SCAN_FDT); +/* Check 'bootflow scan' with a bootmeth ordering including a global bootmeth */ +static int bootflow_scan_glob_bootmeth(struct unit_test_state *uts) +{ + ut_assertok(bootstd_test_drop_bootdev_order(uts)); + + /* + * Make sure that the -G flag makes the scan fail, since this is not + * supported when an ordering is provided + */ + console_record_reset_enable(); + ut_assertok(bootmeth_set_order("efi firmware0")); + ut_assertok(run_command("bootflow scan -lG", 0)); + ut_assert_nextline("Scanning for bootflows in all bootdevs"); + ut_assert_nextline( + "Seq Method State Uclass Part Name Filename"); + ut_assert_nextlinen("---"); + ut_assert_nextlinen("---"); + ut_assert_nextline("(0 bootflows, 0 valid)"); + ut_assert_console_end(); + + ut_assertok(run_command("bootflow scan -l", 0)); + ut_assert_nextline("Scanning for bootflows in all bootdevs"); + ut_assert_nextline( + "Seq Method State Uclass Part Name Filename"); + ut_assert_nextlinen("---"); + ut_assert_nextline("Scanning global bootmeth 'firmware0':"); + ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':"); + ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':"); + ut_assert_nextline("Scanning bootdev 'mmc0.bootdev':"); + ut_assert_nextline("No more bootdevs"); + ut_assert_nextlinen("---"); + ut_assert_nextline("(0 bootflows, 0 valid)"); + ut_assert_console_end(); + + return 0; +} +BOOTSTD_TEST(bootflow_scan_glob_bootmeth, UT_TESTF_DM | UT_TESTF_SCAN_FDT); + /* Check 'bootflow boot' to boot a selected bootflow */ static int bootflow_cmd_boot(struct unit_test_state *uts) { diff --git a/test/boot/bootmeth.c b/test/boot/bootmeth.c index 5d2e87b1c95..ae216293d64 100644 --- a/test/boot/bootmeth.c +++ b/test/boot/bootmeth.c @@ -23,8 +23,9 @@ static int bootmeth_cmd_list(struct unit_test_state *uts) ut_assert_nextlinen("---"); ut_assert_nextline(" 0 0 syslinux Syslinux boot from a block device"); ut_assert_nextline(" 1 1 efi EFI boot from an .efi file"); + ut_assert_nextline(" glob 2 firmware0 VBE simple"); ut_assert_nextlinen("---"); - ut_assert_nextline("(2 bootmeths)"); + ut_assert_nextline("(3 bootmeths)"); ut_assert_console_end(); return 0; @@ -56,8 +57,9 @@ static int bootmeth_cmd_order(struct unit_test_state *uts) ut_assert_nextlinen("---"); ut_assert_nextline(" 0 0 syslinux Syslinux boot from a block device"); ut_assert_nextline(" - 1 efi EFI boot from an .efi file"); + ut_assert_nextline(" glob 2 firmware0 VBE simple"); ut_assert_nextlinen("---"); - ut_assert_nextline("(2 bootmeths)"); + ut_assert_nextline("(3 bootmeths)"); ut_assert_console_end(); /* Check the -a flag with the reverse order */ @@ -68,8 +70,9 @@ static int bootmeth_cmd_order(struct unit_test_state *uts) ut_assert_nextlinen("---"); ut_assert_nextline(" 1 0 syslinux Syslinux boot from a block device"); ut_assert_nextline(" 0 1 efi EFI boot from an .efi file"); + ut_assert_nextline(" glob 2 firmware0 VBE simple"); ut_assert_nextlinen("---"); - ut_assert_nextline("(2 bootmeths)"); + ut_assert_nextline("(3 bootmeths)"); ut_assert_console_end(); /* Now reset the order to empty, which should show all of them again */ @@ -77,7 +80,7 @@ static int bootmeth_cmd_order(struct unit_test_state *uts) ut_assert_console_end(); ut_assertnull(env_get("bootmeths")); ut_assertok(run_command("bootmeth list", 0)); - ut_assert_skip_to_line("(2 bootmeths)"); + ut_assert_skip_to_line("(3 bootmeths)"); /* Try reverse order */ ut_assertok(run_command("bootmeth order \"efi syslinux\"", 0)); @@ -93,6 +96,20 @@ static int bootmeth_cmd_order(struct unit_test_state *uts) ut_asserteq_str("efi syslinux", env_get("bootmeths")); ut_assert_console_end(); + /* Try with global bootmeths */ + ut_assertok(run_command("bootmeth order \"efi firmware0\"", 0)); + ut_assert_console_end(); + ut_assertok(run_command("bootmeth list", 0)); + ut_assert_nextline("Order Seq Name Description"); + ut_assert_nextlinen("---"); + ut_assert_nextline(" 0 1 efi EFI boot from an .efi file"); + ut_assert_nextline(" glob 2 firmware0 VBE simple"); + ut_assert_nextlinen("---"); + ut_assert_nextline("(2 bootmeths)"); + ut_assertnonnull(env_get("bootmeths")); + ut_asserteq_str("efi firmware0", env_get("bootmeths")); + ut_assert_console_end(); + return 0; } BOOTSTD_TEST(bootmeth_cmd_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); -- 2.37.1.455.g008518b4e5-goog