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 953ACC07E9D for ; Mon, 26 Sep 2022 06:49:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F189844C0; Mon, 26 Sep 2022 08:49:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de 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; secure) header.d=gmx.net header.i=@gmx.net header.b="WoTLW0PB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 80D8F84C61; Mon, 26 Sep 2022 08:49:22 +0200 (CEST) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EC5C183869 for ; Mon, 26 Sep 2022 08:49:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1664174958; bh=RUUY219Yn+3ON7KXBGPchQLSFsHXdMn4+MdOyVkGrHI=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=WoTLW0PBrxn2/saeA8E8xatsRNnXYa0xfLLFzXgm30ztIS5FYj0jadLZEsQQUuPVU bDlkpCxSXb5LYH3Ew87jzDJLapIh6Bwwq/APtwIXF4/QaHAcSyOmAqZkdrh5hFAcv+ mLtcjOhoJTmBn4n1X2gFhRfEzto+cGpOCysraSZM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.94] ([84.118.157.2]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MYeMj-1ohMTO3n3D-00VgAL; Mon, 26 Sep 2022 08:49:17 +0200 Message-ID: <118b0cb6-ba55-2022-fa85-02ebf0df6c43@gmx.de> Date: Mon, 26 Sep 2022 08:49:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH 20/45] sandbox: Add a way to specify the sandbox executable Content-Language: en-US To: Simon Glass Cc: Tom Rini , Andrew Scull , U-Boot Mailing List References: <20220925150248.2524421-1-sjg@chromium.org> <20220925150248.2524421-21-sjg@chromium.org> From: Heinrich Schuchardt In-Reply-To: <20220925150248.2524421-21-sjg@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:52uggXjnzgYSaKt0VWN5L5TgUBXYlIQC/1rk5dNB7YjoJ9wJj43 dbw/RB0eyCwNFIce/cLRv97HGo/oIGC79HEmh5aM4R5eWfMCsb9odGdiJ+EIqrG9Vjrs6yn BqencFwRcB3+5TjkvmVg3MOFfKnO6aOxAn3gWp231Q1mubx+HBDXhB2RcD7Mabxq9HDjp2P U61E/8AdXwpTAAc9uWWRQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:EEI+RhcMjFk=:LxpGkL74USPYWkA8HsAMS3 gH1/tp1VPguO4HDjWyQWwzcXVFGsgZf+BcByHH4xK3E6XQR++AEkHg+dSmn7VyZf0H9H/UScz jRiYz4TSyBlnXTPX3vD77sJ0tDoob4aSa21Cmti/ErseeS4/Ib6bLFl/ZoYzj1pPqXBWmBSmV FriH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-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 On 9/25/22 17:02, Simon Glass wrote: > At present the sandbox executable is assumed to be arg[0] but this only > works for a single jump (e.g. from SPL to U-Boot). Add a new arg to solv= e > this issue, along with a detailed comment. What is the impact on os_relaunch()? With current origin/master it fails on SPL: $ spl/u-boot-spl -S U-Boot SPL 2022.10-rc5-00012-g435596d57f (Sep 26 2022 - 08:40:30 +0200) Creating new bloblist size 400 at c000 Finished bloblist size 400 at c000 Finished bloblist size 400 at c000 Found existing bloblist size 400 at c000 U-Boot 2022.10-rc5-00012-g435596d57f (Sep 26 2022 - 08:40:30 +0200) DRAM: 256 MiB Core: 23 devices, 11 uclasses, devicetree: board MMC: Loading Environment from nowhere... OK In: serial Out: serial Err: serial Net: No ethernet found. Hit any key to stop autoboot: 0 =3D> reset resetting ... Finished bloblist size 400 at bffd000 Failed to read RAM buffer '/tmp/u-boot.mem.LypddQ': -1 Expected bloblist at c000 not found (err=3D-2) Creating new bloblist size 400 at c000 U-Boot 2022.10-rc5-00012-g435596d57f (Sep 26 2022 - 08:40:30 +0200) u-boot: error: failed while parsing option: memory try running with --help for more information. Best regards Heinrich > > Signed-off-by: Simon Glass > --- > > arch/sandbox/cpu/start.c | 30 ++++++++++++++++++++++++++++++ > arch/sandbox/include/asm/state.h | 3 ++- > 2 files changed, 32 insertions(+), 1 deletion(-) > > diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c > index 642be164a39..622df41f54c 100644 > --- a/arch/sandbox/cpu/start.c > +++ b/arch/sandbox/cpu/start.c > @@ -244,6 +244,36 @@ static int sandbox_cmdline_cb_jump(struct sandbox_s= tate *state, > } > SANDBOX_CMDLINE_OPT_SHORT(jump, 'j', 1, "Jumped from previous U-Boot")= ; > > +static int sandbox_cmdline_cb_program(struct sandbox_state *state, > + const char *arg) > +{ > + /* > + * Record the program name to use when jumping to future phases. This > + * is the original executable which holds all the phases. We need to > + * use this instead of argv[0] since each phase is started by > + * extracting a particular binary from the full program, then running > + * it. Therefore in that binary, argv[0] contains only the > + * current-phase executable. > + * > + * For example, sandbox TPL may be started using image file: > + * > + * ./image.bin > + * > + * but then TPL needs to run VPL, which it does by extracting the VPL > + * image from the image.bin file. > + * > + * ./temp-vpl > + * > + * When VPL runs it needs access to the original image.bin so it can > + * extract the next phase (SPL). This works if we use '-f image.bin' > + * when starting the original image.bin file. > + */ > + state->prog_fname =3D arg; > + > + return 0; > +} > +SANDBOX_CMDLINE_OPT_SHORT(program, 'p', 1, "U-Boot program name"); > + > static int sandbox_cmdline_cb_memory(struct sandbox_state *state, > const char *arg) > { > diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm= /state.h > index fd42daad51c..49ea483d332 100644 > --- a/arch/sandbox/include/asm/state.h > +++ b/arch/sandbox/include/asm/state.h > @@ -71,7 +71,8 @@ struct sandbox_state { > const char *parse_err; /* Error to report from parsing */ > int argc; /* Program arguments */ > char **argv; /* Command line arguments */ > - const char *jumped_fname; /* Jumped from previous U_Boot */ > + const char *jumped_fname; /* Jumped from previous U-Boot */ > + const char *prog_fname; /* U-Boot executable filename */ > uint8_t *ram_buf; /* Emulated RAM buffer */ > unsigned long ram_size; /* Size of RAM buffer */ > const char *ram_buf_fname; /* Filename to use for RAM buffer */