mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08:00
Merge branch 'openwrt-21.02' of https://github.com/immortalwrt/immortalwrt into openwrt-21.02
This commit is contained in:
commit
ebf353ff63
@ -154,6 +154,14 @@ macaddr_add() {
|
|||||||
echo $oui:$nic
|
echo $oui:$nic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macaddr_generate_from_mmc_cid() {
|
||||||
|
local mmc_dev=$1
|
||||||
|
|
||||||
|
local sd_hash=$(sha256sum /sys/class/block/$mmc_dev/device/cid)
|
||||||
|
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}")")"
|
||||||
|
}
|
||||||
|
|
||||||
macaddr_geteui() {
|
macaddr_geteui() {
|
||||||
local mac=$1
|
local mac=$1
|
||||||
local sep=$2
|
local sep=$2
|
||||||
|
@ -22,15 +22,6 @@ rockchip_setup_interfaces()
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_mac_from_mmc_cid()
|
|
||||||
{
|
|
||||||
local mmc_dev=$1
|
|
||||||
|
|
||||||
local sd_hash=$(sha256sum /sys/class/block/$mmc_dev/device/cid)
|
|
||||||
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()
|
nanopi_r4s_get_mac()
|
||||||
{
|
{
|
||||||
local interface=$1
|
local interface=$1
|
||||||
@ -43,7 +34,7 @@ nanopi_r4s_get_mac()
|
|||||||
address=$(macaddr_setbit_la "$address")
|
address=$(macaddr_setbit_la "$address")
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
address=$(generate_mac_from_mmc_cid mmcblk1)
|
address=$(macaddr_generate_from_mmc_cid mmcblk1)
|
||||||
if [ "$interface" = "lan" ]; then
|
if [ "$interface" = "lan" ]; then
|
||||||
address=$(macaddr_add "$address" 1)
|
address=$(macaddr_add "$address" 1)
|
||||||
fi
|
fi
|
||||||
@ -62,7 +53,7 @@ rockchip_setup_macs()
|
|||||||
case "$board" in
|
case "$board" in
|
||||||
friendlyarm,nanopi-r2c|\
|
friendlyarm,nanopi-r2c|\
|
||||||
friendlyarm,nanopi-r2s)
|
friendlyarm,nanopi-r2s)
|
||||||
wan_mac=$(generate_mac_from_mmc_cid mmcblk0)
|
wan_mac=$(macaddr_generate_from_mmc_cid mmcblk0)
|
||||||
lan_mac=$(macaddr_add "$wan_mac" 1)
|
lan_mac=$(macaddr_add "$wan_mac" 1)
|
||||||
;;
|
;;
|
||||||
friendlyarm,nanopi-r4s)
|
friendlyarm,nanopi-r4s)
|
||||||
|
@ -31,6 +31,27 @@ sunxi_setup_interfaces()
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nanopi_r1_get_mac()
|
||||||
|
{
|
||||||
|
local interface=$1
|
||||||
|
local eeprom_path="/sys/bus/i2c/devices/2-0051/eeprom"
|
||||||
|
local address
|
||||||
|
|
||||||
|
if [ -f "$eeprom_path" ]; then
|
||||||
|
address=$(get_mac_binary "$eeprom_path" 0xfa)
|
||||||
|
if [ "$interface" = "lan" ]; then
|
||||||
|
address=$(macaddr_setbit_la "$address")
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
address=$(macaddr_generate_from_mmc_cid mmcblk1)
|
||||||
|
if [ "$interface" = "lan" ]; then
|
||||||
|
address=$(macaddr_add "$address" 1)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$address"
|
||||||
|
}
|
||||||
|
|
||||||
sunxi_setup_macs()
|
sunxi_setup_macs()
|
||||||
{
|
{
|
||||||
local board="$1"
|
local board="$1"
|
||||||
@ -39,6 +60,10 @@ sunxi_setup_macs()
|
|||||||
local label_mac=""
|
local label_mac=""
|
||||||
|
|
||||||
case "$board" in
|
case "$board" in
|
||||||
|
friendlyarm,nanopi-r1)
|
||||||
|
wan_mac=$(nanopi_r1_get_mac wan)
|
||||||
|
lan_mac=$(nanopi_r1_get_mac lan)
|
||||||
|
;;
|
||||||
friendlyarm,nanopi-r1s-h5)
|
friendlyarm,nanopi-r1s-h5)
|
||||||
lan_mac=$(get_mac_binary "/sys/bus/i2c/devices/0-0051/eeprom" 0xfa)
|
lan_mac=$(get_mac_binary "/sys/bus/i2c/devices/0-0051/eeprom" 0xfa)
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user