public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] make env
@ 2008-03-20 15:57 Manuel Sahm
  2008-03-20 16:04 ` Wolfgang Denk
  0 siblings, 1 reply; 17+ messages in thread
From: Manuel Sahm @ 2008-03-20 15:57 UTC (permalink / raw)
  To: u-boot

Hello

could anybody tell me how to compile the |fw_setenv and ||fw_saveenv 
binaries ?

I try to use

make ARCH=arm CROSS_COMPILE=<Path to my CrossCompiler> env

But this doesn?t work.

#error This is a kernel header. Perhaps include mtd-user.h instead ?
and a lot of error messages appaer ?

Thank you|

Best regards 

Manuel Sahm	

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

* [U-Boot-Users] make env
  2008-03-20 15:57 [U-Boot-Users] make env Manuel Sahm
@ 2008-03-20 16:04 ` Wolfgang Denk
  2008-03-20 17:56   ` Ladislav Michl
  0 siblings, 1 reply; 17+ messages in thread
From: Wolfgang Denk @ 2008-03-20 16:04 UTC (permalink / raw)
  To: u-boot

In message <47E28953.801@feig.de> you wrote:
> SGVsbG8KCmNvdWxkIGFueWJvZHkgdGVsbCBtZSBob3cgdG8gY29tcGlsZSB0aGUgfGZ3X3NldGVu
> diBhbmQgfHxmd19zYXZlZW52IApiaW5hcmllcyA/CgpJIHRyeSB0byB1c2UKCm1ha2UgQVJDSD1h
> cm0gQ1JPU1NfQ09NUElMRT08UGF0aCB0byBteSBDcm9zc0NvbXBpbGVyPiBlbnYKCkJ1dCB0aGlz
> IGRvZXNuwrR0IHdvcmsuCgojZXJyb3IgVGhpcyBpcyBhIGtlcm5lbCBoZWFkZXIuIFBlcmhhcHMg
> aW5jbHVkZSBtdGQtdXNlci5oIGluc3RlYWQgPwphbmQgYSBsb3Qgb2YgZXJyb3IgbWVzc2FnZXMg
> YXBwYWVyID8KClRoYW5rIHlvdXwKCkJlc3QgcmVnYXJkcyAKCk1hbnVlbCBTYWhtCQoKCgoKLS0t
> LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
> LS0tLS0tLS0tLS0tLQpUaGlzIFNGLm5ldCBlbWFpbCBpcyBzcG9uc29yZWQgYnk6IE1pY3Jvc29m
> dApEZWZ5IGFsbCBjaGFsbGVuZ2VzLiBNaWNyb3NvZnQoUikgVmlzdWFsIFN0dWRpbyAyMDA4Lgpo
> dHRwOi8vY2xrLmF0ZG10LmNvbS9NUlQvZ28vdnNlMDEyMDAwMDA3MG1ydC9kaXJlY3QvMDEvCl9f
> X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fClUtQm9vdC1Vc2Vy
> cyBtYWlsaW5nIGxpc3QKVS1Cb290LVVzZXJzQGxpc3RzLnNvdXJjZWZvcmdlLm5ldApodHRwczov
> L2xpc3RzLnNvdXJjZWZvcmdlLm5ldC9saXN0cy9saXN0aW5mby91LWJvb3QtdXNlcnMK

Please do not send base 64 encoded messages.

Please send plain text only.


> could anybody tell me how to compile the |fw_setenv and ||fw_saveenv 
> binaries ?

I guess (you fail to mention such a basic fact as which  version  you
are  using) that you are referring to old code. So I recommend to use
recent code (i. e. release 1.3.2).

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
"They that can give up essential liberty to obtain a little temporary
saftey deserve neither liberty not saftey." - Benjamin Franklin, 1759

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

* [U-Boot-Users] make env
  2008-03-20 16:04 ` Wolfgang Denk
@ 2008-03-20 17:56   ` Ladislav Michl
  2008-03-20 20:02     ` Wolfgang Denk
  0 siblings, 1 reply; 17+ messages in thread
From: Ladislav Michl @ 2008-03-20 17:56 UTC (permalink / raw)
  To: u-boot

On Thu, Mar 20, 2008 at 05:04:35PM +0100, Wolfgang Denk wrote:
> I guess (you fail to mention such a basic fact as which  version  you
> are  using) that you are referring to old code. So I recommend to use
> recent code (i. e. release 1.3.2).

