You can use vim and xxd:
vim -b some_binary_file
The -b
open it in binary mode - vim won't put a newline at the end of the file when you save it.
Once you have it open, do
:%!xxd
Say you have a text file with these contents:
Hello there this is a test blah blah blah blah blah blah blah blah
Running :%!xxd
in vim will produce hex output like this:
1 0000000: 4865 6c6c 6f20 7468 6572 6520 7468 6973 Hello there this
2 0000010: 2069 7320 6120 7465 7374 2062 6c61 6820 is a test blah
3 0000020: 626c 6168 2062 6c61 6820 626c 6168 2062 blah blah blah b
4 0000030: 6c61 6820 626c 6168 2062 6c61 6820 626c lah blah blah bl
5 0000040: 6168 0a ah.
To edit a byte, edit the hex value you want, and then run
:%!xxd -r
To convert the hex bytes back to binary format.
For example, changing the first 0x48
byte to 0x4a
in the hex output above:
1 0000000: 4a65 6c6c 6f20 7468 6572 6520 7468 6973 Hello there this
2 0000010: 2069 7320 6120 7465 7374 2062 6c61 6820 is a test blah
3 0000020: 626c 6168 2062 6c61 6820 626c 6168 2062 blah blah blah b
4 0000030: 6c61 6820 626c 6168 2062 6c61 6820 626c lah blah blah bl
5 0000040: 6168 0a ah
and then running :%!xxd -r
will convert the hex bytes back to binary format, which gives you this:
Jello there this is a test blah blah blah blah blah blah blah blah
Hope this helps
The word "editor" can be ambiguous without a modifier. Most people think of text editor. You seem to asking about a memory hex editor. Such a capability is more common in boot or memory programs, e.g. U-Boot, than under a kernel that protects memory. You are really asking an XY question. Why not try to turn on the fan in the bootloader, before memory protection, i.e. the MMU, is enabled? – sawdust – 2012-08-06T20:04:43.807