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 5383AC433FE for ; Sun, 9 Oct 2022 13:03:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CEDD484DFC; Sun, 9 Oct 2022 15:03:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.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=kernel.org header.i=@kernel.org header.b="VQJagoBC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A360584DFC; Sun, 9 Oct 2022 15:03:11 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 094C684485 for ; Sun, 9 Oct 2022 15:03:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8BD2AB80C74; Sun, 9 Oct 2022 13:03:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E01CDC433D6; Sun, 9 Oct 2022 13:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665320586; bh=9Vt8sncNW/h5aeqYCHuvmQT4y6RSz29G8PMDJgrm/RI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VQJagoBCRaQuOkdgL3P7hj7pawgVmLRskWdZc9cKFgIyzJp2dcenOmC038KiTHw+Y qfuNcAcnlK/ac/apJfo/WG4vAgeJHUBq+VHWkI425JHJ9Mq7TYsSLN1r2R/Sk/nM2x DiOI3+toehy8gfRIbFALbvydWu7rAbZHydvyW0nfusUauA6NRrsnsGog6HIL9iQoOT kig8gpbH0D6M/Kw7dUlXEvbml+kfF/GnrTHV+zNvRDiM2GuEdJOMFdd8IjC0MJQlUg coLOwp93JEbOXks/3X304Q0mWyklCEDM0J3V91KJzwV/5Kb9h8zXYbTGOE8WJe0GNO 3CrR7V+pweoVA== Received: by pali.im (Postfix) id 67CC37C1; Sun, 9 Oct 2022 15:03:03 +0200 (CEST) Date: Sun, 9 Oct 2022 15:03:03 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Tom Rini Cc: Troy Kisky , Joe Hershberger , Wolfgang Denk , Simon Glass , u-boot@lists.denx.de Subject: Re: [PATCH 2/2] Nokia RX-51: Remove CONFIG_PREBOOT from defconfig Message-ID: <20221009130303.ujexwmjxx4raw4xe@pali> References: <20220710114256.27322-1-pali@kernel.org> <20220710114256.27322-2-pali@kernel.org> <20220725212100.GG1146598@bill-the-cat> <20220727183441.hkyz2q333kvht2dw@pali> <20220727184823.GA1146598@bill-the-cat> <20220727185201.ck33fl6uqqskon2k@pali> <20220727185820.GB1146598@bill-the-cat> <20220727190115.mdioeacusmgpwgbd@pali> <20220727190805.GC1146598@bill-the-cat> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220727190805.GC1146598@bill-the-cat> User-Agent: NeoMutt/20180716 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 On Wednesday 27 July 2022 15:08:05 Tom Rini wrote: > On Wed, Jul 27, 2022 at 09:01:15PM +0200, Pali Rohár wrote: > > On Wednesday 27 July 2022 14:58:20 Tom Rini wrote: > > > On Wed, Jul 27, 2022 at 08:52:01PM +0200, Pali Rohár wrote: > > > > On Wednesday 27 July 2022 14:48:23 Tom Rini wrote: > > > > > On Wed, Jul 27, 2022 at 08:34:41PM +0200, Pali Rohár wrote: > > > > > > On Monday 25 July 2022 17:21:00 Tom Rini wrote: > > > > > > > On Sun, Jul 10, 2022 at 01:42:56PM +0200, Pali Rohár wrote: > > > > > > > > > > > > > > > CONFIG_PREBOOT just cause putting "preboot=CONFIG_PREBOOT" into env list. > > > > > > > > Value CONFIG_PREBOOT="run preboot" in defconfig is just nonsense and does > > > > > > > > not do anything useful (it is infinite recursion). Config file for this > > > > > > > > board already contains default preboot= env variable with correct value, > > > > > > > > which has higher priority than CONFIG_PREBOOT and this is reason why > > > > > > > > nonsense CONFIG_PREBOOT is ignored. > > > > > > > > > > > > > > > > Remove nonsense and unused CONFIG_PREBOOT from nokia_rx51_defconfig file. > > > > > > > > > > > > > > > > Signed-off-by: Pali Rohár > > > > > > > > > > > > > > Applied to u-boot/master, thanks! > > > > > > > > > > > > Patch 1/2 is missing. > > > > > > > > > > Sorry if I was unclear enough in the rest of the emails, I'm not > > > > > applying 1/2. The empty string is fine enough (again, other variables > > > > > have this issue). Unless I missed something and there's a run-time > > > > > failure that 1/2 resolves? > > > > > > > > The issue is that preboot= variable is defined in ENV array two times. > > > > Once in Kconfig and second time in regular environment define. > > > > > > > > It is just coincidence that the definition from Kconfig is ignored > > > > because currently it is put _after_ the regular preboot= definition. But > > > > this is fragile and probably some unrelated change/patch could change > > > > this behavior. > > > > > > > > We really do not want two preboot= definitions in ENV array and pray > > > > that the correct one would be used by U-Boot at runtime. > > > > > > It's not coincidence, it's down to link order. So it's not going to > > > break anytime soon. And it's not just preboot that's in this situation. > > > > It is not linker order, but rather order in which are specified > > preprocessor macros... > > Ah right, sorry, I was thinking of something else I found when doing > CONFIG_EXTRA_ENV_TEXT / CONFIG_EXTRA_ENV_SETTINGS stuff. > > > And what else is in the same situation as preboot? I just do not see > > other variable which is defined two times. > > Right so it's all from include/env_default.h yes? CONFIG_EXTRA_ENV_TEXT > and then CONFIG_EXTRA_ENV_SETTINGS win. And pretty much everything else > in that file that has a CONFIG knob to it either has a different bit of > Kconfig "fun" to avoid the situation PREBOOT has or is already in the > same boat. > > > > A more generic approach to deal with this would be appreciated. > > Which is why I said this. How we're doing this right now isn't great > and isn't super user friendly. I don't want to have to repeat the logic > you do in 1/2 for all of the CONFIG options in env_default.h that aren't > already converted to Kconfig. But this is how it is expressed in Kconfig (for string options). For example in kernel there was recently fixes for specifying -mcpu powerpc gcc option via Kconfig CONFIG_TARGET_CPU string option and there is also corresponding Kconfig CONFIG_TARGET_CPU_BOOL option which has same meaning as my *_DEFINED option. If you do not want to do it then do not use Kconfig for those options. Generic better approach is to move these settings out of the Kconfig, but this is something which you do not want to do it. It is pretty simple, if you are going to use tool which is not ideal or designed for some purpose then you need to deal with it. I just described one example which I saw recently used in kernel. In my opinion, options which use, call or contains parts of u-boot script should _not_ be in Kconfig; but rather in CONFIG_EXTRA_ENV_SETTINGS because it refers directly to other "run" variables defined in that CONFIG_EXTRA_ENV_SETTINGS.