No matter how recent version is he going to use. Related Makefile
fragment reads:
env:
	$(MAKE) -C tools/env all MTD_VERSION=${MTD_VERSION} || exit 1

which means CFLAGS etc. are not propagated to fw_setenv utility...

Best regards,
	ladis

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

* [U-Boot-Users] make env
  2008-03-20 17:56   ` Ladislav Michl
@ 2008-03-20 20:02     ` Wolfgang Denk
  2008-03-20 20:11       ` Ladislav Michl
  0 siblings, 1 reply; 17+ messages in thread
From: Wolfgang Denk @ 2008-03-20 20:02 UTC (permalink / raw)
  To: u-boot

In message <20080320175606.GA21970@michl.2n.cz> you wrote:
> On Thu, Mar 20, 2008 at 05:04:35PM +0100, Wolfgang Denk wrote:
> > I guess (you fail to mention such a basic fact as which  version  you
> > are  using) that you are referring to old code. So I recommend to use
> > recent code (i. e. release 1.3.2).
> 
> No matter how recent version is he going to use. Related Makefile
> fragment reads:
> env:
> 	$(MAKE) -C tools/env all MTD_VERSION=${MTD_VERSION} || exit 1
> 
> which means CFLAGS etc. are not propagated to fw_setenv utility...

Yes, and actually I think this is correct. What we're building is a
target Linux application, so the U-Boto specific CFLAG settings have
no meaning for this (or rather would be just dangerous).

Example:

-> make env
make -C tools/env all MTD_VERSION= || exit 1
make[1]: Entering directory `/home/wd/git/u-boot/work/tools/env'
ln -s ../../lib_generic/crc32.c crc32.c
make[1]: Leaving directory `/home/wd/git/u-boot/work/tools/env'
make[1]: Entering directory `/home/wd/git/u-boot/work/tools/env'
arm-linux-gcc -Wall -DUSE_HOSTCC crc32.c  fw_env.c  fw_env_main.c -o
fw_printenv
make[1]: Leaving directory `/home/wd/git/u-boot/work/tools/env'
-> file tools/env/fw_printenv
tools/env/fw_printenv: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped


I'm not sure what you wanted to express with your comment?

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
"I think trash is the most important manifestation of culture we have
in my lifetime."                                      - Johnny Legend

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

* [U-Boot-Users] make env
  2008-03-20 20:02     ` Wolfgang Denk
@ 2008-03-20 20:11       ` Ladislav Michl
  2008-03-20 21:27         ` Wolfgang Denk
  0 siblings, 1 reply; 17+ messages in thread
From: Ladislav Michl @ 2008-03-20 20:11 UTC (permalink / raw)
  To: u-boot

On Thu, Mar 20, 2008 at 09:02:58PM +0100, Wolfgang Denk wrote:
> Yes, and actually I think this is correct. What we're building is a
> target Linux application, so the U-Boto specific CFLAG settings have
> no meaning for this (or rather would be just dangerous).
> 
> Example:
> 
> -> make env
> make -C tools/env all MTD_VERSION= || exit 1
> make[1]: Entering directory `/home/wd/git/u-boot/work/tools/env'
> ln -s ../../lib_generic/crc32.c crc32.c
> make[1]: Leaving directory `/home/wd/git/u-boot/work/tools/env'
> make[1]: Entering directory `/home/wd/git/u-boot/work/tools/env'
> arm-linux-gcc -Wall -DUSE_HOSTCC crc32.c  fw_env.c  fw_env_main.c -o
> fw_printenv
> make[1]: Leaving directory `/home/wd/git/u-boot/work/tools/env'
> -> file tools/env/fw_printenv
> tools/env/fw_printenv: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.4.3, not stripped
> 
> I'm not sure what you wanted to express with your comment?

Well, it seems you have "properly" configured toolchain - you installed
proper kernel headers. In my case it ends with:

-> make env CROSS_COMPILE=arm-C411_L24-linux-gnu-
make -C tools/env all MTD_VERSION= || exit 1
make[1]: Entering directory `/home/ladis/src/u-boot/tools/env'
arm-C411_L24-linux-gnu-gcc -Wall -DUSE_HOSTCC crc32.c  fw_env.c
fw_env_main.c -o fw_printenv
fw_env.c:39:27: error: mtd/mtd-user.h: No such file or directory

Here I have no opportunity to tell compiler where to find that header.
I'd have to put them on some "standard" place, which could conflict with
2.4 headers. I do not want to pass U-Boot specific flags, just fw_setenv
specific.

Best regards,
	ladis

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

* [U-Boot-Users] make env
  2008-03-20 20:11       ` Ladislav Michl
@ 2008-03-20 21:27         ` Wolfgang Denk
  2008-03-20 21:33           ` Ladislav Michl
  0 siblings, 1 reply; 17+ messages in thread
From: Wolfgang Denk @ 2008-03-20 21:27 UTC (permalink / raw)
  To: u-boot

In message <20080320201156.GA22544@michl.2n.cz> you wrote:
>
> > I'm not sure what you wanted to express with your comment?
> 
> Well, it seems you have "properly" configured toolchain - you installed
> proper kernel headers. In my case it ends with:

Well, yes, a correctly configured and working toolchain is considered
a prerequisite for U-Boot development.

> fw_env.c:39:27: error: mtd/mtd-user.h: No such file or directory
> 
> Here I have no opportunity to tell compiler where to find that header.
> I'd have to put them on some "standard" place, which could conflict with
> 2.4 headers. I do not want to pass U-Boot specific flags, just fw_setenv
> specific.

It's not fw_setenv specific. You would have to do the same  when  you
cross-compile  any  other  native  Linux  application  code. The best
approach would be to fix your toolchain.

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
"The algorithm to do that is extremely nasty. You might want  to  mug
someone with it."                   - M. Devine, Computer Science 340

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

* [U-Boot-Users] make env
  2008-03-20 21:27         ` Wolfgang Denk
@ 2008-03-20 21:33           ` Ladislav Michl
  2008-03-25 12:56             ` Manuel Sahm
  0 siblings, 1 reply; 17+ messages in thread
From: Ladislav Michl @ 2008-03-20 21:33 UTC (permalink / raw)
  To: u-boot

On Thu, Mar 20, 2008 at 10:27:18PM +0100, Wolfgang Denk wrote:
> It's not fw_setenv specific. You would have to do the same  when  you
> cross-compile  any  other  native  Linux  application  code. The best
> approach would be to fix your toolchain.

Well, any other applications compile just fine. This is needed only when
you are interfacing some kernel subsystem (MTD in this case) and need
its headers. Current approach needs one toolchain for compiling fw_setenv
with 2.4 kernel and another for 2.6 kernel while there is no technical
reason not to use very same toolchain for both.

Best regards,
	ladis

PS. I'm just pointing to one minor difficulty, as I have no problem with
that. I only tried to guess where might be Manuel's problem once he
figure out MTD_VERSION variable.

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

* [U-Boot-Users] make env
  2008-03-20 21:33           ` Ladislav Michl
@ 2008-03-25 12:56             ` Manuel Sahm
  2008-03-25 13:36               ` Markus Klotzbücher
  2008-03-25 20:11               ` Wolfgang Denk
  0 siblings, 2 replies; 17+ messages in thread
From: Manuel Sahm @ 2008-03-25 12:56 UTC (permalink / raw)
  To: u-boot

Hello,

I took the U-Boot version 1.3.2; now I am able to generate the make env 
-> fw_printenv utility.

I copy the jw_printenv binary and rename it to fw_setenv.

I use the config file in the /etc directory.
I want to access a NAND flash. [Pagesize = 0x800; ERASEBLOCKSIZE=0x20000]
My uboot is in mtd1.
mtd1 is from 0x20000 ... 0x100000 in my NAND-Flash
The Uboot enviroment is from 0x60000...0x80000; the redundant from 
0x80000...0x100000

My fw_config file is:

/dev/mtd1      0x40000   0x20000   0x20000
/dev/mtd1      0x60000   0x20000   0x20000

Is this correct ?

I am able tu use fw_printenv, the variables are printed on the console
If I use fw_setenv I get errors:

fw_setenv test 1

Unlocking Flash
Done
nand_write: attempting to write not page aligned data
Erasing old enviroment
Done
Writing enviroment to /dev/mtd1: Invalid argument
Error: can?t write fw_env to flash

What?s wrong ????

Thank you very much

Manuel Sahm


Ladislav Michl schrieb:
> On Thu, Mar 20, 2008 at 10:27:18PM +0100, Wolfgang Denk wrote:
>   
>> It's not fw_setenv specific. You would have to do the same  when  you
>> cross-compile  any  other  native  Linux  application  code. The best
>> approach would be to fix your toolchain.
>>     
>
> Well, any other applications compile just fine. This is needed only when
> you are interfacing some kernel subsystem (MTD in this case) and need
> its headers. Current approach needs one toolchain for compiling fw_setenv
> with 2.4 kernel and another for 2.6 kernel while there is no technical
> reason not to use very same toolchain for both.
>
> Best regards,
> 	ladis
>
> PS. I'm just pointing to one minor difficulty, as I have no problem with
> that. I only tried to guess where might be Manuel's problem once he
> figure out MTD_VERSION variable.
>
>   

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

* [U-Boot-Users] make env
  2008-03-25 12:56             ` Manuel Sahm
@ 2008-03-25 13:36               ` Markus Klotzbücher
  2008-03-25 16:19                 ` Manuel Sahm
  2008-03-25 20:11               ` Wolfgang Denk
  1 sibling, 1 reply; 17+ messages in thread
From: Markus Klotzbücher @ 2008-03-25 13:36 UTC (permalink / raw)
  To: u-boot

Hi Manuel,

Manuel Sahm <Manuel.Sahm@feig.de> writes:

> I took the U-Boot version 1.3.2; now I am able to generate the make env 
> -> fw_printenv utility.
>
> I copy the jw_printenv binary and rename it to fw_setenv.

A (hard) link would be enough.

> I use the config file in the /etc directory.
> I want to access a NAND flash. [Pagesize = 0x800; ERASEBLOCKSIZE=0x20000]
> My uboot is in mtd1.
> mtd1 is from 0x20000 ... 0x100000 in my NAND-Flash
> The Uboot enviroment is from 0x60000...0x80000; the redundant from 
> 0x80000...0x100000
>
> My fw_config file is:
>
> /dev/mtd1      0x40000   0x20000   0x20000
> /dev/mtd1      0x60000   0x20000   0x20000
>
> Is this correct ?

Looks OK to me.

> I am able tu use fw_printenv, the variables are printed on the console
> If I use fw_setenv I get errors:
>
> fw_setenv test 1
>
> Unlocking Flash
> Done
> nand_write: attempting to write not page aligned data
> Erasing old enviroment
> Done
> Writing enviroment to /dev/mtd1: Invalid argument
> Error: can?t write fw_env to flash
>
> What?s wrong ????

I think the problem is that the fw_setenv so far only supports NOR
flash. Environment in NAND is implemented slightly different, especially
it doesn't (and can't) invalidate the former valid environment after the
updated one was written successfully. So I'm afraid you will have to
update this tool to support NAND.

Best regards

Markus Klotzbuecher

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de

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

* [U-Boot-Users] make env
  2008-03-25 13:36               ` Markus Klotzbücher
@ 2008-03-25 16:19                 ` Manuel Sahm
  2008-03-25 17:04                   ` Markus Klotzbücher
  0 siblings, 1 reply; 17+ messages in thread
From: Manuel Sahm @ 2008-03-25 16:19 UTC (permalink / raw)
  To: u-boot

Hello,

but why is there a error concerning NAND flashs if only NOR flashs are 
supported ?

"nand_write: attempting to write not page aligned data"

Thank you
Manuel Sahm

Markus Klotzb?cher schrieb:
> Hi Manuel,
>
> Manuel Sahm <Manuel.Sahm@feig.de> writes:
>
>   
>> I took the U-Boot version 1.3.2; now I am able to generate the make env 
>> -> fw_printenv utility.
>>
>> I copy the jw_printenv binary and rename it to fw_setenv.
>>     
>
> A (hard) link would be enough.
>
>   
>> I use the config file in the /etc directory.
>> I want to access a NAND flash. [Pagesize = 0x800; ERASEBLOCKSIZE=0x20000]
>> My uboot is in mtd1.
>> mtd1 is from 0x20000 ... 0x100000 in my NAND-Flash
>> The Uboot enviroment is from 0x60000...0x80000; the redundant from 
>> 0x80000...0x100000
>>
>> My fw_config file is:
>>
>> /dev/mtd1      0x40000   0x20000   0x20000
>> /dev/mtd1      0x60000   0x20000   0x20000
>>
>> Is this correct ?
>>     
>
> Looks OK to me.
>
>   
>> I am able tu use fw_printenv, the variables are printed on the console
>> If I use fw_setenv I get errors:
>>
>> fw_setenv test 1
>>
>> Unlocking Flash
>> Done
>> nand_write: attempting to write not page aligned data
>> Erasing old enviroment
>> Done
>> Writing enviroment to /dev/mtd1: Invalid argument
>> Error: can?t write fw_env to flash
>>
>> What?s wrong ????
>>     
>
> I think the problem is that the fw_setenv so far only supports NOR
> flash. Environment in NAND is implemented slightly different, especially
> it doesn't (and can't) invalidate the former valid environment after the
> updated one was written successfully. So I'm afraid you will have to
> update this tool to support NAND.
>
> Best regards
>
> Markus Klotzbuecher
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
>   

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

* [U-Boot-Users] make env
  2008-03-25 16:19                 ` Manuel Sahm
@ 2008-03-25 17:04                   ` Markus Klotzbücher
  0 siblings, 0 replies; 17+ messages in thread
From: Markus Klotzbücher @ 2008-03-25 17:04 UTC (permalink / raw)
  To: u-boot

Manuel Sahm <Manuel.Sahm@feig.de> writes:

> but why is there a error concerning NAND flashs if only NOR flashs are
> supported ?
>
> "nand_write: attempting to write not page aligned data"

Of course NAND is supported by the kernel. This is why it almost works
:-) The error is caused because the tool tries to write a single byte
using the character device /dev/mtd1 which is obviously not allowed. You
can (probably) get rid of it if you use the block device /dev/mtdblock1
in your config file. But the fw_setenv tool of course still doesn't know
about the different meanings of the NAND environment header fields.

Best regards

Markus Klotzbuecher

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de

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

* [U-Boot-Users] make env
  2008-03-25 12:56             ` Manuel Sahm
  2008-03-25 13:36               ` Markus Klotzbücher
@ 2008-03-25 20:11               ` Wolfgang Denk
  2008-04-02  9:31                 ` Manuel Sahm
  1 sibling, 1 reply; 17+ messages in thread
From: Wolfgang Denk @ 2008-03-25 20:11 UTC (permalink / raw)
  To: u-boot

In message <47E8F686.9020903@feig.de> you wrote:
> 
> I took the U-Boot version 1.3.2; now I am able to generate the make env 
> -> fw_printenv utility.
> 
> I copy the jw_printenv binary and rename it to fw_setenv.
...
> I want to access a NAND flash. [Pagesize = 0x800; ERASEBLOCKSIZE=0x20000]
...
> Is this correct ?

No. the fw_env tools are written with NOR flash support in mind. Don't
expect this to work unchanged on NAND flash.

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 ist offensichtlich, dass das menschliche Gehirn wie  ein  Computer
funktioniert.  Da  es  keine  dummen Computer gibt, gibt es also auch
keine dummen Menschen. Nur ein paar Leute, die unter DOS laufen.
                                                       -- <unbekannt>

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

* [U-Boot-Users] make env
  2008-03-25 20:11               ` Wolfgang Denk
@ 2008-04-02  9:31                 ` Manuel Sahm
  2008-04-02 10:39                   ` Wolfgang Denk
  0 siblings, 1 reply; 17+ messages in thread
From: Manuel Sahm @ 2008-04-02  9:31 UTC (permalink / raw)
  To: u-boot

Hello,

I try to modify the env toll for accessing nand flash.

My problem the structure of the enviroment:
If I understand:
4 byte crc; 1 byte flags, 0x20000-5 byte data.

The Enviroment has a size of 0x20000 bytes. There is a redundant 
enviroment too.(same size)

The CRC is over the data bytes,( not the flags byte included) , right ??

What about the flag byte, which values should I have to write here ?

Thank you very much

Manuel Sahm

Wolfgang Denk schrieb:
> In message <47E8F686.9020903@feig.de> you wrote:
>   
>> I took the U-Boot version 1.3.2; now I am able to generate the make env 
>> -> fw_printenv utility.
>>
>> I copy the jw_printenv binary and rename it to fw_setenv.
>>     
> ...
>   
>> I want to access a NAND flash. [Pagesize = 0x800; ERASEBLOCKSIZE=0x20000]
>>     
> ...
>   
>> Is this correct ?
>>     
>
> No. the fw_env tools are written with NOR flash support in mind. Don't
> expect this to work unchanged on NAND flash.
>
> Best regards,
>
> Wolfgang Denk
>
>   

-- 
Freundliche Gr??e / Best regards 

Manuel Sahm	

Research & Development

FEIG ELECTRONIC GmbH
Lange Stra?e 4
35781 Weilburg
Germany
 
Tel.:  +49 (0)6471-3109.492
Fax.:  +49 (0)6471-3109.99
email: manuel.sahm at feig.de
internet: http://www.feig.de

------------------------------------------------------------------------
Amtsgericht Limburg HRB 3178
Gesch?ftsf?hrer: Dipl.-Ing. Wolfgang Feig
------------------------------------------------------------------------

------------------------------------------------------------------------
Diese Email (eingeschlossen die Anhaenge) unterliegt Urheberrecht, die
Informationen sind vertraulich und rechtswirksam privilegiert. Der
Gebrauch dieser Email oder der Anhaenge von einem anderen als den
Adressaten ist nicht gestattet und unrechtmaessig.

This email (including any attachments) is subject to copyright, the
information in it is confidential, and it is legally privileged. Use of
this email or of any information in it other than by the addressee is
unauthorised and unlawful.
------------------------------------------------------------------------

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

* [U-Boot-Users] make env
  2008-04-02  9:31                 ` Manuel Sahm
@ 2008-04-02 10:39                   ` Wolfgang Denk
  2008-04-02 11:18                     ` Manuel Sahm
  0 siblings, 1 reply; 17+ messages in thread
From: Wolfgang Denk @ 2008-04-02 10:39 UTC (permalink / raw)
  To: u-boot

Dear Manuel,

in message <47F3528A.3000202@feig.de> you wrote:
> 
> My problem the structure of the enviroment:
> If I understand:
> 4 byte crc; 1 byte flags, 0x20000-5 byte data.

Correct - the flag byte is only present if you use redundant
environment.

> The CRC is over the data bytes,( not the flags byte included) , right ??

Correct. That's because the flasg byte indicates  the  state  of  the
environment  copy  (current  ->  bit = 1, or obsolete -> bit = 0). It
relies on the feature of NOR flash that you can  always  program  '1'
bits to '0', even single bits in a single byte.

> What about the flag byte, which values should I have to write here ?

See above. But you might have problems doing such  a  thing  on  NAND
storage.

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
I have a very small mind and must live with it.    -- Edsger Dijkstra

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

* [U-Boot-Users] make env
  2008-04-02 10:39                   ` Wolfgang Denk
@ 2008-04-02 11:18                     ` Manuel Sahm
  2008-04-02 14:33                       ` Wolfgang Denk
  2008-04-06 17:37                       ` Markus Klotzbücher
  0 siblings, 2 replies; 17+ messages in thread
From: Manuel Sahm @ 2008-04-02 11:18 UTC (permalink / raw)
  To: u-boot

Hello,

how does uboot handle this flag byte ? (i I use redundant nand)

What initial value must this flag have?
Same value for enviroment1 and enviroment2 ?

If I make a "saveenv" which env. is used, and what values are then 
written to the NAND flash to set it as aktiv/deactive ?

For example:

In Linux I want to write my own Enviroment to the redundant Env: What 
must be the value of the flag byte to set this redundant enviroment 
actik, so that UBoot will use this one ?
And: Which value do I have to write tho the other "old" enviroment in 
NAND flash, so that this one becomes deactive ?

Thank you very much

Manuel Sahm


Wolfgang Denk schrieb:
> Dear Manuel,
>
> in message <47F3528A.3000202@feig.de> you wrote:
>   
>> My problem the structure of the enviroment:
>> If I understand:
>> 4 byte crc; 1 byte flags, 0x20000-5 byte data.
>>     
>
> Correct - the flag byte is only present if you use redundant
> environment.
>
>   
>> The CRC is over the data bytes,( not the flags byte included) , right ??
>>     
>
> Correct. That's because the flasg byte indicates  the  state  of  the
> environment  copy  (current  ->  bit = 1, or obsolete -> bit = 0). It
> relies on the feature of NOR flash that you can  always  program  '1'
> bits to '0', even single bits in a single byte.
>
>   
>> What about the flag byte, which values should I have to write here ?
>>     
>
> See above. But you might have problems doing such  a  thing  on  NAND
> storage.
>
> Best regards,
>
> Wolfgang Denk
>
>   

-- 
Freundliche Gr??e / Best regards 

Manuel Sahm	

Research & Development

FEIG ELECTRONIC GmbH
Lange Stra?e 4
35781 Weilburg
Germany
 
Tel.:  +49 (0)6471-3109.492
Fax.:  +49 (0)6471-3109.99
email: manuel.sahm at feig.de
internet: http://www.feig.de

------------------------------------------------------------------------
Amtsgericht Limburg HRB 3178
Gesch?ftsf?hrer: Dipl.-Ing. Wolfgang Feig
------------------------------------------------------------------------

------------------------------------------------------------------------
Diese Email (eingeschlossen die Anhaenge) unterliegt Urheberrecht, die
Informationen sind vertraulich und rechtswirksam privilegiert. Der
Gebrauch dieser Email oder der Anhaenge von einem anderen als den
Adressaten ist nicht gestattet und unrechtmaessig.

This email (including any attachments) is subject to copyright, the
information in it is confidential, and it is legally privileged. Use of
this email or of any information in it other than by the addressee is
unauthorised and unlawful.
------------------------------------------------------------------------

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

* [U-Boot-Users] make env
  2008-04-02 11:18                     ` Manuel Sahm
@ 2008-04-02 14:33                       ` Wolfgang Denk
  2008-04-06 17:37                       ` Markus Klotzbücher
  1 sibling, 0 replies; 17+ messages in thread
From: Wolfgang Denk @ 2008-04-02 14:33 UTC (permalink / raw)
  To: u-boot

In message <47F36B7A.9080104@feig.de> you wrote:
> 
> how does uboot handle this flag byte ? (i I use redundant nand)

I already answered that. See my previous message.

> What initial value must this flag have?
> Same value for enviroment1 and enviroment2 ?

No. Please see my previous mesage, and the code.

> If I make a "saveenv" which env. is used, and what values are then 

See the code.

> And: Which value do I have to write tho the other "old" enviroment in 
> NAND flash, so that this one becomes deactive ?

RTFS...

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
Old programmers never die, they just branch to a new address.

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

* [U-Boot-Users] make env
  2008-04-02 11:18                     ` Manuel Sahm
  2008-04-02 14:33                       ` Wolfgang Denk
@ 2008-04-06 17:37                       ` Markus Klotzbücher
  1 sibling, 0 replies; 17+ messages in thread
From: Markus Klotzbücher @ 2008-04-06 17:37 UTC (permalink / raw)
  To: u-boot

Manuel Sahm <Manuel.Sahm@feig.de> writes:

> how does uboot handle this flag byte ? (i I use redundant nand)

As you can't invalidate the old NAND environment as you can with NOR
flash, counters are used instead. So for NAND, the flag byte is a
counter which gets incremented for each write. This means the
environment with the flag containing the larger value is the valid one,
except for the case when the counter overflows and the valid environment
flag holds the value 0 and the former one 255.

Actually it would make sense to use this technique for NOR flash
identically, as it would avoid one write access to the flash.

Check out common/env_nand.c for details.

Best regards

Markus Klotzbuecher

--
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de

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

end of thread, other threads:[~2008-04-06 17:37 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-20 15:57 [U-Boot-Users] make env Manuel Sahm
2008-03-20 16:04 ` Wolfgang Denk
2008-03-20 17:56   ` Ladislav Michl
2008-03-20 20:02     ` Wolfgang Denk
2008-03-20 20:11       ` Ladislav Michl
2008-03-20 21:27         ` Wolfgang Denk
2008-03-20 21:33           ` Ladislav Michl
2008-03-25 12:56             ` Manuel Sahm
2008-03-25 13:36               ` Markus Klotzbücher
2008-03-25 16:19                 ` Manuel Sahm
2008-03-25 17:04                   ` Markus Klotzbücher
2008-03-25 20:11               ` Wolfgang Denk
2008-04-02  9:31                 ` Manuel Sahm
2008-04-02 10:39                   ` Wolfgang Denk
2008-04-02 11:18                     ` Manuel Sahm
2008-04-02 14:33                       ` Wolfgang Denk
2008-04-06 17:37                       ` Markus Klotzbücher

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