Initial commit
This commit is contained in:
46
target/linux/mvebu/base-files/lib/preinit/06_set_iface_mac
Normal file
46
target/linux/mvebu/base-files/lib/preinit/06_set_iface_mac
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright (C) 2014-2015 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE-Project.org
|
||||
#
|
||||
|
||||
preinit_set_mac_address() {
|
||||
local mac
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
case $(board_name) in
|
||||
linksys,caiman|linksys,cobra|linksys,rango|linksys,shelby|linksys,venom)
|
||||
# rename interfaces back to the way they were with 4.4
|
||||
case "$(readlink /sys/class/net/eth0)" in
|
||||
*f1070000*)
|
||||
ip link set eth0 name tmp0
|
||||
ip link set eth1 name eth0
|
||||
ip link set tmp0 name eth1
|
||||
;;
|
||||
esac
|
||||
|
||||
mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
|
||||
mac_wan=$(macaddr_setbit_la "$mac")
|
||||
ip link set dev eth1 address $mac 2>/dev/null
|
||||
ip link set dev eth0 address $mac_wan 2>/dev/null
|
||||
;;
|
||||
linksys,mamba)
|
||||
mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
|
||||
ip link set dev eth0 address $mac 2>/dev/null
|
||||
ip link set dev eth1 address $mac 2>/dev/null
|
||||
;;
|
||||
marvell,a385-db-ap|solidrun,clearfog*a1)
|
||||
# rename interfaces back to the way they were with 4.4
|
||||
case "$(readlink /sys/class/net/eth0)" in
|
||||
*f1070000*)
|
||||
ip link set eth0 name tmp0
|
||||
ip link set eth1 name eth0
|
||||
ip link set eth2 name eth1
|
||||
ip link set tmp0 name eth2
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main preinit_set_mac_address
|
||||
26
target/linux/mvebu/base-files/lib/preinit/79_move_config
Normal file
26
target/linux/mvebu/base-files/lib/preinit/79_move_config
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/upgrade/common.sh
|
||||
|
||||
move_config() {
|
||||
local partdev
|
||||
|
||||
if export_bootdevice && export_partdevice partdev 1; then
|
||||
case $(board_name) in
|
||||
cznic,turris-omnia)
|
||||
insmod nls_cp437
|
||||
insmod nls_iso8859-1
|
||||
insmod fat
|
||||
insmod vfat
|
||||
;;
|
||||
esac
|
||||
mkdir -p /boot
|
||||
mount -o rw,noatime "/dev/$partdev" /boot
|
||||
[ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
|
||||
umount /boot
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root move_config
|
||||
37
target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg
Normal file
37
target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg
Normal file
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# Copyright (C) 2014-2016 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE-Project.org
|
||||
#
|
||||
|
||||
preinit_mount_syscfg() {
|
||||
. /lib/functions.sh
|
||||
. /lib/upgrade/common.sh
|
||||
|
||||
case $(board_name) in
|
||||
linksys,caiman|linksys,cobra|linksys,mamba|linksys,rango|linksys,shelby|linksys,venom)
|
||||
needs_recovery=0
|
||||
syscfg_part=$(grep syscfg /proc/mtd |cut -c4)
|
||||
ubiattach -m $syscfg_part || needs_recovery=1
|
||||
if [ $needs_recovery -eq 1 ]
|
||||
then
|
||||
echo "ubifs syscfg partition is damaged, reformatting"
|
||||
ubidetach -m $syscfg_part
|
||||
ubiformat -y -O 2048 -q /dev/mtd$syscfg_part
|
||||
ubiattach -m $syscfg_part
|
||||
ubimkvol /dev/ubi1 -n 0 -N syscfg -t dynamic --maxavsize
|
||||
fi
|
||||
mkdir /tmp/syscfg
|
||||
mount -t ubifs ubi1:syscfg /tmp/syscfg
|
||||
[ -f "/tmp/syscfg/$BACKUP_FILE" ] && {
|
||||
echo "- config restore -"
|
||||
cd /
|
||||
mv "/tmp/syscfg/$BACKUP_FILE" /tmp
|
||||
tar xzf "/tmp/$BACKUP_FILE"
|
||||
rm -f "/tmp/$BACKUP_FILE"
|
||||
sync
|
||||
}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main preinit_mount_syscfg
|
||||
Reference in New Issue
Block a user