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 A0051C4332F for ; Wed, 14 Dec 2022 06:45:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E26AC85061; Wed, 14 Dec 2022 07:45:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1671000329; bh=wAUCJfzXnmoOrhH/bwixbOkVrZqPxYrz3QSlIw8SBzY=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=aDMKR3ah8DdPdA8yf4a8evyU9kKhFomRsLwa31fZaPxqQL3YTIy30hs852RjM0sFI 6BMlKF73KZIkvhxO/PMGLAGUo41s1JDUFyb/w12X4+zevt/kq832DAj1oJ9AVuVXfe X0kdIUH5cMGmlE2r+SoeyeOcC5sBKSLwWDBqzUnAzKfp1L2XiinQbJnwiCjlA3e2z+ Ait/fO+aWY5hzDYRESCDKaoUTTtkj5CMOMPBSovtLYOBnTUB8ChZ+0GEbEhBGxX2Jg 3lRy0A5krUQwbm6aecJePWpcbC+JpgBLNKeeyAo25wL8QY8FQ2vm7Oejxy/o3rlYkN leODp/g2e6fIg== Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 53EF884FBE; Wed, 14 Dec 2022 07:45:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1671000327; bh=wAUCJfzXnmoOrhH/bwixbOkVrZqPxYrz3QSlIw8SBzY=; h=From:To:Cc:Subject:Date:From; b=Py6svi9eAGxDzFyqmxIQqYRM05FR/IqQVgPIIOqL5cyLPN9NdlwuUE+YmMg7k54iP aPj2658gVxTcJml6mtP008O1a+9GSibdeRo9gJAG8IAAytbgjuJ/3E6o5r4pA+wsLj 0xHgGB3MFVAsbA/fkPGzWc0JBaM1B0I0HHK7y5/W+MG8sogDbmNvDWbPaHTyJgmiDy d1APaa/PBlAKR71nR6RlxU1kv5We0dj8K9yNsOy95ZX38tik8UeuRNOpLItgElBAwG BrgcNCxztstS1pbHeJIOX16mj5uKlOgY50ySpMnu7Pj4Y4f+FOzHVW1pwfZqtUKtpy lFooR52RIGIDQ== From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Peter Hoyes , Ramon Fried , Simon Glass Subject: [PATCH v2] cmd: pxe_utils: Limit fdtcontroladdr usage to non-fitImage Date: Wed, 14 Dec 2022 07:45:18 +0100 Message-Id: <20221214064518.753432-1-marex@denx.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Commit d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot") forces '$fdtcontroladdr' DT address as a third parameter of bootm command even if the PXE transfer pulls in a fitImage which contains configuration node with its own DT that is preferrable to be passed to Linux. Limit the $fdtcontroladdr fallback utilization to non-fitImages, since it is highly likely a fitImage would come with its own DT, while single-file images do need a separate DT. Fixes: d5ba6188dfb ("cmd: pxe_utils: Check fdtcontroladdr in label_boot") Signed-off-by: Marek Vasut --- Cc: Peter Hoyes Cc: Ramon Fried Cc: Simon Glass --- V1: Map the kernel buffer before testing image type V2: Update code comment to reflect the change --- boot/pxe_utils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index 8133006875f..099aa2f4bc7 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -617,7 +617,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) * bootm, and adjust argc appropriately. * * Scenario 3: If there is an fdtcontroladdr specified, pass it along to - * bootm, and adjust argc appropriately. + * bootm, and adjust argc appropriately, unless the image type is fitImage. * * Scenario 4: fdt blob is not available. */ @@ -724,7 +724,10 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) if (!bootm_argv[3]) bootm_argv[3] = env_get("fdt_addr"); - if (!bootm_argv[3]) + kernel_addr_r = genimg_get_kernel_addr(kernel_addr); + buf = map_sysmem(kernel_addr_r, 0); + + if (!bootm_argv[3] && genimg_get_format(buf) != IMAGE_FORMAT_FIT) bootm_argv[3] = env_get("fdtcontroladdr"); if (bootm_argv[3]) { @@ -733,8 +736,6 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) bootm_argc = 4; } - kernel_addr_r = genimg_get_kernel_addr(kernel_addr); - buf = map_sysmem(kernel_addr_r, 0); /* Try bootm for legacy and FIT format image */ if (genimg_get_format(buf) != IMAGE_FORMAT_INVALID && IS_ENABLED(CONFIG_CMD_BOOTM)) -- 2.35.1