Initial commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
set_preinit_iface() {
|
||||
ifconfig eth0 up
|
||||
ifname=lan1
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main set_preinit_iface
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set_rps_sock_flow() {
|
||||
echo 1024 > /proc/sys/net/core/rps_sock_flow_entries
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main set_rps_sock_flow
|
||||
|
||||
@@ -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"*)
|
||||
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
|
||||
21
target/linux/mediatek/base-files/lib/preinit/79_move_config
Normal file
21
target/linux/mediatek/base-files/lib/preinit/79_move_config
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
. /lib/upgrade/common.sh
|
||||
|
||||
RECOVERY_PART=/dev/mmcblk0p1
|
||||
|
||||
move_config() {
|
||||
if [ -b $RECOVERY_PART ]; then
|
||||
insmod nls_cp437
|
||||
insmod nls_iso8859-1
|
||||
insmod fat
|
||||
insmod vfat
|
||||
mkdir -p /recovery
|
||||
mount -o rw,noatime $RECOVERY_PART /recovery
|
||||
[ -f "/recovery/$BACKUP_FILE" ] && mv -f "/recovery/$BACKUP_FILE" /
|
||||
umount /recovery
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root move_config
|
||||
68
target/linux/mediatek/base-files/lib/upgrade/platform.sh
Executable file
68
target/linux/mediatek/base-files/lib/upgrade/platform.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
platform_do_upgrade() {
|
||||
local board=$(board_name)
|
||||
case "$board" in
|
||||
"unielec,u7623"*)
|
||||
#Keep the persisten random mac address (if it exists)
|
||||
mkdir -p /tmp/recovery
|
||||
mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery
|
||||
[ -f "/tmp/recovery/mac_addr" ] && \
|
||||
mv -f /tmp/recovery/mac_addr /tmp/
|
||||
umount /tmp/recovery
|
||||
|
||||
#1310720 is the offset in bytes from the start of eMMC and to
|
||||
#the location of the kernel (2560 512 byte sectors)
|
||||
get_image "$1" | dd of=/dev/mmcblk0 bs=1310720 seek=1 conv=fsync
|
||||
|
||||
mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery
|
||||
[ -f "/tmp/mac_addr" ] && mv -f /tmp/mac_addr /tmp/recovery
|
||||
sync
|
||||
umount /tmp/recovery
|
||||
;;
|
||||
*)
|
||||
default_do_upgrade "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
PART_NAME=firmware
|
||||
|
||||
platform_check_image() {
|
||||
local board=$(board_name)
|
||||
local magic="$(get_magic_long "$1")"
|
||||
|
||||
[ "$#" -gt 1 ] && return 1
|
||||
|
||||
case "$board" in
|
||||
bananapi,bpi-r2|\
|
||||
"unielec,u7623"*)
|
||||
[ "$magic" != "27051956" ] && {
|
||||
echo "Invalid image type."
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Sysupgrade is not supported on your board yet."
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
platform_copy_config_emmc() {
|
||||
mkdir -p /recovery
|
||||
mount -o rw,noatime /dev/mmcblk0p1 /recovery
|
||||
cp -af "$UPGRADE_BACKUP" "/recovery/$BACKUP_FILE"
|
||||
sync
|
||||
umount /recovery
|
||||
}
|
||||
|
||||
platform_copy_config() {
|
||||
case "$(board_name)" in
|
||||
"unielec,u7623"*)
|
||||
platform_copy_config_emmc
|
||||
;;
|
||||
esac
|
||||
}
|
||||
Reference in New Issue
Block a user