od command behavior change
Ian Lepore
ian at freebsd.org
Wed Apr 4 15:22:14 UTC 2018
On Wed, 2018-04-04 at 15:24 +0900, Mori Hiroki wrote:
> Hi.
>
> I checked usr.bin/hexdump code. But I can't found reason.
>
> I seem j option and device file is cause of this problem.
>
> # od -N 6 -t x1 -j 4 /dev/flash/spi0s.u-boot-env
> od: /dev/flash/spi0s.u-boot-env: Invalid argument
> 0000004
>
> # od -N 6 -t x1 /dev/flash/spi0s.u-boot-env
> 0000000 50 30 00 01 00 18
>
> 0000006
>
> # dd if=/dev/flash/spi0s.u-boot-env of=/tmp/aaa
> # od -N 6 -t x1 -j 4 /tmp/aaa
> 0000004 00 18 84 32 96 00
>
> 0000012
Reads of spiflash devices must be aligned to 512 byte offsets and
lengths, and writes must be aligned to erase size (usually 4k or 64k).
This should always work right:
dd if=/dev/flash/spi0s.u-boot-env count=1 | od -N 6 -t x1 -j 4
-- Ian
More information about the freebsd-mips
mailing list