public
Replace 12345 with actual decimal offset from grep -abo
linux/binary_patch.md
Patching the binary so the default interface is Ethernet28 without recompiling: the default comes from the string "Ethernet1" (from KBRD_DEFAULT_IF_NAME). Replace that string in the binary.
1. Find the offset of "Ethernet1" in the binary
On the build host or device (path to kbrd may differ):
grep -abo 'Ethernet1' /path/to/kbrd
Example output: 0x12345:Ethernet1 → offset is 0x12345 (or the decimal equivalent).
If you prefer hex offset only:
strings -t x /path/to/kbrd | grep Ethernet1
2. Patch that occurrence to Ethernet28
"Ethernet1" is 9 bytes + NUL = 10 bytes. "Ethernet28" is 10 bytes + NUL = 11 bytes. Overwrite the 10 bytes at that offset with 11 bytes so the new default is Ethernet28 and the string is still NUL-terminated:
OFFSET=12345
printf 'Ethernet28\x00' | dd of=/path/to/kbrd bs=1 seek=$OFFSET conv=notrunc
Replace 12345 with the decimal offset from step 1 (e.g. echo $((0x12345)) if you have hex).
3. Verify
strings /path/to/kbrd | grep -E 'Ethernet[0-9]+'
You should see Ethernet28 and no remaining Ethernet1 for that default (or only in help text if duplicated).
4. One-liner (offset in decimal)
# Replace 12345 with actual decimal offset from grep -abo
printf 'Ethernet28\x00' | dd of=/path/to/kbrd bs=1 seek=12345 conv=notrunc
Caveat: The 11th byte overwrites whatever was immediately after Ethernet1\0 in the file (often the next character in .rodata). One byte overwrite is usually safe; if the binary behaves oddly, re-deploy an unpatched binary and use -i Ethernet28 on the command line instead of patching.