I find xxd to be nice and convenient for simple manipulation of binary data in the terminal. However it has a limitation in that all addresses outputted by the program is limited to 32 bits. E.g.
root:/# xxd -s 0x5baae0000 /dev/sda
baae0000: 2d7c 6176 6976 6172 7c61 7469 7a61 720a -|avivar|atizar.
Notice the 5 at the beginning is gone. This means that using this directly with
xxd -r
will end up patching a region over 10 billion bytes earlier than what I want. In other words I want to e.g. do this,
root:/# echo HELLO | xxd -o 0x5baae0000 | xxd -r - /dev/sdb
but I end up having to work around this by doing something like this,
root:/# echo HELLO | xxd -o 0x5baae0000 | xxd -r -seek 0x500000000 - /dev/sdb
which adds back the missing 0x5000000 bytes offset into the target file when parsing the patch.
---
In any case I want to know if there is either a unknown/clever way to have xxd use 64 bit addresses or an alternative program that operates like xxd without these limitations?
Asked by Christer
(186 rep)
Jan 4, 2019, 08:30 PM
Last activity: Jan 31, 2019, 05:50 PM
Last activity: Jan 31, 2019, 05:50 PM