
18 Jul
2011
18 Jul
'11
9:56 p.m.
On Mon, Jul 18, 2011 at 15:52, Alessio Sangalli wrote:
On 07/18/2011 10:59 AM, Mike Frysinger wrote:
although thinking about it a bit more, you probably could do it in shell. (cat <env file> | tr '\n' '\0' ; dd if=/dev/zero count=1 ibs=1) > env.bin env_size=8192 pad_size=$(( env_size - $(set -- $(du -b env.bin); echo $1) - 4)) dd if=/dev/zero ibs=$pad_size count=1 | tr '\0' '\377' >> env.bin
and then you get the crc and prepend the 4 bytes crc env.bin
Hi! I am not sure here how you would calculate the crc in the shell script. Are you suggesting there is a command "crc(1)"?
there is indeed such a command. the "xc" program suite provides one. i'm sure there are others as well like `crc32`.
$ crc env.bin 5473921d 8188 env.bin -mike