mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Add patches and packages needed for BPI-r2
This commit is contained in:
parent
b105e79652
commit
3406c7d37b
165 changed files with 241259 additions and 29 deletions
43
root/target/linux/mediatek/base-files/etc/board.d/02_network
Executable file
43
root/target/linux/mediatek/base-files/etc/board.d/02_network
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/uci-defaults.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
mediatek_setup_interfaces()
|
||||
{
|
||||
local board="$1"
|
||||
|
||||
case $board in
|
||||
'mediatek,mt7623a-rfb-emmc')
|
||||
ucidef_set_interface_lan "lan0 lan1 lan2 lan3"
|
||||
ucidef_set_interface_wan eth1
|
||||
;;
|
||||
'bananapi,bpi-r2'|\
|
||||
"unielec,u7623"*)
|
||||
ucidef_set_interface_lan "lan"
|
||||
ucidef_set_interface_wan "wan1 wan2 wan3 wan4"
|
||||
#ucidef_set_interfaces_lan_wan "wan1 wan2 wan3 wan4" "lan"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
mediatek_setup_macs()
|
||||
{
|
||||
local board="$1"
|
||||
|
||||
case $board in
|
||||
"unielec,u7623"*)
|
||||
mac=$(cat /sys/class/net/wan/address)
|
||||
ucidef_set_interface_macaddr "lan" $mac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
board_config_update
|
||||
board=$(board_name)
|
||||
mediatek_setup_interfaces $board
|
||||
mediatek_setup_macs $board
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
4
root/target/linux/mediatek/base-files/etc/inittab
Normal file
4
root/target/linux/mediatek/base-files/etc/inittab
Normal file
|
@ -0,0 +1,4 @@
|
|||
::sysinit:/etc/init.d/rcS S boot
|
||||
::shutdown:/etc/init.d/rcS K shutdown
|
||||
::askconsole:/usr/libexec/login.sh
|
||||
ttyS0::askfirst:/usr/libexec/login.sh
|
6
root/target/linux/mediatek/base-files/etc/uci-defaults/99-net-ps
Executable file
6
root/target/linux/mediatek/base-files/etc/uci-defaults/99-net-ps
Executable file
|
@ -0,0 +1,6 @@
|
|||
uci set network.globals.default_rps_val=14
|
||||
uci set network.globals.default_rps_flow_cnt=256
|
||||
uci set network.globals.default_xps_val=14
|
||||
uci set network.globals.default_ps=1
|
||||
uci commit
|
||||
exit 0
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
set_preinit_iface() {
|
||||
ifconfig eth0 up
|
||||
ifname=lan
|
||||
}
|
||||
|
||||
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,48 @@
|
|||
#!/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
|
||||
'bananapi,bpi-r2'|\
|
||||
"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 lan address $mac 2> /dev/null
|
||||
|
||||
mac=$(macaddr_add $mac 1)
|
||||
|
||||
ip link set dev wan1 address $mac 2>/dev/null
|
||||
ip link set dev wan2 address $mac 2>/dev/null
|
||||
ip link set dev wan3 address $mac 2>/dev/null
|
||||
ip link set dev wan4 address $mac 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main preinit_set_mac_address
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
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/sysupgrade.tgz ] && mv -f /recovery/sysupgrade.tgz /
|
||||
umount /recovery
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root move_config
|
85
root/target/linux/mediatek/base-files/lib/upgrade/platform.sh
Executable file
85
root/target/linux/mediatek/base-files/lib/upgrade/platform.sh
Executable file
|
@ -0,0 +1,85 @@
|
|||
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
|
||||
;;
|
||||
bananapi,bpi-r2)
|
||||
local tar_file="$1"
|
||||
|
||||
echo "flashing kernel"
|
||||
tar xf $tar_file sysupgrade-7623n-bananapi-bpi-r2/kernel -O | mtd write - kernel
|
||||
|
||||
echo "flashing rootfs"
|
||||
tar xf $tar_file sysupgrade-7623n-bananapi-bpi-r2/root -O | mtd write - rootfs
|
||||
;;
|
||||
*)
|
||||
default_do_upgrade "$ARGV"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
PART_NAME=firmware
|
||||
|
||||
platform_check_image() {
|
||||
local board=$(board_name)
|
||||
|
||||
[ "$#" -gt 1 ] && return 1
|
||||
|
||||
case "$board" in
|
||||
bananapi,bpi-r2)
|
||||
local tar_file="$1"
|
||||
local kernel_length=`(tar xf $tar_file sysupgrade-7623n-bananapi-bpi-r2/kernel -O | wc -c) 2> /dev/null`
|
||||
local rootfs_length=`(tar xf $tar_file sysupgrade-7623n-bananapi-bpi-r2/root -O | wc -c) 2> /dev/null`
|
||||
[ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && {
|
||||
echo "The upgrade image is corrupt."
|
||||
return 1
|
||||
}
|
||||
;;
|
||||
"unielec,u7623"*)
|
||||
local magic="$(get_magic_long "$1")"
|
||||
[ "$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 "$CONF_TAR" /recovery/
|
||||
sync
|
||||
umount /recovery
|
||||
}
|
||||
|
||||
platform_copy_config() {
|
||||
case "$(board_name)" in
|
||||
"unielec,u7623"*)
|
||||
platform_copy_config_emmc
|
||||
;;
|
||||
esac
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue