All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] Verify CRC on environment?
@ 2005-05-25  9:01 Steven Scholz
  2005-05-25  9:12 ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Scholz @ 2005-05-25  9:01 UTC (permalink / raw)
  To: u-boot

Hi,

(how) can I verify the CRC of the environment using the crc32 command?

I am using CFG_ENV_ADDR_REDUND, so I guess I have to skip 5 bytes of header.
Do the two last 0x00 count?

My environment is at 10030000:

10030000: 4c 16 71 5f 00 62 6f 6f 74 64 65 6c 61 79 3d 30
10030010: 00 62 61 75 64 72 61 74 65 3d 31 31 35 32 30 30
10030020: 00 73 65 72 69 61 6c 23 3d 31 32 38 33 30 30 00
10030030: 73 74 64 69 6e 3d 73 65 72 69 61 6c 00 73 74 64
10030040: 6f 75 74 3d 73 65 72 69 61 6c 00 73 74 64 65 72
10030050: 72 3d 73 65 72 69 61 6c 00 00 3d 73 65 72 69 61
10030060: 6c 00 00 64 65 72 72 3d 73 65 72 69 61 6c 00 00
10030070: 74 64 65 72 72 3d 73 65 72 69 61 6c 00 00

That 0x7D, so 125+1 = 126 bytes

So I thought I have to calculate the crc over 126 - 5 = 0x79 bytes

crc32 10030005 0x79
CRC32 for 10030005 ... 1003007d ==> 8889f3af

But this is obviously wrong... :-(

-- 
Steven Scholz

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

* [U-Boot-Users] Verify CRC on environment?
  2005-05-25  9:01 [U-Boot-Users] Verify CRC on environment? Steven Scholz
@ 2005-05-25  9:12 ` Wolfgang Denk
  2005-05-25  9:14   ` Steven Scholz
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2005-05-25  9:12 UTC (permalink / raw)
  To: u-boot

In message <42943EDA.7020404@imc-berlin.de> you wrote:
> 
> (how) can I verify the CRC of the environment using the crc32 command?

=> help crc

> I am using CFG_ENV_ADDR_REDUND, so I guess I have to skip 5 bytes of header.

Right.

> Do the two last 0x00 count?

Yes. As does all the rest of the configured CFG_ENV_SIZE

> My environment is at 10030000:
> 
> 10030000: 4c 16 71 5f 00 62 6f 6f 74 64 65 6c 61 79 3d 30
> 10030010: 00 62 61 75 64 72 61 74 65 3d 31 31 35 32 30 30
> 10030020: 00 73 65 72 69 61 6c 23 3d 31 32 38 33 30 30 00
> 10030030: 73 74 64 69 6e 3d 73 65 72 69 61 6c 00 73 74 64
> 10030040: 6f 75 74 3d 73 65 72 69 61 6c 00 73 74 64 65 72
> 10030050: 72 3d 73 65 72 69 61 6c 00 00 3d 73 65 72 69 61
> 10030060: 6c 00 00 64 65 72 72 3d 73 65 72 69 61 6c 00 00
> 10030070: 74 64 65 72 72 3d 73 65 72 69 61 6c 00 00
> 
> That 0x7D, so 125+1 = 126 bytes
> 
> So I thought I have to calculate the crc over 126 - 5 = 0x79 bytes
> 
> crc32 10030005 0x79
> CRC32 for 10030005 ... 1003007d ==> 8889f3af
> 
> But this is obviously wrong... :-(

Yes, this is wrong. You must use "CFG_ENV_SIZE - 5" as length for the
crc command.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Objects in mirror are closer than they appear.

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

* [U-Boot-Users] Verify CRC on environment?
  2005-05-25  9:12 ` Wolfgang Denk
@ 2005-05-25  9:14   ` Steven Scholz
  2005-05-25  9:32     ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Scholz @ 2005-05-25  9:14 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:

> In message <42943EDA.7020404@imc-berlin.de> you wrote:
> 
>>(how) can I verify the CRC of the environment using the crc32 command?
> 
> 
> => help crc
> 
> 
>>I am using CFG_ENV_ADDR_REDUND, so I guess I have to skip 5 bytes of header.
> 
> 
> Right.
> 
> 
>>Do the two last 0x00 count?
> 
> 
> Yes. As does all the rest of the configured CFG_ENV_SIZE
> 
> 
>>My environment is at 10030000:
>>
>>10030000: 4c 16 71 5f 00 62 6f 6f 74 64 65 6c 61 79 3d 30
>>10030010: 00 62 61 75 64 72 61 74 65 3d 31 31 35 32 30 30
>>10030020: 00 73 65 72 69 61 6c 23 3d 31 32 38 33 30 30 00
>>10030030: 73 74 64 69 6e 3d 73 65 72 69 61 6c 00 73 74 64
>>10030040: 6f 75 74 3d 73 65 72 69 61 6c 00 73 74 64 65 72
>>10030050: 72 3d 73 65 72 69 61 6c 00 00 3d 73 65 72 69 61
>>10030060: 6c 00 00 64 65 72 72 3d 73 65 72 69 61 6c 00 00
>>10030070: 74 64 65 72 72 3d 73 65 72 69 61 6c 00 00
>>
>>That 0x7D, so 125+1 = 126 bytes
>>
>>So I thought I have to calculate the crc over 126 - 5 = 0x79 bytes
>>
>>crc32 10030005 0x79
>>CRC32 for 10030005 ... 1003007d ==> 8889f3af
>>
>>But this is obviously wrong... :-(
> 
> 
> Yes, this is wrong. You must use "CFG_ENV_SIZE - 5" as length for the
> crc command.

Hmm. But after the two last 0x00 there's "garbage" in the flash, i.e. old, 
overwritten and erased values.
So the count as well?

--
Steven

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

* [U-Boot-Users] Verify CRC on environment?
  2005-05-25  9:14   ` Steven Scholz
@ 2005-05-25  9:32     ` Wolfgang Denk
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2005-05-25  9:32 UTC (permalink / raw)
  To: u-boot

In message <429441EA.60203@imc-berlin.de> you wrote:
>
> Hmm. But after the two last 0x00 there's "garbage" in the flash, i.e. old, 
> overwritten and erased values.
> So the count as well?

Yes.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There are three principal ways to lose money: wine, women,  and  en-
gineers.  While  the first two are more pleasant, the third is by far
the more certain."                      -- Baron Rothschild, ca. 1800

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

end of thread, other threads:[~2005-05-25  9:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-25  9:01 [U-Boot-Users] Verify CRC on environment? Steven Scholz
2005-05-25  9:12 ` Wolfgang Denk
2005-05-25  9:14   ` Steven Scholz
2005-05-25  9:32     ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.