mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* crc32 command
@ 2011-05-13 15:54 Benoît Burnichon
  2011-05-13 17:22 ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Benoît Burnichon @ 2011-05-13 15:54 UTC (permalink / raw)
  To: barebox

Hi all,

I want to verify the version downloaded by tftp before installing it.

I have the file on my workstation:

$ cksum /var/lib/tftpboot/uImage-pcm038 
2156276197 2317276 /var/lib/tftpboot/uImage-pcm038

Under my barebox, I then try to verify the file:

barebox:/ crc32
Usage: crc32 [OPTION] [AREA]
Calculate a crc32 checksum of a memory area
Options:
  -f <file>   Use file instead of memory
  -v <crc>    Verfify

barebox:/ crc32 -f uImage-pcm038 -v 2156276197 0+2317276
CRC32 for uImage-pcm038 0x00000000 ... 0x00235bdb ==> 0xd484eccb != 0x808629e5 ** ERROR **
barebox:/ crc32 -f uImage-pcm038                        
CRC32 for uImage-pcm038 0x00000000 ... 0x00235bdb ==> 0xd484eccb


I have barebox-2010.11.0


How can I use crc32 to verify the files I transfer?

Regards,

Ben

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: crc32 command
  2011-05-13 15:54 crc32 command Benoît Burnichon
@ 2011-05-13 17:22 ` Sascha Hauer
  2011-05-14  7:09   ` Peter Korsgaard
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2011-05-13 17:22 UTC (permalink / raw)
  To: Benoît Burnichon; +Cc: barebox

Hi Benoit,

On Fri, May 13, 2011 at 05:54:00PM +0200, Benoît Burnichon wrote:
> Hi all,
> 
> I want to verify the version downloaded by tftp before installing it.
> 
> I have the file on my workstation:
> 
> $ cksum /var/lib/tftpboot/uImage-pcm038 
> 2156276197 2317276 /var/lib/tftpboot/uImage-pcm038
> 
> Under my barebox, I then try to verify the file:
> 
> barebox:/ crc32
> Usage: crc32 [OPTION] [AREA]
> Calculate a crc32 checksum of a memory area
> Options:
>   -f <file>   Use file instead of memory
>   -v <crc>    Verfify
> 
> barebox:/ crc32 -f uImage-pcm038 -v 2156276197 0+2317276
> CRC32 for uImage-pcm038 0x00000000 ... 0x00235bdb ==> 0xd484eccb != 0x808629e5 ** ERROR **
> barebox:/ crc32 -f uImage-pcm038                        
> CRC32 for uImage-pcm038 0x00000000 ... 0x00235bdb ==> 0xd484eccb
> 
> 
> I have barebox-2010.11.0
> 
> 
> How can I use crc32 to verify the files I transfer?

The algorithms differ, so cksum is not usable here. Got curious myself
and looked around in the net. the zip tool is usable for this:

zip test.zip barebox.bin; unzip -lv test.zip

Ok, this sucks, but there is also a standalone program (haven't tested
this). See here:

http://docwiki.gumstix.org/index.php/Calculating_32_bit_CRCs

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: crc32 command
  2011-05-13 17:22 ` Sascha Hauer
@ 2011-05-14  7:09   ` Peter Korsgaard
  2011-05-14 17:16     ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2011-05-14  7:09 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

>>>>> "Sascha" == Sascha Hauer <s.hauer@pengutronix.de> writes:

 >> How can I use crc32 to verify the files I transfer?

 Sascha> The algorithms differ, so cksum is not usable here. Got curious
 Sascha> myself and looked around in the net. the zip tool is usable for
 Sascha> this:

 Sascha> zip test.zip barebox.bin; unzip -lv test.zip

 Sascha> Ok, this sucks, but there is also a standalone program (haven't tested
 Sascha> this). See here:

 Sascha> http://docwiki.gumstix.org/index.php/Calculating_32_bit_CRCs

