From mboxrd@z Thu Jan 1 00:00:00 1970 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 CFDA5C433F5 for ; Wed, 13 Oct 2021 17:00:20 +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 5322861105 for ; Wed, 13 Oct 2021 17:00:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5322861105 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org 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 0C08183773; Wed, 13 Oct 2021 18:59:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="kL2mQ1Bi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 777C8835B6; Wed, 13 Oct 2021 18:59:13 +0200 (CEST) Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) (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 A8BE08376C for ; Wed, 13 Oct 2021 18:58:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ua1-x931.google.com with SMTP id i22so5828036ual.10 for ; Wed, 13 Oct 2021 09:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GYlGowIX5EN57kCBIiemqU7LRjDKz34a9dv2V9lR8YE=; b=kL2mQ1BixGAS0+y896w2T8OiHE7I7QyF9CQKXfzbjofbHsx4hPbGVC3PAewsT7f0Rl ne200Y3h4NZYFEjNP3lDRg9aya/9fOG/bnEp7VFcbgLoxGz7mn8QDQOg9o0jbStleCr4 kq9hQ3mupcNMN//jxr81wU+UvUCQWkTMNbGqQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GYlGowIX5EN57kCBIiemqU7LRjDKz34a9dv2V9lR8YE=; b=hqXAnHPIO6TBRkbX9QWjMOhJDV4EdeJg+OPky+mlpfQUWLVN7FEXt/vi+0jF+1d/Wp SN07QrZKNQhBWrSlyMFavoXjgEiXjcmOzCBK7YlkXj+V0bAEVz64LKoYAPuiZtmSL0PC umYIHKQegEDF+nbFIR27PrXvvMZeLlvvqm6OXyXZSv4KzCAahAGpSMgFtBApE8PJUl4T NO8KOW2BRz0M4L00SGvIu/WTdJjVh4G3UyNsQtlU04ZNgtKL+KKOgVLDgIo6n2bPNdYa jbq17KnhRiz+gXihM5zcraVHKYtp9958kjTk6o7vH5dZCkT5YIsUHThaSbcNxJrb7nnc v7zg== X-Gm-Message-State: AOAM533wy3jyOMlU5ZK6hKIcoxLJiaco2gzAR8GBFZwYhsRgLd2S0weA PIRUhcYFJPI4rB81nvW30C5Nz6wsqHBOMWrLiw8/rw== X-Google-Smtp-Source: ABdhPJxk2BXjJOanmy9XJ24kr7RFx1HCvoj7hBDlLFd9t/CeffPlrAdjop67hIg1urjheAVldyw7nt9tznAbbQANg84= X-Received: by 2002:a05:6130:321:: with SMTP id ay33mr339081uab.140.1634144328155; Wed, 13 Oct 2021 09:58:48 -0700 (PDT) MIME-Version: 1.0 References: <20211012085544.3206394-1-art@khadas.com> <20211012194401.GF7964@bill-the-cat> <20211012210721.GG7964@bill-the-cat> In-Reply-To: <20211012210721.GG7964@bill-the-cat> From: Simon Glass Date: Wed, 13 Oct 2021 10:58:37 -0600 Message-ID: Subject: Re: [PATCH] distro_boot: Fix bootfile env after calling boot_extlinux To: Tom Rini Cc: Artem Lapkin , Neil Armstrong , Tom Warren , Andre Przywara , U-Boot Mailing List , u-boot-amlogic@groups.io, art@khadas.com, nick@khadas.com, gouwa@khadas.com Content-Type: text/plain; charset="UTF-8" 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 Hi Tom, On Tue, 12 Oct 2021 at 15:07, Tom Rini wrote: > > On Tue, Oct 12, 2021 at 02:31:18PM -0600, Simon Glass wrote: > > Hi Tom, > > > > On Tue, 12 Oct 2021 at 13:44, Tom Rini wrote: > > > > > > On Tue, Oct 12, 2021 at 04:55:44PM +0800, Artem Lapkin wrote: > > > > > > > Problem > > > > > > > > PXE cannot boot normally after Sysboot changed the bootfile env (called > > > > from boot_extlinux) from the default "boot.scr.uimg" to > > > > "/boot/extlinux/extlinux.conf". > > > > > > > > In addition, an unbootable extlinux configuration will also make the PXE > > > > boot unbootable, because it will use the incorrect path "/boot/extlinux/" > > > > from the bootfile env. > > > > > > > > Solution > > > > > > > > Save and restore default bootfile env value when boot_extlinux is used. > > > > > > > > Example > > > > ================================================================ > > > > Hit SPACE in 2 seconds to stop autoboot > > > > ... is now current device > > > > Found /boot/extlinux/extlinux.conf > > > > Retrieving file: /boot/extlinux/extlinux.conf > > > > 413 bytes read in 2 ms (201.2 KiB/s) > > > > Skipping Krescue for failure retrieving kernel > > > > SCRIPT FAILED: continuing... > > > > ... > > > > Speed: 1000, full duplex > > > > BOOTP broadcast 1 > > > > DHCP client bound to address 192.168.11.151 (8 ms) > > > > Using ethernet@ff3f0000 device > > > > TFTP from server 192.168.11.1; our IP address is 192.168.11.151 > > > > Filename '/boot/extlinux/pxelinux.cfg/default'. > > > > Not retrying... > > > > ================================================================ > > > > > > > > Signed-off-by: Artem Lapkin > > > > --- > > > > include/config_distro_bootcmd.h | 2 ++ > > > > 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h > > > > index 3f724aa10f..db3d1b2362 100644 > > > > --- a/include/config_distro_bootcmd.h > > > > +++ b/include/config_distro_bootcmd.h > > > > @@ -445,7 +445,9 @@ > > > > "${devnum}:${distro_bootpart} " \ > > > > "${prefix}${boot_syslinux_conf}; then " \ > > > > "echo Found ${prefix}${boot_syslinux_conf}; " \ > > > > + "bootfile_bak=${bootfile}; " \ > > > > "run boot_extlinux; " \ > > > > + "setenv bootfile ${bootfile_bak}; " \ > > > > "echo SCRIPT FAILED: continuing...; " \ > > > > "fi\0" \ > > > > \ > > > > > > We've had this kind of problem before, and the answer is that variables > > > should be local, not global in scope. In this case, I see that the way > > > the pxe/sysboot code works is that we have to env_set("..") in one place > > > to env_get("..") in another, so I don't see a way around this. > > > > > > Reviewed-by: Tom Rini > > > > IMO a better approach will be the bootflow implementation. I hope to > > get v2 out early next week. > > I'm not sure if the bootflow way of going here would or would not have > the same problem, or perhaps a slightly different problem. At heart > here, "sysboot" calls env_set(...) and then calls in to the pxe code > which does env_get(...). So now I wonder how this would be fixed in > bootflow, since we aren't dealing with the environment directly. Here's the patch where (I believe) this problem was addressed: http://patchwork.ozlabs.org/project/uboot/patch/20210927092350.v2.11.I6a01e73ef114448e39cb6899c21f6c169e4da216@changeid/ Regards, Simon