[U-Boot] [U-boot] question about one env variable size
Wolfgang Denk
wd at denx.de
Wed Feb 19 11:35:56 CET 2014
Dear TigerLiu at via-alliance.com,
In message <FE7ADED5C2218B4786C09CD97DC4C49FDAE8CF at exchbj02.viatech.com.bj> you wrote:
>
> I want to know the size limit for a single env variable.
In theory the size of the variable is only limited by the free room in
the envrionment (the size of which you configure in your board config
file).
> I have reviewed the code:
>
> 1. It seems the size limit for a single env variable is 1M bytes, right?
>
> #define MAX_ENV_SIZE (1 << 20) /* 1 MiB */
>
> (in common/cmd_nvedit.c)
Wrong. This limit applies only for the "env import" code - it is a
(theoretical) limit for the size of an environment blob that we can
import.
Note however, that you will hit other limits much earlier:
- Typically, the environment size (i. e. the room for all variables)
is a few KiB; 8...16 KiB is a reasonable size which fits even very
complex situations.
- To be able to manipulate the environment, you need to be able to
actually enter the commands, i. e. you are limited by the console
I/O Buffer Size (CONFIG_SYS_CBSIZE) and also by the print buffer
size (CONFIG_SYS_PBSIZE). In many cases, these are set to 256...
1024 bytes - only 3 boards use more (2 x 2 KiB, 1 x 4 KiB).
In general, your question makes me fear you are considering to do
something seriously wrong. The environment is not a sutiable means to
store any larger blobs of data. It is intended for a few (maybe some
ten) variables, and theier values should be not longer than typical
commands you might use on the command line - say, some 20...60
characters.
When you find that your used environment size significantly exceeds
2...4 KiB, you should lean back and review what you are doing, because
most probably you are doing something pretty much wrong.
What exactly was your reason to worry about the maximum size for env
vars?
Best regards,
Wolfgang Denk
--
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
Es sind überhaupt nur die Dummköpfe, die sich den Befehlen der Mäch-
tigen widersetzen. Um sie zu ruinieren ist es genug, ihre Befehle
treu zu erfüllen. - Peter Hacks: "Die schöne Helena"
More information about the U-Boot
mailing list