From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernhard Nortmann Date: Mon, 14 Sep 2015 15:12:35 +0200 Subject: [U-Boot] [RFC PATCH 1/2] sunxi: retrieve FEL-provided values to environment variables In-Reply-To: <55F41997.4000905@redhat.com> References: <1441289520-22749-1-git-send-email-bernhard.nortmann@web.de> <1441289520-22749-2-git-send-email-bernhard.nortmann@web.de> <55F1CD2C.9080803@redhat.com> <1442059087.24382.49.camel@hellion.org.uk> <55F41997.4000905@redhat.com> Message-ID: <55F6C7C3.3030102@web.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Ian, hello Hans! That's an interesting find, Ian - thank you. Unfortunately it seems that flagging our environment vars accordingly isn't enough (on its own) to prevent them from being written by "saveenv". I've been testing #define CONFIG_ENV_FLAGS_LIST_STATIC "fel_booted:bo,fel_scriptaddr:xo" which achieves the desired flags, but doesn't alter saveenv behaviour. Setting them to read-only ("r" access flag) doesn't help, as it won't allow the setenv_*() calls to alter the vars in the first place. As you have observed, this is a more general U-Boot problem - other 'volatile' information might end up in the environment (and saveenv) as well, e.g. "ipaddr" and "serverip" retrieved by DHCP. Regards, B. Nortmann Am 12.09.2015 um 14:24 schrieb Hans de Goede: > Hi, > > On 12-09-15 13:58, Ian Campbell wrote: >> On Thu, 2015-09-10 at 20:34 +0200, Hans de Goede wrote: >>> [...] >>> >>> What if the user interrupts auto-boot with a fel provided boot.scr >>> and then does "saveenv" ? >> >> This is an interesting question which is more generic than just these >> variable, i.e. it applies to some extent to "ipaddr" when someone does >> "dhcp ; saveenv" too. >> >> Grepping around to see if there was any special handling for ipaddr I >> came across "Vendor Parameter Protection" in the top-level README as >> well as "CONFIG_ENV_FLAGS_LIST_DEFAULT" (and _STATIC) and various >> default settings in include/env_flags.h. >> >> I think CONFIG_ENV_FLAGS_LIST_* are what we want, and we want fel* to >> be flagged "r" for read only > > Ah, yes that sounds exactly what we want, thanks for figuring that > out. > >> and perhaps given an appropriate type >> (either "d" or "x" for decimal or hex respectively, I suppose). > > Regards, > > Hans