From mboxrd@z Thu Jan 1 00:00:00 1970 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 0174BC433EF for ; Wed, 19 Jan 2022 01:47:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E92C98388B; Wed, 19 Jan 2022 02:45: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=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="BPg5hbYc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 54BCC83849; Wed, 19 Jan 2022 02:44:26 +0100 (CET) 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 DDC0083563 for ; Wed, 19 Jan 2022 02:44:04 +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 h30so827492ila.12 for ; Tue, 18 Jan 2022 17:44:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XI3VtnSiLpa9mBrbMu42edHqj5i1pvwmz4Rt6tGOQ4c=; b=BPg5hbYcnTFvMN8CU+IexBfZIfmjIOQkvDaF5G64IcjXc17N23UKUMYxiN7FZEGgPA FagUz11Tv9UBmbJ7SoVeG0rJuoAmYgX1HIwkdkR6k56pLz4wJPBSsEOxnByQ3dkYIoD8 sgosSa+guxUf2spyz1Wjdmk6/E4RdCPHicmsE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XI3VtnSiLpa9mBrbMu42edHqj5i1pvwmz4Rt6tGOQ4c=; b=aRGXPXx9uRmSWGOvBmVVypbVdr7ufyBiBKQJBjbW5fVTJOVFfl5xsXI8T47P+4Ix73 UtJppTsQ1a9pticb6g4qXRUbB4lsndHrndBY20Ut/UO/OfHfARrdt6ZT+fmpPLQkNRkr Cg3dQU0rD+t6V7fkGX2Bwptl2wg/1/fN+Xk/u8HTRNiaYnsulKPMr3AtYDtQ8J8J5/Jb i1uO/+Kl5BpNv1YUSh/bo8ldfqoLlOehxCOaL3dHt6f1JlwrQts6osTYg2oxAxSG2eqp HtB5KwMvmFP6QBokc1VrdqFjQmVxnJsvV3DtltXvjHzjU19yTPQJGqcKWxbXMjyV+bvb Mfeg== X-Gm-Message-State: AOAM532VPTfbIV4gJX70mXia0wtPEy/bA3X1NwTnusYVzknTPUgvx3dY e+SzQ9SaAtxcVJrQhVPIfMxzugkBgU1S8Q== X-Google-Smtp-Source: ABdhPJzr5W6FRh1h99ee4koxx2ZMz/ktyAX5l45OOhz73psAzrH1MzIQ5nP4Ox7rPzdO5HpeXNNbmw== X-Received: by 2002:a05:6e02:16cd:: with SMTP id 13mr15936294ilx.139.1642556643511; Tue, 18 Jan 2022 17:44:03 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id j18sm10546314ila.86.2022.01.18.17.44.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 17:44:03 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Daniel Schwierzeck , Dennis Gilmore , Steffen Jaeckel , Lukas Auer , Michal Simek , Tom Rini , Heinrich Schuchardt , Simon Glass Subject: [PATCH v3 25/31] bootstd: Add a sandbox bootmeth driver Date: Tue, 18 Jan 2022 18:43:09 -0700 Message-Id: <20220119014315.1938157-17-sjg@chromium.org> X-Mailer: git-send-email 2.34.1.703.g22d0c6ccf7-goog In-Reply-To: <20220119014315.1938157-1-sjg@chromium.org> References: <20220119014315.1938157-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.2 at phobos.denx.de X-Virus-Status: Clean Add a bootmeth driver for sandbox, used for testing. Signed-off-by: Simon Glass --- Changes in v3: - Add a log category boot/Kconfig | 7 +++++ boot/Makefile | 1 + boot/bootmeth_sandbox.c | 69 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 boot/bootmeth_sandbox.c diff --git a/boot/Kconfig b/boot/Kconfig index 0fee35070b0..69a3e28502e 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -359,6 +359,13 @@ config BOOTMETH_EFILOADER This provides a way to try out standard boot on an existing boot flow. +config BOOTMETH_SANDBOX + def_bool y + depends on SANDBOX + help + This is a sandbox bootmeth driver used for testing. It always returns + -ENOTSUPP when attempting to boot. + endif config LEGACY_IMAGE_FORMAT diff --git a/boot/Makefile b/boot/Makefile index 38b10d81f0d..db8cb1187ed 100644 --- a/boot/Makefile +++ b/boot/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootstd-uclass.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO) += bootmeth_distro.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_DISTRO_PXE) += bootmeth_pxe.o obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_EFILOADER) += bootmeth_efi.o +obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL obj-$(CONFIG_$(SPL_TPL_)CMD_BOOTEFI_BOOTMGR) += bootmeth_efi_mgr.o endif diff --git a/boot/bootmeth_sandbox.c b/boot/bootmeth_sandbox.c new file mode 100644 index 00000000000..13ec5e95e64 --- /dev/null +++ b/boot/bootmeth_sandbox.c @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Bootmethod for sandbox testing + * + * Copyright 2021 Google LLC + * Written by Simon Glass + */ + +#define LOG_CATEGORY UCLASS_BOOTSTD + +#include +#include +#include +#include +#include + +static int sandbox_check(struct udevice *dev, struct bootflow_iter *iter) +{ + return 0; +} + +static int sandbox_read_bootflow(struct udevice *dev, struct bootflow *bflow) +{ + /* pretend we are ready */ + bflow->state = BOOTFLOWST_READY; + + return 0; +} + +static int sandbox_read_file(struct udevice *dev, struct bootflow *bflow, + const char *file_path, ulong addr, ulong *sizep) +{ + return -ENOSYS; +} + +static int sandbox_boot(struct udevice *dev, struct bootflow *bflow) +{ + /* always fail: see bootflow_iter_disable() */ + return -ENOTSUPP; +} + +static int sandbox_bootmeth_bind(struct udevice *dev) +{ + struct bootmeth_uc_plat *plat = dev_get_uclass_plat(dev); + + plat->desc = "Sandbox boot for testing"; + + return 0; +} + +static struct bootmeth_ops sandbox_bootmeth_ops = { + .check = sandbox_check, + .read_bootflow = sandbox_read_bootflow, + .read_file = sandbox_read_file, + .boot = sandbox_boot, +}; + +static const struct udevice_id sandbox_bootmeth_ids[] = { + { .compatible = "u-boot,sandbox-syslinux" }, + { } +}; + +U_BOOT_DRIVER(bootmeth_sandbox) = { + .name = "bootmeth_sandbox", + .id = UCLASS_BOOTMETH, + .of_match = sandbox_bootmeth_ids, + .ops = &sandbox_bootmeth_ops, + .bind = sandbox_bootmeth_bind, +}; -- 2.34.1.703.g22d0c6ccf7-goog