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 C4126C433F5 for ; Tue, 12 Oct 2021 21:07:34 +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 CA52B60E90 for ; Tue, 12 Oct 2021 21:07:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CA52B60E90 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com 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 0C64683477; Tue, 12 Oct 2021 23:07:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com 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=konsulko.com header.i=@konsulko.com header.b="Xffl70EG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BB1428020E; Tue, 12 Oct 2021 23:07:28 +0200 (CEST) Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) (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 E9EAF83477 for ; Tue, 12 Oct 2021 23:07:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf34.google.com with SMTP id v10so473813qvb.10 for ; Tue, 12 Oct 2021 14:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=nRcxTqE5Lt86qmNO2u5eI7VBWfL4sXx1wKbHYFdarLE=; b=Xffl70EGi0j3megtKBMpe1HbiS7TZQV4nrgoaS0CvimUS1iZE9DTPYcWLDqVq9Gz40 +7DOh7P5vibPAdFHX8l/DlDw36SPznqwPePwWv1+3iN2gMJnyt9qon55SeqK69apiuq5 LPx7L/lfSRg5yWLMkMqS5E+u0bM+Ap+aaw8yY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nRcxTqE5Lt86qmNO2u5eI7VBWfL4sXx1wKbHYFdarLE=; b=5Jp1KXRdwSeXjl5KMQLocRUIJBKqgdqqyazyt1GuMFYnAdL3R3dI85xM1iLnZnQChW dMhTGxvcjYcjkVsqP7xGK1xg+jF7rGxxTCFiqAEyQ4JKo3PFaRftEVNiuTYYyAjXvrNx PXl8om/Y8Rg1rqVqIQSdLplYdzI0WQieKfnV4MCTiokORrM+twFFBSJ8iKcOicrbDoYT o0UiOnRn+4vpxeMnKE4v8rB/1yWS0DEZMmNvf1cLppK6TPgxTqg8c0wGmOqugul9Mq0h 9/cm0EnSVy1qVHZHNiHss0fxxOgOvM3UHJ6fUH+pKgErl6gMC8NJW8/7Fd/45gk7Wahi n7FA== X-Gm-Message-State: AOAM531u1WoWbFbKPumQsMwVVQUeh7Bkg30tuSTg44ASr36vhSYLAI9T pq11NW6mHMAw3xtaDXGV9OEncg== X-Google-Smtp-Source: ABdhPJxzsTjXnKNWkcW1sJVjzD0RK3mq+AgxAMurlQDaD47OyqzFpOv6UAJCElY5Aa7Po0chLPBrJw== X-Received: by 2002:a05:6214:1349:: with SMTP id b9mr33007082qvw.47.1634072843777; Tue, 12 Oct 2021 14:07:23 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-e98d-c49f-f596-1fb5.res6.spectrum.com. [2603:6081:7b01:cbda:e98d:c49f:f596:1fb5]) by smtp.gmail.com with ESMTPSA id s189sm2149315qka.100.2021.10.12.14.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 14:07:23 -0700 (PDT) Date: Tue, 12 Oct 2021 17:07:21 -0400 From: Tom Rini To: Simon Glass 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 Subject: Re: [PATCH] distro_boot: Fix bootfile env after calling boot_extlinux Message-ID: <20211012210721.GG7964@bill-the-cat> References: <20211012085544.3206394-1-art@khadas.com> <20211012194401.GF7964@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ReGtrnFZPvtbUCOi" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett 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 --ReGtrnFZPvtbUCOi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 12, 2021 at 02:31:18PM -0600, Simon Glass wrote: > Hi Tom, >=20 > 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 (call= ed > > > 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/extlin= ux/" > > > from the bootfile env. > > > > > > Solution > > > > > > Save and restore default bootfile env value when boot_extlinux is use= d. > > > > > > Example > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > 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... > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > > > 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=3D${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 >=20 > 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. --=20 Tom --ReGtrnFZPvtbUCOi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmFl+QUACgkQFHw5/5Y0 tyyfIgv5ARhuOcVbNBDhgKzk9xOqyHOG6vL/Ylz3k+Elcb2zlkxpXPV0u8ZGvP5C lvPN53O9v8Z+a++lu41r2CjR45K85KSkbLTl+NBXXnAw7OtQ5n+2umBEk5Y072S5 GyLNRagqe4UlOceIMMRvrNd2IAbmDwutEdFaHmiR6wSLZDDefvi7P1YatpPBZf8a sopTUUqv+Vw8cnqgxkbp7D17vooPucZgbxnApRuiwnCk2lgTE/4F4isgZO2xV/rm jrUUZSRuWkAaJHRAVZqp9DI7K/WNHYsrrO4q70uUtb3TiGVhbF4RVaZJw0zmFvpR X0V0YUZWA7XRXZ7EYSAhiNe3gevEzyDhEvRg+yD08hbL5fYtP0x8h+wblDEXbhMz ae6c5LmELqVDdcHgL4FRvczFF9lmnYacuUukCYwrPvQPAU08sL5rVIP2MQCBgvNs +M0hUHYAGXYag7uvtuVF0PlvDeQjaPh5OYV6wqNtRoD2S/gXNv5BmT+yCIMzEKTe urigndsy =oCIo -----END PGP SIGNATURE----- --ReGtrnFZPvtbUCOi--