[U-Boot] environment in NAND
Wolfgang Wegner
wolfgang at leila.ping.de
Wed Sep 7 09:02:32 CEST 2011
Hi Arno,
On Wed, Sep 07, 2011 at 08:20:22AM +0200, Arno Steffen wrote:
> Hi Marek and Wolfgang, Thanks for your answers.
> I kept already one sector space for bad blocks, so 1st environment is
> at c.0000, 2nd at 10.0000. Blocksize is 2.0000 (so 1 block left).
> Maybe I have to announce uboot, that there is one block more
> available. But how, in wich defininition? I can declare size (which is
> just 8k) and blocksize (128k), but not block number ?!?
> I found that this below more or less relates to environment: Maybe I
> miss something here? Some look redundant to me. I adopted this from
> another board included in uboot, just changed size,location and
> redundancy.
>
> #define CONFIG_ENV_SIZE (8 << 10) /* 8 KiB */
> #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (128 << 10))
> #define CONFIG_SYS_GBL_DATA_SIZE 128 /* bytes reserved for */
>
> #define SMNAND_ENV_OFFSET 0x0C0000 /* environment starts here */
>
> #define CONFIG_SYS_ENV_SECT_SIZE boot_flash_sec
> #define CONFIG_ENV_OFFSET boot_flash_off
> #define CONFIG_ENV_ADDR boot_flash_env_addr
>
> #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
> #define CONFIG_ENV_OFFSET_REDUND 0x100000
> #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
this is my adapted openrd configuration:
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_SECT_SIZE 0x20000 /* 128K */
#define CONFIG_ENV_SIZE 0x20000 /* 128k */
#define CONFIG_ENV_ADDR 0x60000
#define CONFIG_ENV_OFFSET 0x60000 /* env starts here */
#define CONFIG_ENV_RANGE (6 * CONFIG_ENV_SIZE)
#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_RANGE)
It is too long ago I made this modification, so I am not sure (but of
course hope so) that CONFIG_ENV_SIZE_REDUND does not have to be
explicitly specified.
Concerning your hint about making CONFIG_ENV_SIZE smaller: there
is a comment in the original openrd_base.h config file
/*
* max 4k env size is enough, but in case of nand
* it has to be rounded to sector size
*/
and I simply adhered to it. It is not clear to me if this is really
a requirement or just made for convenience (having overview over the
flash usage layout).
Up to now, I did not have any problems with this setup on something
like 100+ boards.
Best regards,
Wolfgang
More information about the U-Boot
mailing list