public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Question about fw_printenv settings
@ 2010-03-10  5:50 Joe Culler
  2010-03-10  6:30 ` Wolfgang Denk
  2010-03-10 10:22 ` Detlev Zundel
  0 siblings, 2 replies; 5+ messages in thread
From: Joe Culler @ 2010-03-10  5:50 UTC (permalink / raw)
  To: u-boot

Hi,

I have problems with fw_env.config in NOR flash.
Would anyone please help me solve it? Thanks.

In my board config:

ifdef CONFIG_NAND
#define CFG_NO_FLASH
#define CONFIG_ENV_IS_IN_NAND           1
#define CONFIG_ENV_OFFSET               0x400000         /* add for 2008.10 */
#define CONFIG_ENV_OFFSET_REDUND        0x404000
#define CONFIG_ENV_SIZE                 0x4000
#else
#define CONFIG_ENV_IS_IN_FLASH          1
#define CONFIG_ENV_ADDR                 (CFG_FLASH_BASE + 0x000c0000)
#define PHYS_FLASH_SIZE                 0x1000000        /* 16 MB */
#define CONFIG_ENV_SIZE                 0x20000
#define CONFIG_ENV_SECT_SIZE            0x20000
#define CONFIG_ENV_ADDR_REDUND          (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
#endif

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00dc0000 00020000 "Linux"
mtd1: 00100000 00020000 "User"
mtd2: 00100000 00020000 "Boot"

My fw_env.config setting:
/dev/mtd2              0x400000        0x20000         0x20000

but it doesn't work :(
#fw_printenv
Read error on /dev/mtd2: Success

Best regards,
Joe.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] Question about fw_printenv settings
  2010-03-10  5:50 [U-Boot] Question about fw_printenv settings Joe Culler
@ 2010-03-10  6:30 ` Wolfgang Denk
  2010-03-10  8:53   ` Joe Culler
  2010-03-10 10:22 ` Detlev Zundel
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2010-03-10  6:30 UTC (permalink / raw)
  To: u-boot

Dear Joe Culler,

In message <67a3f13e1003092150o19ed0f64y3c200378c73b55bf@mail.gmail.com> you wrote:
> 
> In my board config:
...
> #define CONFIG_ENV_ADDR_REDUND          (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)

So you have redundant envrionment, i. e. 2 copies of it in 2 different
sectors.

> My fw_env.config setting:
> /dev/mtd2              0x400000        0x20000         0x20000
> 
> but it doesn't work :(

Here you describe just one sectore - with redundant envrionment, you
must describe BOTH.

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
There are two ways to write error-free programs. Only the  third  one
works.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] Question about fw_printenv settings
  2010-03-10  6:30 ` Wolfgang Denk
@ 2010-03-10  8:53   ` Joe Culler
  2010-03-10  9:59     ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Culler @ 2010-03-10  8:53 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 10, 2010 at 2:30 PM, Wolfgang Denk  wrote:
> Dear Joe Culler,

Hi Wolfgang,

> In message <67a3f13e1003092150o19ed0f64y3c200378c73b55bf@mail.gmail.com> you wrote:
>>
>> In my board config:
> ...
>> #define CONFIG_ENV_ADDR_REDUND ? ? ? ? ?(CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
>
> So you have redundant envrionment, i. e. 2 copies of it in 2 different
> sectors.

Yes, I have redundant environment where saves some config files.

>> My fw_env.config setting:
>> /dev/mtd2 ? ? ? ? ? ? ?0x400000 ? ? ? ?0x20000 ? ? ? ? 0x20000
>>
>> but it doesn't work :(
>
> Here you describe just one sectore - with redundant envrionment, you
> must describe BOTH.

Maybe I'm stupid. I don't know how to describe my second sectore.
Would you teach me how to do? Thank you.
I thought my device offset settings was wrong since I use NOR, not
NAND....

> 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
> There are two ways to write error-free programs. Only the ?third ?one
> works.

Regards,
Joe.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] Question about fw_printenv settings
  2010-03-10  8:53   ` Joe Culler