The crc32 command is largely legacy from u-boot. Would there be interest
in a cksum command (it's afaik just like the normal crc32 except it also
uses the length) or md5/sha1/sha256sum? We have all the infrastructure,
so it should be easy to add.

-- 
Bye, Peter Korsgaard

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: crc32 command
  2011-05-14  7:09   ` Peter Korsgaard
@ 2011-05-14 17:16     ` Sascha Hauer
  2011-05-14 21:50       ` Peter Korsgaard
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2011-05-14 17:16 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: barebox

On Sat, May 14, 2011 at 09:09:55AM +0200, Peter Korsgaard wrote:
> >>>>> "Sascha" == Sascha Hauer <s.hauer@pengutronix.de> writes:
> 
>  >> How can I use crc32 to verify the files I transfer?
> 
>  Sascha> The algorithms differ, so cksum is not usable here. Got curious
>  Sascha> myself and looked around in the net. the zip tool is usable for
>  Sascha> this:
> 
>  Sascha> zip test.zip barebox.bin; unzip -lv test.zip
> 
>  Sascha> Ok, this sucks, but there is also a standalone program (haven't tested
>  Sascha> this). See here:
> 
>  Sascha> http://docwiki.gumstix.org/index.php/Calculating_32_bit_CRCs
> 
> The crc32 command is largely legacy from u-boot. Would there be interest
> in a cksum command (it's afaik just like the normal crc32 except it also
> uses the length) or md5/sha1/sha256sum? We have all the infrastructure,
> so it should be easy to add.

md5sum would be very useful. Would it add much to the binary space?
(If yes, that would be no reason to not have it, but probably more
boards will enable this when it's small)

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: crc32 command
  2011-05-14 17:16     ` Sascha Hauer
@ 2011-05-14 21:50       ` Peter Korsgaard
  2011-05-15  8:50         ` Alexey Galakhov
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2011-05-14 21:50 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

>>>>> "Sascha" == Sascha Hauer <s.hauer@pengutronix.de> writes:

Hi,

 >> The crc32 command is largely legacy from u-boot. Would there be interest
 >> in a cksum command (it's afaik just like the normal crc32 except it also
 >> uses the length) or md5/sha1/sha256sum? We have all the infrastructure,
 >> so it should be easy to add.

 Sascha> md5sum would be very useful. Would it add much to the binary space?

I don't think so. I did a quick little proof of concept implementation
(which would work for any algorithm supported by the digest stuff) and
it ended up like:

 size lib/md5.o common/digest.o commands/md5.o
   text	   data	    bss	    dec	    hex	filename
   2841	    152	      0	   2993	    bb1	lib/md5.o
    339	     16	      0	    355	    163	common/digest.o
    969	      0	      0	    969	    3c9	commands/md5.o

So less than 1K if you already use md5/digest for something else,
otherwise ~4K.

I'll clean up the code a bit more and send a patch.

-- 
Bye, Peter Korsgaard

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: crc32 command
  2011-05-14 21:50       ` Peter Korsgaard
@ 2011-05-15  8:50         ` Alexey Galakhov
  0 siblings, 0 replies; 6+ messages in thread
From: Alexey Galakhov @ 2011-05-15  8:50 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: barebox


[-- Attachment #1.1: Type: text/plain, Size: 293 bytes --]

>  Sascha> md5sum would be very useful. Would it add much to the binary
> space?
>

Since there are already digest algorithms in lib/, the implementation will
be just couple of lines of the code. It will be as large as lib/ digests
are.

I'd like to write the code if nobody else do.

--
Alex

[-- Attachment #1.2: Type: text/html, Size: 487 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2011-05-15  8:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-13 15:54 crc32 command Benoît Burnichon
2011-05-13 17:22 ` Sascha Hauer
2011-05-14  7:09   ` Peter Korsgaard
2011-05-14 17:16     ` Sascha Hauer
2011-05-14 21:50       ` Peter Korsgaard
2011-05-15  8:50         ` Alexey Galakhov

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