Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Apr 2018 09:22:05 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        Mori Hiroki <yamori813@yahoo.co.jp>, "freebsd-mips@freebsd.org" <freebsd-mips@freebsd.org>
Subject:   Re: od command behavior change
Message-ID:  <1522855325.49673.231.camel@freebsd.org>
In-Reply-To: <415409.96436.qm@web101706.mail.ssk.yahoo.co.jp>
References:  <967709.5440.qm@web101702.mail.ssk.yahoo.co.jp> <415409.96436.qm@web101706.mail.ssk.yahoo.co.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1522855325.49673.231.camel>