Dantes Posted June 4, 2023 Share Posted June 4, 2023 (edited) I had a need to change the macaddress of this device, after looking through the bootloader I spotted 2 offsets: 0x380400 macaddress NIC1 0x380406 macaddress NIC2 I would love an option in the installer, but I did it manually now: # dd if=/dev/mmcblk2 bs=16M count=1 of=bootloader 1+0 records in 1+0 records out 16777216 bytes (17 MB, 16 MiB) copied, 0,0736928 s, 228 MB/s # read_mac bootloader 0x380400 9c:d5:dc:b2:ce:1c # write_mac bootloader 0x380400 $(random_mac) write_mac bootloader 0x380400 $(random_mac) # read_mac bootloader 0x380400 b0:3f:1a:83:9a:da After scripting a couple of functions of course: ### Functions read_mac , write_mac and random_mac are hereby licensed under GPLv3 # read_mac file offset # read_mac bootloader 0x380400 # read_mac /dev/mmcblk2 0x380400 read_mac(){ dd if=$1 bs=1 count=6 skip=$(($2)) 2>/dev/null |\ xxd -l 16 -p | sed 's/../:&/g;s/^://' } # write_mac file offset macaddress # write_mac bootloader 0x380400 aa:bb:cc:dd:ee:ff # write_mac /dev/mmcblk2 0x380400 aa:bb:cc:dd:ee:ff write_mac(){ for hex in $(echo $3|tr ':' ' ');do printf "\x$hex";done |\ dd of=$file bs=1 count=6 seek=$(($offset)) conv=notrunc 2>/dev/null } # print a random macaddress random_mac(){ printf "%012x" \ $(( 0x$(hexdump -n6 -ve '/1 "%02X"' /dev/urandom) & 0xFCFFFFFFFFFF )) |\ sed 's/../:&/g;s/^://' } Edited June 4, 2023 by Dantes 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.