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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A08BC433F5 for ; Sat, 23 Oct 2021 23:32:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D2C1060EB1 for ; Sat, 23 Oct 2021 23:32:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D2C1060EB1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5A79D835C9; Sun, 24 Oct 2021 01:31:27 +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="Q3Jo1qpF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB93F83531; Sun, 24 Oct 2021 01:28:20 +0200 (CEST) Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) (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 E9532834A9 for ; Sun, 24 Oct 2021 01:27:23 +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-x335.google.com with SMTP id b4-20020a9d7544000000b00552ab826e3aso9338902otl.4 for ; Sat, 23 Oct 2021 16:27:23 -0700 (PDT) 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=elPHE/O69qvxb7ygaH/npD2vb0JDRGv7kkhuOR2+liM=; b=Q3Jo1qpF9SlaEYFEIBWvTdxT4JojS0JqLIEP/pMf2itOxPdjPYKLpDcOPKGOSwlwto WIlg8Cj4pkwInVi2ghzDOPUz8emFGCE9ogqQEo6/OOdjbwHERquxZMjo5TB1FtMY9XVM 0b8n8ZSChieJuXBrPPz58s300fUMjRhQ0HXuw= 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=elPHE/O69qvxb7ygaH/npD2vb0JDRGv7kkhuOR2+liM=; b=LmzT6+m+D5D/k4aPzAH6pDM9XaK/fHlY8FTAsb4gAgEkr5Bf1GAqZVp7CBNnw5CEjh FgfC6Q6kUbEhq4A4mwta+xPfVbsX2rXPjbNmvHgSP1WxFkW0bo26zFgRbZiZgxH7HEkN EDjfD2v67DK+RNnFgsYXx7u5FqOTA0DzFvJzUD0u+DoBCOOgpnDU87XnLq/Un8obfLby 3dMmgV5hE5W6iWFFPefXQ3L6vcuyxaPhBYTb9hm0rvcw/GAbqgrva6ZljVUV/GVaCT7N r4Ks1+j+xe555OTSTK6+UvhtF8Xr8JedaPww60S3m0cV8g0ASrW1cE/Owz+mppNgo41T FXAg== X-Gm-Message-State: AOAM532npq+P01r74x/XxSkt3Xjh/CgxoA4Rs9qhyqSf1sYJnkZ+oabD +XW9semRs5nBIoIE9i6w0BHIdqKnO0DGFQ== X-Google-Smtp-Source: ABdhPJwps6rje086NiXNwuJ7Cu9sb0+2P7XuWPafWrPGmqsFYaTcGSXCk82QVIO004CH03jeb8I/Gg== X-Received: by 2002:a9d:1ca2:: with SMTP id l34mr6789748ota.365.1635031642465; Sat, 23 Oct 2021 16:27:22 -0700 (PDT) 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 l24sm2253885oop.4.2021.10.23.16.27.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Oct 2021 16:27:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Michal Simek , Heinrich Schuchardt , Tom Rini , Ilias Apalodimas , Daniel Schwierzeck , Steffen Jaeckel , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Lukas Auer , Dennis Gilmore , Simon Glass Subject: [PATCH v2 34/41] bootstd: Add a sandbox bootmeth driver Date: Sat, 23 Oct 2021 17:26:28 -0600 Message-Id: <20211023232635.9195-25-sjg@chromium.org> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211023232635.9195-1-sjg@chromium.org> References: <20211023232635.9195-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Add a bootmeth driver for sandbox, used for testing. Signed-off-by: Simon Glass --- (no changes since v1) boot/Kconfig | 7 +++++ boot/Makefile | 1 + boot/bootmeth_sandbox.c | 67 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 boot/bootmeth_sandbox.c diff --git a/boot/Kconfig b/boot/Kconfig index ebbd7427d7f..2862bd10710 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -339,6 +339,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 0bbda0e5364..a2722072753 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 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..928cd5ac6a5 --- /dev/null +++ b/boot/bootmeth_sandbox.c @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Bootmethod for sandbox testing + * + * Copyright 2021 Google LLC + * Written by Simon Glass + */ + +#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.33.0.1079.g6e70778dc9-goog