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 5F3FEC433EF for ; Sat, 16 Oct 2021 11:30: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 6CA0460F41 for ; Sat, 16 Oct 2021 11:30:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6CA0460F41 Authentication-Results: mail.kernel.org; dmarc=none (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 6FCF7835F6; Sat, 16 Oct 2021 13:30:42 +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="Ze1Rz4SD"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="OyIYUiuB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DCA1C8369F; Sat, 16 Oct 2021 08:17:03 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (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 0C0828361E for ; Sat, 16 Oct 2021 08:16:58 +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 compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 0731D5C0164; Sat, 16 Oct 2021 02:16:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 16 Oct 2021 02:16:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zhaofeng.li; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=5aHpXePP4gKfXevSIj/n1GjQV4 xvdvHczGa+f/pKn78=; b=Ze1Rz4SDbvRb6DGRyjfJKkgVQp4yTDC2TIOvEhXwQ1 32COXlc5A3fWqzUIc4cKdZTk7I8PS/PImJUVwzlVW3nbFy53fytDitxDeiLmv4sb Gt6dIU4LZua+ZrRPB+8oR1Z53ZGQb6mANzVA1teIs/6L0QnJKGH/GzjfHDbybohi 0hlyaVzswHJiY4WKhXgrWPCVVqAzzPf5A9P3Xg0WVXw7RV0WSuEFHBq4qLMaCOI/ IXYgKDe/R0YkhAr+CDWNAIBPd5jU4/FJ1MHzcIV+yNtxHiMo1h7dNLZ8ph5JxhY1 iU4JPiYGsscamlG9t8ZbNgxbQXALhW/e2u4kaE5Q/uyA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=5aHpXePP4gKfXevSI j/n1GjQV4xvdvHczGa+f/pKn78=; b=OyIYUiuBKXjfZI1omRVRoINBMKgEctQvP DEXBgwJ5W7XCXuXQfGfj+1RBv5VeSMFUpNTyeIbxgIBjeNnllYkkv/wJ6F+0cYmn TPgoWmJ0W3fxFIGhTAhUTwWkVlz1ffC6MF8Aozn5nWcJ6zTk4JxmFJCQ+7tOpUYi DPzjeejIGBv2OkTOah/eMRo2moC1wpij8/IfhuedbTnqpdvmaYAV1P3lV8pQm8K+ gH5F+51ws9K3u7UU3sGKQ4Ausiwgznz+Hkpg1VhYieM5dxzJ68aDH12/kjLPB9K2 trZxyijORd5ZKBz0bLxzGcyDV+nZ8u4YroP8E5/VsrINSy7oCz/tw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdduhedguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpegkhhgrohhfvghnghcunfhiuceohhgvlhhlohesiihhrghofhgv nhhgrdhliheqnecuggftrfgrthhtvghrnhepieffheeghfelvefgieeuhefhgedvieeuue etuddttdetveejkeehgeduueethfdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhephhgvlhhlohesiihhrghofhgvnhhgrdhlih X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 16 Oct 2021 02:16:53 -0400 (EDT) From: Zhaofeng Li To: u-boot@lists.denx.de Cc: Zhaofeng Li , Simon Glass , Bin Meng Subject: [PATCH] pxe_utils: Fix arguments to x86 zboot Date: Fri, 15 Oct 2021 23:16:07 -0700 Message-Id: <20211016061607.215571-1-hello@zhaofeng.li> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Sat, 16 Oct 2021 13:30:39 +0200 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 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