Skip to content

Commit

Permalink
rockchip: use generate_mac_from_mmc_cid for emmc target
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf authored and pull[bot] committed Jan 18, 2024
1 parent 4ee30b7 commit 2612864
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions target/linux/rockchip/armv8/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ rockchip_setup_interfaces()
esac
}

generate_mac_from_mmc_cid()
{
local sd_hash=$(sha256sum /sys/class/block/mmcblk*/device/cid | head -n 1)
local mac_base=$(macaddr_canonicalize "$(echo "${sd_hash}" | dd bs=1 count=12 2>/dev/null)")
echo "$(macaddr_unsetbit_mc "$(macaddr_setbit_la "${mac_base}")")"
}

nanopi_r4s_get_mac()
{
local interface=$1
Expand All @@ -58,7 +65,7 @@ nanopi_r4s_get_mac()
address=$(macaddr_setbit_la "$address")
fi
else
address=$(macaddr_generate_from_mmc_cid mmcblk1)
address=$(generate_mac_from_mmc_cid)
if [ "$interface" = "lan" ]; then
address=$(macaddr_add "$address" 1)
fi
Expand Down Expand Up @@ -92,7 +99,7 @@ rockchip_setup_macs()
sharevdi,h3399pc|\
sharevdi,guangmiao-g4c|\
rocktech,mpc1903)
wan_mac=$(macaddr_generate_from_mmc_cid mmcblk0)
wan_mac=$(generate_mac_from_mmc_cid)
lan_mac=$(macaddr_add "$wan_mac" +1)
;;
friendlyarm,nanopi-r4s|\
Expand Down

0 comments on commit 2612864

Please sign in to comment.