18 lines
445 B
Bash
Executable File
18 lines
445 B
Bash
Executable File
#!/bin/bash
|
|
|
|
hw_ser_num_0=`cat /sys/fsl_otp/HW_OCOTP_CFG0|grep 0x`
|
|
hw_ser_num_1=`cat /sys/fsl_otp/HW_OCOTP_CFG1|grep 0x`
|
|
|
|
dec2hex(){
|
|
printf "0x%x" $1
|
|
}
|
|
xor_num=$(($hw_ser_num_0^$hw_ser_num_1))
|
|
hex_xor=$(dec2hex $xor_num)
|
|
#echo $hex_xor
|
|
|
|
mac0=94:40:a2:${hex_xor:2:2}:${hex_xor:6:2}:${hw_ser_num_1:8:2}
|
|
mac1=94:40:a2:${hex_xor:4:2}:${hex_xor:8:2}:${hw_ser_num_1:2:2}
|
|
echo $mac0
|
|
echo $mac1
|
|
ifconfig eth0 hw ether $mac0
|
|
ifconfig eth1 hw ether $mac1 |