From patchwork Mon Oct 10 17:01:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 1688158 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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 (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MmQDv6c2pz1yqk for ; Tue, 11 Oct 2022 04:01:51 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 651F484EEB; Mon, 10 Oct 2022 19:01:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 3D52384EEB; Mon, 10 Oct 2022 19:01:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 5DECD84E34 for ; Mon, 10 Oct 2022 19:01:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 88DA415BF; Mon, 10 Oct 2022 10:01:34 -0700 (PDT) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.197.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7043D3F67D; Mon, 10 Oct 2022 10:01:27 -0700 (PDT) From: Andre Przywara To: Tom Rini , Tuomas Tynkkynen Cc: Simon Glass , Harrison Mutai , u-boot@lists.denx.de Subject: [PATCH 1/3] qfw: store loaded file size in environment variable Date: Mon, 10 Oct 2022 18:01:20 +0100 Message-Id: <20221010170122.1527138-2-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221010170122.1527138-1-andre.przywara@arm.com> References: <20221010170122.1527138-1-andre.przywara@arm.com> 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.6 at phobos.denx.de X-Virus-Status: Clean At the moment the QEMU firmware command just prints the size of the loaded binaries on the console. To go with all the other load methods, and many boot scripts' expectations, also store the size of the file loaded last in the environment variable "filesize". We first put the kernel size in there, but overwrite this with the initrd size, should we have one, because this is probably the more prominent user of $filesize (in the booti or bootz command). Signed-off-by: Andre Przywara --- cmd/qfw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/qfw.c b/cmd/qfw.c index ccbc967ca9f..c61001b771d 100644 --- a/cmd/qfw.c +++ b/cmd/qfw.c @@ -40,6 +40,7 @@ static int qemu_fwcfg_cmd_setup_kernel(void *load_addr, void *initrd_addr) qfw_read_entry(qfw_dev, FW_CFG_KERNEL_DATA, le32_to_cpu(kernel_size), data_addr); data_addr += le32_to_cpu(kernel_size); + env_set_hex("filesize", le32_to_cpu(kernel_size)); data_addr = initrd_addr; qfw_read_entry(qfw_dev, FW_CFG_INITRD_SIZE, 4, &initrd_size); @@ -49,6 +50,7 @@ static int qemu_fwcfg_cmd_setup_kernel(void *load_addr, void *initrd_addr) qfw_read_entry(qfw_dev, FW_CFG_INITRD_DATA, le32_to_cpu(initrd_size), data_addr); data_addr += le32_to_cpu(initrd_size); + env_set_hex("filesize", le32_to_cpu(initrd_size)); } qfw_read_entry(qfw_dev, FW_CFG_CMDLINE_SIZE, 4, &cmdline_size);