Cleanup and extend env vars
cover Cleanup and extend env vars
Hi all,
This series does some cleanup regarding env vars, and it adds a new env var for the board revision.
Best regards,
Beno?t
PATCH 1/5 fw_env: Add env vars describing U-Boot target board
Commit 5e724ca did the same thing for env_common and env_embedded, but forgot fw_env.
--- .../tools/env/fw_env.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/env/fw_env.c +11 -0
@@ -203,6 +203,17 @@ static char default_environment[] = {#if defined(CONFIG_PCI_BOOTDELAY ) && (CONFIG_PCI_BOOTDELAY >0 ) "pcidelay=" MK_STR (CONFIG_PCI_BOOTDELAY) "\0"#endif +#ifdef CONFIG_ENV_VARS_UBOOT_CONFIG +"arch=" CONFIG_SYS_ARCH "\0" +"cpu=" CONFIG_SYS_CPU "\0" +"board=" CONFIG_SYS_BOARD "\0" +#ifdef CONFIG_SYS_VENDOR + "vendor=" CONFIG_SYS_VENDOR "\0" +#endif +#ifdef CONFIG_SYS_SOC + "soc=" CONFIG_SYS_SOC "\0" +#endif +#endif #ifdef CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_SETTINGS#endif
PATCH 1/5 fw_env: Add env vars describing U-Boot target board
Quoted 5 lines · Beno?t Th?baudeau
Commit 5e724ca did the same thing for
env_commonandenv_embedded, but forgotfw_env.Signed-off-by Beno?t Th?baudeau <[email protected]>Cc Wolfgang Denk <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120918/d3894d65/attachment.pgp>
PATCH 2/5 env_common: Add missing ethprime
In reply to Benoît ThébaudeauThe ethprime env var was missing from env_common.
--- .../common/env_common.c | 3 +++ 1 file changed, 3 insertions(+)
common/env_common.c +3 -0
@@ -80,6 +80,9 @@ const uchar default_environment[] = {#ifdef CONFIG_ETH5ADDR "eth5addr=" MK_STR(CONFIG_ETH5ADDR) "\0"#endif +#ifdef CONFIG_ETHPRIME + "ethprime=" CONFIG_ETHPRIME "\0" +#endif #ifdef CONFIG_IPADDR "ipaddr=" MK_STR(CONFIG_IPADDR) "\0"#endif
PATCH 2/5 env_common: Add missing ethprime
Quoted 4 lines · Beno?t Th?baudeau
The ethprime env var was missing from
env_common.Signed-off-by Beno?t Th?baudeau <[email protected]>Cc Wolfgang Denk <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120918/e3b1d6e0/attachment.pgp>
PATCH 3/5 env import/export: Remove from help if disabled
In reply to Benoît Thébaudeau--- .../common/cmd_nvedit.c | 4 ++++ 1 file changed, 4 insertions(+)
common/cmd_nvedit.c +4 -0
@@ -954,11 +954,15 @@ U_BOOT_CMD(#if defined(CONFIG_CMD_EDITENV ) "env edit name - edit environment variable\n"#endif +#if defined(CONFIG_CMD_EXPORTENV ) "env export [-t | -b | -c] [-s size] addr [var ...] - export environment\n" +#endif #if defined(CONFIG_CMD_GREPENV ) "env grep string [...] - search environment\n"#endif +#if defined(CONFIG_CMD_IMPORTENV )"env import [-d] [-t | -b | -c] addr [size] - import environment\n" +#endif "env print [name ...] - print environment\n"#if defined(CONFIG_CMD_RUN )"env run var [...] - run commands in an environment variable\n"
PATCH 3/5 env import/export: Remove from help if disabled
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120811/98103ab1/attachment.pgp>
PATCH 3/5 env import/export: Remove from help if disabled
In reply to Benoît ThébaudeauQuoted 3 lines · Beno?t Th?baudeau
Signed-off-by Beno?t Th?baudeau <[email protected]>Cc Wolfgang Denk <[email protected]>Acked-by Mike Frysinger <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120918/b75feb97/attachment.pgp>
PATCH 4/5 README: The ver env var is not read-only
In reply to Benoît Thébaudeau---
{u-boot-4d3c95f.orig => u-boot-4d3c95f}/README | 1 -
1 file changed, 1 deletion(-)README +0 -1
@@ -907,7 +907,6 @@ The following options need to be configured: If this variable is defined, an environment variable named "ver" is created by U-Boot showing the U-Boot version as printed by the "version" command. - This variable is readonly. - Real-Time Clock:
PATCH 4/5 README: The ver env var is not read-only
README The following options need to be configured: · line 910
Quoted 7 lines · On Friday 10 August 2012 13:45:57 Beno?t Th?baudeau wrote:
README +0
-1If this variable is defined, an environment variable named "ver" is created by U-Boot showing the U-Boot version as printed by the "version" command. - This variable is readonly.
why don't we fix it to be read-only ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120811/01ae7021/attachment.pgp>
PATCH 4/5 README: The ver env var is not read-only
Quoted 11 lines · On Saturday 11 August 2012 19:48:24 Mike Frysinger wrote:
README The following options need to be configured: · line 910
Quoted 7 lines · On Friday 10 August 2012 13:45:57 Beno?t Th?baudeau wrote:
README +0
-1If this variable is defined, an environment variable named "ver" is created by U-Boot showing the U-Boot version as printed by the "version" command. - This variable is readonly.why don't we fix it to be read-only ?
-mike
I had thought about that, but there is an issue. main_loop() sets this env var, so if ver is made read-only and the env is stored somewhere (NVRAM, etc.), then after an update of U-Boot with a newer version (stored env untouched), ver will still indicate the older version. See commit 155cb01, which forgot to update the README file, which my patch does.
Best regards,
Beno?t
PATCH 4/5 README: The ver env var is not read-only
Dear =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?=,
Quoted 5 lines · In message <[email protected]> you…
I had thought about that, but there is an issue.
main_loop()sets this env var, so if ver is made read-only and the env is stored somewhere (NVRAM, etc.), then after an update of U-Boot with a newer version (stored env untouched), ver will still indicate the older version. See commit 155cb01, which forgot to update the
No. main_loop() will always set this variable to the right value, no matter what might be stored in the environment. Only if you then change i later you may (temporarily) see a different value. But again only until you reset the board.
The correct fix for this would be the introduction of variable types, including flags like "read-only" (as for serial# or ethaddr) or "volatile" (i. e. not included in saveenv, as for filesize etc.)
I have been thinking about this for a long time already, I just didn't find time yet to implement it.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de A Vulcan can no sooner be disloyal than he can exist without breathing. -- Kirk, "The Menagerie", stardate 3012.4
PATCH 4/5 README: The ver env var is not read-only
Dear Wolfgang Denk,
Quoted 9 lines
Quoted 8 lines
I had thought about that, but there is an issue.
main_loop()sets this env var,
so if ver is made read-only and the env is stored somewhere (NVRAM, etc.), then
after an update of U-Boot with a newer version (stored env untouched), ver will
still indicate the older version. See commit 155cb01, which forgot to update the
Quoted 5 lines
No.
main_loop()will always set this variable to the right value, no matter what might be stored in the environment. Only if you then change i later you may (temporarily) see a different value. But again
only until you reset the board.
Yes, I agree. The behavior that I described is what would occur _if_ commit 155cb01 were reverted in order to make ver truly read-only like Mike asked for. The current behavior is not too bad for now.
Quoted 7 lines
The correct fix for this would be the introduction of variable types, including flags like "read-only" (as for serial# or ethaddr) or "volatile" (i. e. not included in saveenv, as for filesize etc.)
I have been thinking about this for a long time already, I just didn't
find time yet to implement it.
OK. Don't you think that the README file should be updated in some way in the meantime to reflect this, since ver is neither read-only nor "normal"?
Best regards,
Beno?t
PATCH 4/5 README: The ver env var is not read-only
Quoted 11 lines · On Sunday 12 August 2012 09:58:24 Beno?t Th?baudeau wrote:
Dear Wolfgang Denk,
Quoted 7 lines
The correct fix for this would be the introduction of variable types, including flags like "read-only" (as for serial# or ethaddr) or "volatile" (i. e. not included in saveenv, as for filesize etc.)
I have been thinking about this for a long time already, I just didn't
find time yet to implement it.OK. Don't you think that the README file should be updated in some way in the meantime to reflect this, since ver is neither read-only nor "normal"?
sure, just mention any updates to it will be lost
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120812/bfc3ff48/attachment.pgp>
PATCH 1/1 README: Update ver env var description
Commit 155cb01 replaced the read-only property of the ver env var with an auto-restoring behavior. Update the README file accordingly.
---
{u-boot-4d3c95f.orig => u-boot-4d3c95f}/README | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)README +2 -1
@@ -907,7 +907,8 @@ The following options need to be configured: If this variable is defined, an environment variable named "ver" is created by U-Boot showing the U-Boot version as printed by the "version" command. - This variable is readonly. + Any change to this variable will be reverted at the + next reset. - Real-Time Clock:
PATCH 1/1 README: Update ver env var description
Quoted 2 lines · On Monday 13 August 2012 09:01:14 Beno?t Th?baudeau wrote:
Commit 155cb01 replaced the read-only property of the ver env var with an auto-restoring behavior. Update the README file accordingly.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120817/68d866ab/attachment.pgp>
Wolfgang Denk
AppliedPATCH 1/1 README: Update ver env var description
In reply to Benoît ThébaudeauDear Beno?t Th?baudeau,
Quoted 8 lines · In message <[email protected]> you…
Commit 155cb01 replaced the read-only property of the ver env var with an auto-restoring behavior. Update the README file accordingly.
Signed-off-by Beno?t Th?baudeau <[email protected]>Cc Wolfgang Denk <[email protected]>--- {u-boot-4d3c95f.orig => u-boot-4d3c95f}/README | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "We shall reach greater and greater platitudes of achievement." - Richard J. Daley
PATCH 4/5 README: The ver env var is not read-only
In reply to Mike FrysingerDear Mike Frysinger,
Quoted 4 lines · In message <[email protected]> you wrote:
README The following options need to be configured: · line 910
Quoted 2 lines
README +0
-1- This variable is readonly.why don't we fix it to be read-only ?
Actually it is "auto-restoring". Any value written to it will be lost at the next reset, when the variable will be siigned it's original value again.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "How is this place run - is it an anarchy?" "No, I wouldn't say so; it is not that well organised..."
PATCH 5/5 Add env var giving the board revision
In reply to Benoît ThébaudeauThe board revision can be a useful env var, like its serial number.
---
{u-boot-4d3c95f.orig => u-boot-4d3c95f}/README | 21 ++++++++++----------
.../common/cmd_nvedit.c | 5 +++--
.../tools/env/fw_env.c | 5 +++--
3 files changed, 17 insertions(+), 14 deletions(-)README +11 -10
@@ -2073,13 +2073,13 @@ The following options need to be configured: - Vendor Parameter Protection: U-Boot considers the values of the environment - variables "serial#" (Board Serial Number) and - "ethaddr" (Ethernet Address) to be parameters that - are set once by the board vendor / manufacturer, and - protects these variables from casual modification by - the user. Once set, these variables are read-only, - and write or delete attempts are rejected. You can - change this behaviour: + variables "serial#" (Board Serial Number), "rev" + (Board Revision) and "ethaddr" (Ethernet Address) + to be parameters that are set once by the board + vendor / manufacturer, and protects these variables + from casual modification by the user. Once set, + these variables are read-only, and write or delete + attempts are rejected. You can change this behaviour: If CONFIG_ENV_OVERWRITE is #defined in your config file, the write protection for vendor parameters is
@@ -2090,8 +2090,8 @@ The following options need to be configured: _and_ CONFIG_OVERWRITE_ETHADDR_ONCE, a default Ethernet address is installed in the environment, which can be changed exactly ONCE by the user. [The - serial# is unaffected by this, i. e. it remains - read-only.] + serial# and rev are unaffected by this, i. e. they + remain read-only.] - Protected RAM: CONFIG_PRAM
@@ -3968,10 +3968,11 @@ depending the information provided by your boot server: serverip - see above -There are two special Environment Variables: +There are three special Environment Variables: serial# - contains hardware identification information such as type string and/or serial number + rev - hardware revision ethaddr - Ethernet address These variables can be set only once (usually during manufacturing of
common/cmd_nvedit.c +3 -2
@@ -255,12 +255,13 @@ int _do_env_set(int flag, int argc, char * const argv[]) }/* -* Some variables like "ethaddr" and "serial#" can be set only -* once and cannot be deleted; also, "ver" is readonly. +* Some variables like "ethaddr", "serial#" and "rev" can be set only +* once and cannot be deleted. */ if (ep) {/* variable exists */ #ifndef CONFIG_ENV_OVERWRITE if (strcmp (name,"serial#" ) ==0 || +strcmp (name,"rev" ) ==0 || (strcmp (name,"ethaddr" ) ==0 #if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR) && strcmp(ep->data, MK_STR(CONFIG_ETHADDR)) != 0
tools/env/fw_env.c +3 -2
@@ -405,10 +405,11 @@ int fw_env_write(char *name, char *value)if (oldval) {#ifndef CONFIG_ENV_OVERWRITE /* -* Ethernet Address and serial# can be set only once +* Ethernet Address, serial# and rev can be set only once */ if ( (strcmp (name,"serial#" ) ==0 ) || + (strcmp (name,"rev" ) ==0 ) || ((strcmp (name,"ethaddr" ) ==0 ) #if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR) && (strcmp(oldval, MK_STR(CONFIG_ETHADDR)) != 0)
@@ -474,7 +475,7 @@ int fw_env_write(char *name, char *value)* Deletes or sets environment variables. Returns -1 and sets errno error codes: * 0 - OK * EINVAL - need at least 1 argument -* EROFS - certain variables ("ethaddr", "serial#") cannot be +* EROFS - certain variables ("ethaddr", "serial#", "rev") cannot be * modified or deleted * */
PATCH 5/5 Add env var giving the board revision
Quoted 1 line · On Friday 10 August 2012 13:46:08 Beno?t Th?baudeau wrote:
The board revision can be a useful env var, like its serial number.
unless i missed something, there is no standard "rev" variable today, which means this change can easily break anyone who happens to already be using a variable named "rev".
i also don't see value here in hardcoding another variable that:
- no one is setting
- is way too generic (rev of *what* ? cpu ? board ? u-boot ?
something else ?)
- adds nothing on top of the existing "serial#"
so NAK from me
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120811/60097306/attachment.pgp>
PATCH 5/5 Add env var giving the board revision
Hi Mike,
Quoted 8 lines · On Saturday 11 August 2012 19:48:33 Mike Frysinger wrote:
Quoted 1 line · On Friday 10 August 2012 13:46:08 Beno?t Th?baudeau wrote:
The board revision can be a useful env var, like its serial number.
unless i missed something, there is no standard "rev" variable today, which
means this change can easily break anyone who happens to already be using a
variable named "rev".
I have searched such a usage in the tree, but did not find any, so this should not break anything.
Quoted 2 lines
i also don't see value here in hardcoding another variable that:
- no one is setting
Well, I am setting it for my local boards that are not yet ready for upstream, so I thought that it could also be useful for others.
Quoted 2 lines
- is way too generic (rev of *what* ? cpu ? board ? u-boot ?
something else ?)
It could be renamed to hwrev, board_rev or whatever you like. This is not really an issue. Its purpose is the board hardware revision. The CPU revision can often be read from the CPU and is printed upon startup. U-Boot's revision already has the ver env var and the version command. On the contrary, the board revision can not always be determined by analyzing the hardware (OTP, fuses, EEPROM, GPIOs, etc.), so it can be useful to have an official env var to store it in the backed up env, exactly like for the serial# env var that can not always be stored in some dedicated hardware location.
Quoted 1 line
- adds nothing on top of the existing "serial#"
This is all the contrary. If you think that a rev variable would be useless, then you can also remove the serial# variable. And if you mean that a rev variable would duplicate the serial# information, this is wrong: The serial# variable gives a UID for a board, while the rev variable would give the hardware revision of that board. These are completely different things, and the board revision can not always be easily derived from its serial number.
Quoted 2 lines
so NAK from me
-mike
Best regards,
Beno?t
PATCH 5/5 Add env var giving the board revision
Dear =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?=,
Quoted 3 lines · In message <[email protected]> you…
I have searched such a usage in the tree, but did not find any, so this should not break anything.
You cannot expect to see the real, production environments in the mainline source tree.
Quoted 8 lines
It could be renamed to hwrev,
board_revor whatever you like. This is not really an issue. Its purpose is the board hardware revision. The CPU revision can often be read from the CPU and is printed upon startup. U-Boot's revision already has the ver env var and the version command. On the contrary, the board revision can not always be determined by analyzing the hardware (OTP, fuses, EEPROM, GPIOs, etc.), so it can be useful to have an official env var to store it in the backed up env, exactly like for the serial# env var that can not always be stored in some dedicated hardware location.
As mentioned before, I don't see need for such a thing in general. Any such use is highly board specific, and vendors use different ways to address this.
I don't intend to apply this patch, sorry.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PoB = "Prisoner of Bill" -- those held captive, unwillingly or other-
wise, by the contemptible Microsoft monopoly.
-- Tom Christiansen in <[email protected]>PATCH 5/5 Add env var giving the board revision
Dear Wolfgang Denk,
Quoted 6 lines
Quoted 3 lines
I have searched such a usage in the tree, but did not find any, so this should
not break anything.You cannot expect to see the real, production environments in the mainline source tree.
Right, but the same applied to serial# and ethaddr when they were added, except if U-Boot deployment was not large enough at that time to worry you.
Quoted 16 lines
Quoted 7 lines
It could be renamed to hwrev,
board_revor whatever you like. This is not really
an issue. Its purpose is the board hardware revision. The CPU revision can often
be read from the CPU and is printed upon startup. U-Boot's revision already has
the ver env var and the version command. On the contrary, the boardQuoted 8 lines
revision can
not always be determined by analyzing the hardware (OTP, fuses, EEPROM, GPIOs,
etc.), so it can be useful to have an official env var to store it in the backed
up env, exactly like for the serial# env var that can not always be stored in
some dedicated hardware location.
Quoted 3 lines
As mentioned before, I don't see need for such a thing in general. Any such use is highly board specific, and vendors use different ways to address this.
The same applies to serial# again.
Quoted 1 line
I don't intend to apply this patch, sorry.
OK.
Best regards,
Beno?t
PATCH 5/5 Add env var giving the board revision
Dear Wolfgang Denk,
Quoted 38 lines
Quoted 7 lines
Quoted 4 lines
I have searched such a usage in the tree, but did not find any, so
this should
not break anything.You cannot expect to see the real, production environments in the mainline source tree.
Right, but the same applied to serial# and ethaddr when they were added, except
if U-Boot deployment was not large enough at that time to worry you.Quoted 21 lines
Quoted 12 lines
It could be renamed to hwrev,
board_revor whatever you like. This
is not really
an issue. Its purpose is the board hardware revision. The CPU revision can often
be read from the CPU and is printed upon startup. U-Boot's revision
already has
the ver env var and the version command. On the contrary, the board
revision can
not always be determined by analyzing the hardware (OTP, fuses,Quoted 8 lines
EEPROM, GPIOs,
etc.), so it can be useful to have an official env var to store it
in the backed
up env, exactly like for the serial# env var that can not always be
stored in
some dedicated hardware location.Quoted 4 lines
As mentioned before, I don't see need for such a thing in general. Any such use is highly board specific, and vendors use different ways
to address this.
Quoted 5 lines
The same applies to serial# again.
Quoted 1 line
I don't intend to apply this patch, sorry.
OK.
Anyway, when you will have implemented read-only and volatile flags for env vars, this patch will no longer be needed. But with the current code, there is no way board-specific code can create a board revision env var and make it read-only, except with this patch.
Best regards,
Beno?t
PATCH 5/5 Add env var giving the board revision
Dear =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?=,
Quoted 5 lines · In message <[email protected]> you…
Anyway, when you will have implemented read-only and volatile flags for env vars, this patch will no longer be needed. But with the current code, there is no way board-specific code can create a board revision env var and make it read-only, except with this patch.
Correct, so far we don't support custom read-only variables. But if we add these, then in a generic way, and definitely not for a single,
specific variable. This is a lesson we learned form experience.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The number you have dialed is imaginary. Please divide by 0 and try again.
PATCH 5/5 Add env var giving the board revision
Quoted 11 lines · Wolfgang Denk
Dear =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?=,
Quoted 4 lines · In message <[email protected]> you…
Anyway, when you will have implemented read-only and volatile flags for env vars, this patch will no longer be needed. But with the current code, there is no way board-specific code can create a board revision env var and make it read-only, except with this patch.
Correct, so far we don't support custom read-only variables. But if we add these, then in a generic way, and definitely not for a single,
specific variable. This is a lesson we learned form experience.
I didn't follow this thread, but would it be an option to create a command for these kind of things, instead of read-only variables? e.g. some like
if get revision out; then;
echo $out;
else;
echo revision not supported
fi;
Just a though, regards,
Jeroen
PATCH 5/5 Add env var giving the board revision
In reply to Benoît ThébaudeauQuoted 11 lines · On Sunday 12 August 2012 10:02:48 Beno?t Th?baudeau wrote:
Dear Wolfgang Denk,
Quoted 6 lines
Quoted 3 lines
I have searched such a usage in the tree, but did not find any, so this should
not break anything.You cannot expect to see the real, production environments in the mainline source tree.
Right, but the same applied to serial# and ethaddr when they were added, except if U-Boot deployment was not large enough at that time to worry you.
which makes all the difference in the world. those two variables were set up this way before 2002 (at least, that's according to the git history, and that's when the source code was first imported, so i can't easily check just how far back it goes). as the project grows up, policies evolve.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120812/0bcab542/attachment.pgp>
PATCH 5/5 Add env var giving the board revision
Dear Mike Frysinger,
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
I have searched such a usage in the tree, but did not find any, so
this should
not break anything.Quoted 8 lines
Quoted 2 lines
You cannot expect to see the real, production environments in the mainline source tree.
Right, but the same applied to serial# and ethaddr when they were added,
except if U-Boot deployment was not large enough at that time to worry
you.
Quoted 8 lines
which makes all the difference in the world. those two variables were set up
this way before 2002 (at least, that's according to the git history, and
that's when the source code was first imported, so i can't easily check just
how far back it goes). as the project grows up, policies evolve. -mike
OK. Actually, the only reason for which I need this patch is to make a variable read-only, and the only reason for which you reject it is because you fear that it breaks something.
So we could add a config like CONFIG_BOARD_REV_RO_VARIABLE to enable the code in my patch. But I think you won't like that either because you will find it too specific.
What about adding a config like CONFIG_READONLY_VARS that would be an array initializer containing the names of the board-specific variables to make read-only? _do_env_set() and fw_env_write() would use it besides the hard-coded serial# and the like. That would give something like:
#define CONFIG_READONLY_VARS {"my_ro_var1", "my_ro_var2", "board_rev"} That would be a very simple solution to make everyone happy before Wolfgang implements a more sophisticated solution with read-only and volatile flags. What do you think?
Best regards,
Beno?t
PATCH 5/5 Add env var giving the board revision
Dear =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?=,
Quoted 8 lines · In message <[email protected]> you…
OK. Actually, the only reason for which I need this patch is to make a variable read-only, and the only reason for which you reject it is because you fear that it breaks something.
So we could add a config like
CONFIG_BOARD_REV_RO_VARIABLEto enable the code in my patch. But I think you won't like that either because you will find it too specific.
No, this may solve your problem, but will never scale for any real life use.
Quoted 8 lines
What about adding a config like
CONFIG_READONLY_VARSthat would be an array initializer containing the names of the board-specific variables to make read-only?_do_env_set()andfw_env_write()would use it besides the hard-coded serial# and the like. That would give something like:
#defineCONFIG_READONLY_VARS{"my_ro_var1", "my_ro_var2", "board_rev"} That would be a very simple solution to make everyone happy before Wolfgang implements a more sophisticated solution with read-only and volatile flags. What do you think?
Please feel free to add this to your local code.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de backups: always in season, never out of style.
PATCH 5/5 Add env var giving the board revision
Dear Wolfgang Denk,
Quoted 6 lines
Quoted 6 lines
OK. Actually, the only reason for which I need this patch is to make a variable
read-only, and the only reason for which you reject it is because you fear that
it breaks something.
Quoted 8 lines
Quoted 5 lines
So we could add a config like
CONFIG_BOARD_REV_RO_VARIABLEto enable the code in
my patch. But I think you won't like that either because you will find it too
specific.No, this may solve your problem, but will never scale for any real life use.
OK.
Quoted 15 lines
Quoted 6 lines
What about adding a config like
CONFIG_READONLY_VARSthat would be an array
initializer containing the names of the board-specific variables to make
read-only?_do_env_set()andfw_env_write()would use it besides the hard-codedQuoted 8 lines
serial# and the like. That would give something like:
#defineCONFIG_READONLY_VARS{"my_ro_var1", "my_ro_var2", "board_rev"}
That would be a very simple solution to make everyone happy before Wolfgang
implements a more sophisticated solution with read-only and volatile flags. What
do you think?
Quoted 1 line
Please feel free to add this to your local code.
By "local", do you mean that this new suggestion would still not be generic enough for you to be interested in it for a patch?
Best regards,
Beno?t
PATCH 5/5 Add env var giving the board revision
Dear =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?=,
Quoted 5 lines · In message <[email protected]> you…
Quoted 2 lines
Please feel free to add this to your local code.
By "local", do you mean that this new suggestion would still not be generic enough for you to be interested in it for a patch?
Correct.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de G's Third Law: In spite of all evidence to the contra- ry, the entire universe is composed of only two basic substances: magic and bullshit. H's Dictum: There is no magic ...
PATCH 5/5 Add env var giving the board revision
In reply to Benoît ThébaudeauQuoted 3 lines · On Sunday 12 August 2012 13:11:03 Beno?t Th?baudeau wrote:
OK. Actually, the only reason for which I need this patch is to make a variable read-only, and the only reason for which you reject it is because you fear that it breaks something.
and because it bloats the codebase for 0 gain for the vast majority of boards (every one currently in the tree).
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120812/b5a58243/attachment.pgp>
PATCH 5/5 Add env var giving the board revision
In reply to Benoît ThébaudeauDear =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?=,
Quoted 6 lines · In message <[email protected]> you…
Quoted 3 lines
You cannot expect to see the real, production environments in the mainline source tree.
Right, but the same applied to serial# and ethaddr when they were added, except if U-Boot deployment was not large enough at that time to worry you.
Did you check when these were added? This was long before the project even was called U-Boot... IIRC they were there right from the beginning when I implemented the first version of the environment...
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Q: Why do mountain climbers rope themselves together? A: To prevent the sensible ones from going home.
PATCH 5/5 Add env var giving the board revision
In reply to Benoît ThébaudeauDear =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?=,
Quoted 1 line · In message <[email protected]> you…
The board revision can be a useful env var, like its serial number.
It can be useful, but it appears not many boards needed it so far, so I suggest we leave as is; boards that want such a thing can implement it easily in their board specific code.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "We have the right to survive!" "Not be killing others." -- Deela and Kirk, "Wink of An Eye", stardate 5710.5