It was really confusing to deal with hexdump command in linux. Basically I am trying to get the output from the /proc/device-tree. I tried to use the hexdump but ended up with confusion. My dts contains
vvn = <0 0 2 2 0 0>;
I got a proc node under /proc/device-tree.
I tried the following command.
hexdump -v -e '4/1 "%x" " "' vvn ; echo
0000 0000 0002 0002 0000 0000
hexdump -v -e '1/4 "%x" " "' vvn ; echo
0 0 2000000 2000000 0 0
hexdump -v -e '4/1 "%x "' vvn ; echo
0 0 0 00 0 0 00 0 0 20 0 0 20 0 0 00 0 0 0
I got different output, I thought all will produce the same output. Can anyone please explain me how to use the iterationcount and bytecount of the hexdump and what it's for and How to use the format too?
Iteration count controls how may times the format will be repeated.
Byte count indicates how many byte will be format for each iteration.
Format string is the same as that of
printf
.'4/1 "%x" " "'
: iteration for 4 times: in each time, format 1 byte with "%x", and when the iteration finished, insert" "
.'1/4 "%x" " "'
: iteration for 1 time: in each time, format 4 byte with "%x", and when the iteration finished, insert" "
. This is equal to'1/4 "%x "'
'4/1 "%x "'
: iteration for 4 times: in each time, format 1 byte with "%x "; when iteration finished, eats the last space, insert nothing.I do know why hexdump eats the last space :(.