1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

Add base files for BPI-R2

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-04-11 19:09:55 +02:00
parent b2caee7b64
commit 1b9de2ad9e
4 changed files with 256 additions and 0 deletions

View file

@ -0,0 +1,47 @@
#!/bin/sh
# Copyright (C) 2018 OpenWrt.org
RECOVERY_PART=/dev/mmcblk0p1
preinit_set_mac_address() {
local mac
. /lib/functions.sh
. /lib/functions/system.sh
case $(board_name) in
unielec,u7623-02-emmc-512m)
if [ -b $RECOVERY_PART ]; then
insmod nls_cp437
insmod nls_iso8859-1
insmod fat
insmod vfat
mkdir -p /tmp/recovery
mount -o rw,noatime $RECOVERY_PART /tmp/recovery
if [ -f "/tmp/recovery/mac_addr" ];
then
mac=$(cat /tmp/recovery/mac_addr)
else
mac=$(cat /sys/class/net/eth0/address)
echo "$mac" > /tmp/recovery/mac_addr
fi
sync
umount /tmp/recovery
rm -rf /tmp/recovery
fi
ip link set dev wan address $mac 2> /dev/null
mac=$(macaddr_add $mac 1)
ip link set dev lan0 address $mac 2>/dev/null
ip link set dev lan1 address $mac 2>/dev/null
ip link set dev lan2 address $mac 2>/dev/null
ip link set dev lan3 address $mac 2>/dev/null
;;
esac
}
boot_hook_add preinit_main preinit_set_mac_address

View file

@ -0,0 +1,19 @@
#!/bin/sh
# Copyright (C) 2012-2015 OpenWrt.org
move_config() {
local partdev
. /lib/upgrade/common.sh
if export_bootdevice && export_partdevice partdev -1; then
if mount -t vfat -o rw,noatime "/dev/$partdev" /mnt; then
if [ -f /mnt/sysupgrade.tgz ]; then
mv -f /mnt/sysupgrade.tgz /
fi
umount /mnt
fi
fi
}
boot_hook_add preinit_mount_root move_config