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 0C9D4C433EF for ; Wed, 20 Oct 2021 07:18:44 +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 72A6760FD8 for ; Wed, 20 Oct 2021 07:18:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 72A6760FD8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=zhaofeng.li 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 B7473832C7; Wed, 20 Oct 2021 09:18:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=zhaofeng.li Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=zhaofeng.li header.i=@zhaofeng.li header.b="fVShtLB/"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="Nw5AFAuS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB4D8832F4; Wed, 20 Oct 2021 09:18:34 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (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 DE6E482DA1 for ; Wed, 20 Oct 2021 09:18:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=zhaofeng.li Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=hello@zhaofeng.li Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 4DC3B3201EC3; Wed, 20 Oct 2021 03:18:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 20 Oct 2021 03:18:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zhaofeng.li; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=z05S2iML6dNMq 58xrhtXhKdFEEmUeE4aL4RQzk4fSrY=; b=fVShtLB/abrScfTn3Pa6VsZpztpOL 4uJ+tp4dXA9YHD2TGluwl1eqTQdeOFQuu8vbgtHXDMJxnpr2L7zd4WkUqjb6XIjb 7fd95aQCQmguK+HQqktdhPhfJNHJrU0MqMP5d9AJ9Ji9T0uF7n45Glpf5UsWOjtT XC+l3WR4hNoV0eTNm8/ea6KDoKz3O/ADtSwsR/VJIlbizIYsSAk5leeF6saoZNyl N3FxBXdyhTLEUUGWIS+sbDkoUoFwYwD3EoUZ1Gom6Xg4KgO5r3nRgXEGExEbXIaK GotF1zL+xxJ07GqmiRJ0s/XuZ3DhGv4Z4cBlPjJlO/YYVwViGE0GHxarw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=z05S2iML6dNMq58xrhtXhKdFEEmUeE4aL4RQzk4fSrY=; b=Nw5AFAuS B85k/a294AYmMQBi2zu3Kwid5umqJ0WCn1b6pFiJH5gSeawGWb8+avxQWkeRn36R LiqRAmW57/pExT0vt0nSjH2+gsFFGhUJdn/wNfx7juktMmQlzqZaYcTcyCR1Wdp/ p5Z4WizBWtvGcxRjQL70yZ4Ov4CLJ6xo1HX/3NvW6hl80IBXhiStTV71t2p1fWYz YGZmQN4zo1qYQPlNnVgrlt4lGokBoGG/8tcz46737CxzZL2Whv9hh5AyMONyMCns 6U6bowu7noIrZ9mtljpe5UARm4a8q1+pavObpiR6w/8WPntFeNLJowkRt7Ncbmus U8ADAsGLg7a5Vg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddvfedgudduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpegkhhgrohhfvghnghcunfhiuceohhgvlhhlohesiihhrgho fhgvnhhgrdhliheqnecuggftrfgrthhtvghrnhepheegueekveeijeehveegfffgtefgge eiteeiledtfeejfffhudefuedtveeffffgnecuvehluhhsthgvrhfuihiivgeptdenucfr rghrrghmpehmrghilhhfrhhomhephhgvlhhlohesiihhrghofhgvnhhgrdhlih X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 20 Oct 2021 03:18:26 -0400 (EDT) From: Zhaofeng Li To: u-boot@lists.denx.de Cc: Simon Glass , Bin Meng , Zhaofeng Li Subject: [PATCH v2 1/2] pxe_utils: Fix arguments to x86 zboot Date: Wed, 20 Oct 2021 00:18:14 -0700 Message-Id: <20211020071815.115763-2-hello@zhaofeng.li> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211020071815.115763-1-hello@zhaofeng.li> References: <20211020071815.115763-1-hello@zhaofeng.li> 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 bootm and zboot accept different arguments: > bootm [addr [arg ...]] > - boot application image stored in memory > passing arguments 'arg ...'; when booting a Linux kernel, > 'arg' can be the address of an initrd image > zboot [addr] [size] [initrd addr] [initrd size] [setup] [cmdline] > addr - The optional starting address of the bzimage. > If not set it defaults to the environment > variable "fileaddr". > size - The optional size of the bzimage. Defaults to > zero. > initrd addr - The address of the initrd image to use, if any. > initrd size - The size of the initrd image to use, if any. In the zboot flow, the current code will reuse the bootm args and attempt to pass the initrd arg (argv[2]) as the kernel size (should be argv[3]). zboot also expects the initrd address and size to be separate arguments. Let's untangle them and have separate argv/argc locals. Signed-off-by: Zhaofeng Li Cc: Simon Glass Cc: Bin Meng --- cmd/pxe_utils.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c index 067c24e5ff..78ebfdcc79 100644 --- a/cmd/pxe_utils.c +++ b/cmd/pxe_utils.c @@ -441,11 +441,14 @@ skip_overlay: static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) { char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL }; + char *zboot_argv[] = { "zboot", NULL, "0", NULL, NULL }; char initrd_str[28]; + char initrd_filesize[10]; char mac_str[29] = ""; char ip_str[68] = ""; char *fit_addr = NULL; int bootm_argc = 2; + int zboot_argc = 3; int len = 0; ulong kernel_addr; void *buf; @@ -478,6 +481,11 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) strcat(bootm_argv[2], ":"); strncat(bootm_argv[2], env_get("filesize"), 9); bootm_argc = 3; + + strncpy(initrd_filesize, env_get("filesize"), 9); + zboot_argv[3] = env_get("ramdisk_addr_r"); + zboot_argv[4] = initrd_filesize; + zboot_argc = 5; } if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) { @@ -529,6 +537,8 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) } bootm_argv[1] = env_get("kernel_addr_r"); + zboot_argv[1] = env_get("kernel_addr_r"); + /* for FIT, append the configuration identifier */ if (label->config) { int len = strlen(bootm_argv[1]) + strlen(label->config) + 1; @@ -665,7 +675,7 @@ static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label) do_bootz(cmdtp, 0, bootm_argc, bootm_argv); /* Try booting an x86_64 Linux kernel image */ else if (IS_ENABLED(CONFIG_CMD_ZBOOT)) - do_zboot_parent(cmdtp, 0, bootm_argc, bootm_argv, NULL); + do_zboot_parent(cmdtp, 0, zboot_argc, zboot_argv, NULL); unmap_sysmem(buf); -- 2.33.0