@ 2010-03-10  9:59     ` Wolfgang Denk
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2010-03-10  9:59 UTC (permalink / raw)
  To: u-boot

Dear Joe Culler,

In message <67a3f13e1003100053g38b9bd32k845b4d43f06d132d@mail.gmail.com> you wrote:
>
> >> #define CONFIG_ENV_ADDR_REDUND          (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
...
> Yes, I have redundant environment where saves some config files.
>
> >> My fw_env.config setting:
> >> /dev/mtd2              0x400000        0x20000  >        0x20000
> >>
> >> but it doesn't work :(
> >
> > Here you describe just one sectore - with redundant envrionment, you
> > must describe BOTH.
>
> Maybe I'm stupid. I don't know how to describe my second sectore.
> Would you teach me how to do? Thank you.

Why do you not read the documentation, or have a look at the examples?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] Question about fw_printenv settings
  2010-03-10  5:50 [U-Boot] Question about fw_printenv settings Joe Culler
  2010-03-10  6:30 ` Wolfgang Denk
@ 2010-03-10 10:22 ` Detlev Zundel
  1 sibling, 0 replies; 5+ messages in thread
From: Detlev Zundel @ 2010-03-10 10:22 UTC (permalink / raw)
  To: u-boot

Hi Joe,

> Hi,
>
> I have problems with fw_env.config in NOR flash.
> Would anyone please help me solve it? Thanks.
>
> In my board config:
>
> ifdef CONFIG_NAND
> #define CFG_NO_FLASH
> #define CONFIG_ENV_IS_IN_NAND           1
> #define CONFIG_ENV_OFFSET               0x400000         /* add for 2008.10 */
> #define CONFIG_ENV_OFFSET_REDUND        0x404000
> #define CONFIG_ENV_SIZE                 0x4000
> #else
> #define CONFIG_ENV_IS_IN_FLASH          1
> #define CONFIG_ENV_ADDR                 (CFG_FLASH_BASE + 0x000c0000)
> #define PHYS_FLASH_SIZE                 0x1000000        /* 16 MB */
> #define CONFIG_ENV_SIZE                 0x20000
> #define CONFIG_ENV_SECT_SIZE            0x20000
> #define CONFIG_ENV_ADDR_REDUND          (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
> #endif

Maybe you want to reconsider these settings after fixing your current
problem.  The idea that we have an CONFIG_ENV_SIZE additionally to
CONFIG_ENV_SECT_SIZE is so that we can define an environment _smaller_
than a whole sector.  This speeds up U-Boot when calculating the CRC
over the environment.  With your settings, U-Boot will need to read the
whole 128k for this calculation.

> # cat /proc/mtd
> dev:    size   erasesize  name
> mtd0: 00dc0000 00020000 "Linux"
> mtd1: 00100000 00020000 "User"
> mtd2: 00100000 00020000 "Boot"

Are you sure these partitions are correct?  The sizes add to 15.75 MiB
whereas above a comment says 16 MiB nor flash.  Also the header above
says that the first environment is at the FLASH_BASE + 768k and the
second at FLASH_BASE + 896k.  If the partitions here are all on nor in
linear order, the environments would be somewhere in mtd0...

> My fw_env.config setting:
> /dev/mtd2              0x400000        0x20000         0x20000

How did you arrive at these settings?  The second column is the offset
into the mtd device.  So you put 4 MiB there although mtd2 is only 1
MiB.

> but it doesn't work :(
> #fw_printenv
> Read error on /dev/mtd2: Success

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-10 10:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-10  5:50 [U-Boot] Question about fw_printenv settings Joe Culler
2010-03-10  6:30 ` Wolfgang Denk
2010-03-10  8:53   ` Joe Culler
2010-03-10  9:59     ` Wolfgang Denk
2010-03-10 10:22 ` Detlev Zundel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox