2008-03-25 07:05:11     access to the u-boot environment

Document created by Aaronwu Employee on Aug 5, 2013
Version 1Show Document
  • View in full screen mode

2008-03-25 07:05:11     access to the u-boot environment

Thomas Sauter (GERMANY)

Message: 53007    Hello,

 

I build the u-boot-tools.

I try to read the environment in MTD-Flash, but:

Warning: Bad CRC, using default environment.

The Device offset, Env. size and Flash sector size settings in the config-file are correct.

 

how can I access and change the u-Boot env variables in u-Clinux?

 

 

Thanks

Thomas

TranslateQuoteReplyEditDelete

 

 

2008-03-25 08:16:31     Re: access to the u-boot environment

Mike Frysinger (UNITED STATES)

Message: 53012    you use the u-boot-tools to easily access the environment variables ... or you read/write the sectors yourself

 

did you create /etc/fw_env.config with the correct values ?

QuoteReplyEditDelete

 

 

2008-03-25 09:01:06     Re: access to the u-boot environment

Thomas Sauter (GERMANY)

Message: 53016    Here my fw_env.config:

 

# MTD device name       Device offset   Env. size       Flash sector size

/dev/mtd0               0x0000          0x4000          0x4000

 

 

I have an  seperat partition for u-boot on serial flash m25P128.:

/dev/mtd0

 

dev:    size   erasesize  name

mtd0: 00040000 00040000 "Bootloader_Sector_0"

 

Here the output from fw_printenv:

 

root:/tmp> ./fw_printenv

Warning: Bad CRC, using default environment

bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm

bootdelay=5

baudrate=115200

 

With dd I can read the env-variables:

dd if=/dev/mtd0 of=/tmp/bla.txt skip=32 count=1

 

 

 

 

 

 

TranslateQuoteReplyEditDelete

 

 

2008-03-25 10:28:13     Re: access to the u-boot environment

Robin Getz (UNITED STATES)

Message: 53017    Thomas:

 

What version of U-Boot are you using? Are you using the default U-Boot, or did you type "save" at a U-Boot prompt, and then boot to a kernel? (I thought there was an issue with the default CRC32 being caclulated incorrect on 64-bit hosts on old versions of U-Boot).

 

-robin

QuoteReplyEditDelete

 

 

2008-03-26 00:44:44     Re: access to the u-boot environment

Mike Frysinger (UNITED STATES)

Message: 53028    if /dev/mtd0 represents all of u-boot, then an offset of '0x0000' clearly wont work as that is the start of u-boot, not the start of the environment

QuoteReplyEditDelete

 

 

2008-03-26 04:54:12     Re: access to the u-boot environment

Thomas Sauter (GERMANY)

Message: 53040    Robin:

u-boot version is 1.1.6.

I can change, add, delete and save the env-variables in u-boot.

I have added some new env variables.

After reset , no crc-error at u-boot prompt.

 

Mike:

I have copy u-boot to flash-position 0x0 .

/dev/mtd0 size is 0x40000 (256 blocks) and starts on 0x0.

 

This is the dd (skip=0) output, read with hexdump:

 

...

00001e40  48 e1 fd 03 08 e1 60 87  08 98 18 58 40 43 20 32  |H.....`....X@C 2|

00001e50  fa 67 82 c6 c3 83 02 0c  a0 5e 10 91 c1 58 f5 17  |.g.......^...X..|

00001e60  01 e8 00 00 03 30 84 04  10 00 00 00 00 00 00 00  |.....0..........|

00001e70  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

*

00004160  00 00 00 00 00 00 00 00  00 00 00 00 00 00 29 59  |..............)Y|

00004170  dd 73 62 6f 6f 74 63 6d  64 3d 72 75 6e 20 66 6c  |.sbootcmd=run fl|

00004180  61 73 68 62 6f 6f 74 00  62 6f 6f 74 64 65 6c 61  |ashboot.bootdela|

00004190  79 3d 35 00 62 61 75 64  72 61 74 65 3d 35 37 36  |y=5.baudrate=576|

000041a0  30 30 00 6c 6f 61 64 73  5f 65 63 68 6f 3d 31 00  |00.loads_echo=1.|

000041b0  61 75 74 6f 6c 6f 61 64  3d 6e 6f 00 72 6f 6f 74  |autoload=no.root|

000041c0  70 61 74 68 3d 2f 72 6f  6d 66 73 00 68 6f 73 74  |path=/romfs.host|

000041d0  6e 61 6d 65 3d 42 43 4f  4d 00 6c 6f 61 64 61 64  |name=BCOM.loadad|

.

.

.

00004770  61 64 64 72 3d 31 30 2e  31 30 2e 35 31 2e 32 32  |addr=10.10.51.22|

00004780  33 00 73 65 72 76 65 72  69 70 3d 31 30 2e 31 30  |3.serverip=10.10|

00004790  2e 35 31 2e 32 32 39 00  6b 65 72 6e 65 6c 73 69  |.51.229.kernelsi|

000047a0  7a 65 3d 30 78 64 65 65  64 62 00 00 00 00 00 00  |ze=0xdeedb......|

000047b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

*

...

 

I think, the env-Variables starts on 0x4160 and ends on 0x47b0?

What are the correct setting in fw_env.config?

Device offset= ?

Env.size= ?

Flash sector size=0x40000 (m25P128)

 

 

 

 

TranslateQuoteReplyEditDelete

 

 

2008-03-26 10:34:11     Re: access to the u-boot environment

Mike Frysinger (UNITED STATES)

Message: 53058    well, the exact flash offset value should be known to you considering you configured and compiled u-boot

 

rather than poking at the raw stream and trying to guess the offset, just consult your board configuration file

Attachments

    Outcomes