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 B11E1C38A02 for ; Fri, 28 Oct 2022 09:12:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AE91184F15; Fri, 28 Oct 2022 11:12:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="aM5TFsbk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 46CC684F17; Fri, 28 Oct 2022 11:12:03 +0200 (CEST) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9F71C84EC3 for ; Fri, 28 Oct 2022 11:12:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=neil.armstrong@linaro.org Received: by mail-wm1-x330.google.com with SMTP id c7-20020a05600c0ac700b003c6cad86f38so6047597wmr.2 for ; Fri, 28 Oct 2022 02:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:reply-to :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=YBuXlDPYeEjxpNG7Es7wfj+ggyXAJ10na939zgwdVRw=; b=aM5TFsbkCrraNRQC5H861D/Z7JY0WCo/4AjIb1Ph7HwzM/EsSY1PwLNOthJG1lJ+Wu EPkl+Pu50wBoLrJAu6bYykfKT5HUrsvkVY5/+6YCNPJGsDLC5E1m2ue+Rz67FSkIje0/ hgujUzSa2lBLrj6tevBu8yz9/ZKJIIDAmiWKzzjIZs4H+nKfRHeUPQnlF+umSZx+QEUN 7Wnd6Qcdmkug7mFJiZJwKz+00/Dwl97BoNzDu3MTOxlo6cuDkq2o6fhpnEnTS9Ll5ER9 PLgHBXKXELBze8VIszfw9Icw/v/Dj6LLyfr3zRU7EZ7+wVCIRUjjwVet3WIqYZJvbuyX g80Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:reply-to :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YBuXlDPYeEjxpNG7Es7wfj+ggyXAJ10na939zgwdVRw=; b=eLAu5lMKSDnLUsG+JasdJW8mRuoARrz5P1ksF3AiEhArsHsY+dQMljQOiwBp042RlP /N6g9wd5PIVy8FISyQVYv8/94iFN9QVU6Vi5HjdDWktpXwMgGGNqSjTA92YjdcxEyZSq /iAi8b0zoXfIJlDYrmzD7atfDNoCR9eMxMxq6koEmvlcqJNPHPwb7+aaVhW8hyfp+lZE C+qu7jmq2tMFPt2OxuSh5plQd2L5tKJoAIgKx7HFCbX2B4GeRIVplB4787NClKCghXwZ JahgW7XoJrwSjfAVpbrGcpi8kWXDieV4tqF3KA64W3Vww07TQepa0cHEF0BGEjDBgd66 n0zQ== X-Gm-Message-State: ACrzQf1nU9lu7m6gm+KeEXvaJOjQkNSEw7NJqGnxMTUjaj8FiuaeNlcF wxdXpAiIxOkW7HMS3CHXuzmTjA== X-Google-Smtp-Source: AMsMyM6nXyj4PGcxixUBg3I/8/ndBadn0TH2TGkvx+PLFeR05azxTwwO8PYJOz8PtFdrjXlMMPKHDQ== X-Received: by 2002:a1c:7c03:0:b0:3cf:4969:9bab with SMTP id x3-20020a1c7c03000000b003cf49699babmr8569899wmc.176.1666948320184; Fri, 28 Oct 2022 02:12:00 -0700 (PDT) Received: from ?IPV6:2a01:e0a:898:f380:9e9c:c6c2:95a3:c182? ([2a01:e0a:898:f380:9e9c:c6c2:95a3:c182]) by smtp.gmail.com with ESMTPSA id iv9-20020a05600c548900b003cf483ee8e0sm7401866wmb.24.2022.10.28.02.11.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Oct 2022 02:11:59 -0700 (PDT) Message-ID: Date: Fri, 28 Oct 2022 11:11:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH 1/3] cmd: pxe: reorder kernel treatment in label_boot Content-Language: en-US To: Patrick Delaunay , u-boot@lists.denx.de Cc: Ramon Fried , Peter Hoyes , Artem Lapkin , Heinrich Schuchardt , Simon Glass , Zhaofeng Li , U-Boot STM32 References: <20221028090120.1536827-1-patrick.delaunay@foss.st.com> <20221028110055.1.If04f25e393f3af8cd75af331ca2f432a7a1b88e8@changeid> From: Neil Armstrong Organization: Linaro Developer Services In-Reply-To: <20221028110055.1.If04f25e393f3af8cd75af331ca2f432a7a1b88e8@changeid> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: , Reply-To: neil.armstrong@linaro.org 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 28/10/2022 11:01, Patrick Delaunay wrote: > Reorder kernel treatment in label_boot at the beginning of the function. > > This patch doesn't change the pxe command behavior, it is only a > preliminary step for next patch, build kernel_addr before parsing > the label initrd and fdt to build the next bootm arguments. > > Signed-off-by: Patrick Delaunay > --- > > boot/pxe_utils.c | 49 ++++++++++++++++++++++++------------------------ > 1 file changed, 24 insertions(+), 25 deletions(-) > > diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c > index d5c215ae2c1d..844ab72252bf 100644 > --- a/boot/pxe_utils.c > +++ b/boot/pxe_utils.c > @@ -522,6 +522,27 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) > return 1; > } > > + if (get_relfile_envaddr(ctx, label->kernel, "kernel_addr_r", > + NULL) < 0) { > + printf("Skipping %s for failure retrieving kernel\n", > + label->name); > + return 1; > + } > + > + kernel_addr = env_get("kernel_addr_r"); > + /* for FIT, append the configuration identifier */ > + if (label->config) { > + int len = strlen(kernel_addr) + strlen(label->config) + 1; > + > + fit_addr = malloc(len); > + if (!fit_addr) { > + printf("malloc fail (FIT address)\n"); > + return 1; > + } > + snprintf(fit_addr, len, "%s%s", kernel_addr, label->config); > + kernel_addr = fit_addr; > + } > + > if (label->initrd) { > ulong size; > > @@ -529,21 +550,14 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) > &size) < 0) { > printf("Skipping %s for failure retrieving initrd\n", > label->name); > - return 1; > + goto cleanup; > } > > initrd_addr_str = env_get("ramdisk_addr_r"); > size = snprintf(initrd_str, sizeof(initrd_str), "%s:%lx", > initrd_addr_str, size); > if (size >= sizeof(initrd_str)) > - return 1; > - } > - > - if (get_relfile_envaddr(ctx, label->kernel, "kernel_addr_r", > - NULL) < 0) { > - printf("Skipping %s for failure retrieving kernel\n", > - label->name); > - return 1; > + goto cleanup; > } > > if (label->ipappend & 0x1) { > @@ -573,7 +587,7 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) > strlen(label->append ?: ""), > strlen(ip_str), strlen(mac_str), > sizeof(bootargs)); > - return 1; > + goto cleanup; > } > > if (label->append) > @@ -588,21 +602,6 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label) > printf("append: %s\n", finalbootargs); > } > > - kernel_addr = env_get("kernel_addr_r"); > - > - /* for FIT, append the configuration identifier */ > - if (label->config) { > - int len = strlen(kernel_addr) + strlen(label->config) + 1; > - > - fit_addr = malloc(len); > - if (!fit_addr) { > - printf("malloc fail (FIT address)\n"); > - return 1; > - } > - snprintf(fit_addr, len, "%s%s", kernel_addr, label->config); > - kernel_addr = fit_addr; > - } > - > /* > * fdt usage is optional: > * It handles the following scenarios. Reviewed-by: Neil Armstrong