Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
27
target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds
Normal file
27
target/linux/mediatek/mt7622/base-files/etc/board.d/01_leds
Normal file
@@ -0,0 +1,27 @@
|
||||
. /lib/functions/leds.sh
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
board_config_update
|
||||
|
||||
case $board in
|
||||
linksys,e8450|\
|
||||
linksys,e8450-ubi|\
|
||||
netgear,wax206)
|
||||
ucidef_set_led_netdev "wan" "WAN" "inet:blue" "wan"
|
||||
;;
|
||||
smartrg,sdg-841-t6)
|
||||
ucidef_set_led_netdev "lan-green" "LAN" "mdio-bus:00:green:lan" "lan" "link_1000"
|
||||
ucidef_set_led_netdev "lan-amber" "LAN" "mdio-bus:00:amber:lan" "lan" "link_10 link_100"
|
||||
ucidef_set_led_netdev "wan-green" "WAN" "mdio-bus:05:green:wan" "wan" "link_1000 link_2500"
|
||||
ucidef_set_led_netdev "wan-amber" "WAN" "mdio-bus:05:amber:wan" "wan" "link_10 link_100"
|
||||
;;
|
||||
xiaomi,redmi-router-ax6s)
|
||||
ucidef_set_led_netdev "wan" "WAN" "blue:net" "wan"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/uci-defaults.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
mediatek_setup_interfaces()
|
||||
{
|
||||
local board="$1"
|
||||
|
||||
case $board in
|
||||
buffalo,wsr-2533dhp2)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
|
||||
;;
|
||||
dlink,eagle-pro-ai-m32-a1)
|
||||
ucidef_set_interfaces_lan_wan "lan1 lan2" wan
|
||||
;;
|
||||
elecom,wrc-2533gent|\
|
||||
totolink,a8000ru)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6u@eth0" "5u@eth1"
|
||||
;;
|
||||
smartrg,sdg-841-t6)
|
||||
ucidef_set_interfaces_lan_wan lan wan
|
||||
;;
|
||||
ubnt,unifi-6-lr*)
|
||||
ucidef_set_interface_lan "eth0"
|
||||
;;
|
||||
xiaomi,redmi-router-ax6s)
|
||||
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" wan
|
||||
;;
|
||||
*)
|
||||
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
DEV_PATH_WMAC=platform/18000000.wmac
|
||||
DEV_PATH_PCIE0=1a143000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0
|
||||
DEV_PATH_PCIE1=1a145000.pcie/pci0001:00/0001:00:01.0/0001:01:00.0
|
||||
|
||||
mediatek_setup_wlan()
|
||||
{
|
||||
dt_is_enabled wmac@18000000 && ucidef_add_wlan $DEV_PATH_WMAC
|
||||
dt_is_enabled pcie@1a143000 && ucidef_add_wlan $DEV_PATH_PCIE0
|
||||
dt_is_enabled pcie@1a145000 && ucidef_add_wlan $DEV_PATH_PCIE1
|
||||
}
|
||||
|
||||
mediatek_setup_macs()
|
||||
{
|
||||
local board="$1"
|
||||
local lan_mac=""
|
||||
local wan_mac=""
|
||||
local label_mac=""
|
||||
|
||||
case $board in
|
||||
buffalo,wsr-3200ax4s)
|
||||
lan_mac=$(mtd_get_mac_ascii board_data "mac")
|
||||
wan_mac=$lan_mac
|
||||
label_mac=$lan_mac
|
||||
;;
|
||||
reyee,ax3200-e5|\
|
||||
ruijie,rg-ew3200gx-pro)
|
||||
lan_mac=$(macaddr_add $(get_mac_label) 1)
|
||||
;;
|
||||
xiaomi,redmi-router-ax6s)
|
||||
wan_mac=$(mtd_get_mac_ascii bdata ethaddr_wan)
|
||||
label_mac=$wan_mac
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
|
||||
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
|
||||
[ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
|
||||
}
|
||||
|
||||
board_config_update
|
||||
board=$(board_name)
|
||||
mediatek_setup_interfaces $board
|
||||
mediatek_setup_macs $board
|
||||
mediatek_setup_wlan $board
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
case "$(board_name)" in
|
||||
bananapi,bpi-r64)
|
||||
ucidef_set_compat_version "1.2"
|
||||
;;
|
||||
linksys,e8450-ubi)
|
||||
ucidef_set_compat_version "2.0"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,26 @@
|
||||
[ "$ACTION" == "add" ] || exit 0
|
||||
|
||||
PHYNBR=${DEVPATH##*/phy}
|
||||
|
||||
[ -n $PHYNBR ] || exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
bananapi,bpi-r64)
|
||||
[ "$PHYNBR" = "0" ] && macaddr_add $(cat /sys/class/net/eth0/address) 2 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
buffalo,wsr-3200ax4s)
|
||||
basemac=$(mtd_get_mac_ascii board_data "mac")
|
||||
[ "$PHYNBR" = "0" ] && macaddr_add $basemac 1 > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "1" ] && macaddr_add $basemac 8 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
reyee,ax3200-e5|\
|
||||
ruijie,rg-ew3200gx-pro)
|
||||
[ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
esac
|
||||
19
target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount
Executable file
19
target/linux/mediatek/mt7622/base-files/etc/init.d/bootcount
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
boot() {
|
||||
case $(board_name) in
|
||||
dlink,eagle-pro-ai-m32-a1|\
|
||||
dlink,eagle-pro-ai-r32-a1)
|
||||
if grep -q boot_part=Kernel1 /proc/cmdline; then
|
||||
fw_setenv boot_part 1
|
||||
else
|
||||
fw_setenv boot_part 2
|
||||
fi
|
||||
;;
|
||||
linksys,e8450)
|
||||
mtd erase senv || true
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
. /lib/functions.sh
|
||||
|
||||
case "$(board_name)" in
|
||||
bananapi,bpi-r64)
|
||||
uci set system.@system[0].compat_version="1.2"
|
||||
uci commit system
|
||||
;;
|
||||
buffalo,wsr-2533dhp2)
|
||||
uci set system.@system[0].compat_version="1.1"
|
||||
uci commit system
|
||||
;;
|
||||
linksys,e8450-ubi|\
|
||||
xiaomi,redmi-router-ax6s)
|
||||
uci set system.@system[0].compat_version="2.0"
|
||||
uci commit system
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,14 @@
|
||||
. /lib/functions.sh
|
||||
|
||||
kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"\(kernel\|linux\)".*/\1/p' /proc/mtd)
|
||||
|
||||
case "$(board_name)" in
|
||||
buffalo,wsr-2533dhp2)
|
||||
mtd -M 0x44485032 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0
|
||||
exit 1
|
||||
;;
|
||||
buffalo,wsr-3200ax4s)
|
||||
mtd -M 0x44485033 ${kernel_size:+-c 0x$kernel_size} fixtrx firmware && exit 0
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,15 @@
|
||||
set_netdev_labels() {
|
||||
local dir
|
||||
local label
|
||||
local netdev
|
||||
|
||||
for dir in /sys/class/net/*; do
|
||||
[ -r "$dir/of_node/label" ] || continue
|
||||
read -r label < "$dir/of_node/label"
|
||||
netdev="${dir##*/}"
|
||||
[ "$netdev" = "$label" ] && continue
|
||||
ip link set "$netdev" name "$label"
|
||||
done
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main set_netdev_labels
|
||||
126
target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh
Normal file
126
target/linux/mediatek/mt7622/base-files/lib/upgrade/buffalo.sh
Normal file
@@ -0,0 +1,126 @@
|
||||
# ======== dev note ========
|
||||
# for following buffalo MT7622 devices:
|
||||
#
|
||||
# - WSR-2533DHP2 (trx magic: "DHP2")
|
||||
# - WSR-2533DHP3 (trx magic: "DHP3")
|
||||
# - WSR-3200AX4S (trx magic: "DHP3")
|
||||
#
|
||||
# sysupgrade-tar image:
|
||||
#
|
||||
# This is for normal upgrading for OpenWrt.
|
||||
# use nand_do_upgrade with CI_KERNPART="firmware"
|
||||
#
|
||||
# - if the size of new kernel is not equal with the current kernel's
|
||||
# -> block upgrade and print a message about using TRX + UBI
|
||||
# formatted image
|
||||
# (should be flashed the new ubi contains rootfs + rootfs_data
|
||||
# with the offset (=new padded kernel's end) if this case? But
|
||||
# it maybe too hard for writing scripts...)
|
||||
#
|
||||
# TRX + UBI formatted image:
|
||||
#
|
||||
# This is for upgrading if the new kernel is larger than the
|
||||
# current kernel.
|
||||
#
|
||||
# ex:
|
||||
# - stock firmware is installed in the flash and booted with
|
||||
# OpenWrt initramfs image
|
||||
# - kernel partition is increased from 4MiB in OpenWrt in the
|
||||
# future
|
||||
#
|
||||
# packing TRX + UBI formatted image by tar is needed for image validation
|
||||
# with the metadata in the future?
|
||||
# ====== dev note end ======
|
||||
#
|
||||
# The mtd partitions "firmware" and "Kernel2" on NAND flash are os-image
|
||||
# partitions. These partitions are called as "Image1/Image2" in U-Boot
|
||||
# on WSR-2533DHP2, and they are checked conditions when booting.
|
||||
# "Image1" is always used for booting.
|
||||
#
|
||||
# == U-Boot Behaviors ==
|
||||
# - "Image1"/"Image2" images are good, images are different or
|
||||
# "Image2" image is broken
|
||||
# -> writes os-image to "Image2" from "Image1"
|
||||
#
|
||||
# - "Image1" image is broken
|
||||
# -> writes os-image to "Image1" from "Image2"
|
||||
#
|
||||
# - "Image1"/"Image2" images are broken
|
||||
# -> fall to U-Boot command line
|
||||
|
||||
buffalo_check_image() {
|
||||
local board="$1"
|
||||
local boardname="$(echo $board | tr ',' '_')"
|
||||
local magic="$2"
|
||||
local fw_image="$3"
|
||||
|
||||
# return error state if TRX + UBI formatted image specified
|
||||
# to notify about configurations
|
||||
if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then
|
||||
echo "Your configurations won't be saved if factory-uboot.bin image specified."
|
||||
echo "But if you want to upgrade, please execute sysupgrade with \"-F\" option."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# check if valid tar file specifed
|
||||
if ! tar tf "$fw_image" &>/dev/null; then
|
||||
echo "Specified file is not a tar archive: $fw_image"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local control_len=$( (tar xf $fw_image sysupgrade-$boardname/CONTROL -O | wc -c) 2> /dev/null)
|
||||
|
||||
# check if valid sysupgrade tar archive
|
||||
if [ "$control_len" = "0" ]; then
|
||||
echo "Invalid sysupgrade file: $fw_image"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local kern_part_len=$(grep "\"linux\"" /proc/mtd | sed "s/mtd[0-9]*:[ \t]*\([^ \t]*\).*/\1/")
|
||||
[ -z "$kern_part_len" ] && {
|
||||
echo "Unable to get \"linux\" partition size"
|
||||
return 1
|
||||
}
|
||||
kern_part_len=$((0x$kern_part_len))
|
||||
|
||||
# this also checks if the sysupgrade image is for correct models
|
||||
local kern_bin_len=$( (tar xf $fw_image sysupgrade-${boardname}/kernel -O | wc -c) 2> /dev/null)
|
||||
if [ -z "$kern_bin_len" ]; then
|
||||
echo "Failed to get new kernel size, is valid sysupgrade image specified for the device?"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# kernel binary has a trx header (len: 28 (0x1c))
|
||||
kern_bin_len=$((kern_bin_len - 28))
|
||||
|
||||
if [ "$kern_bin_len" != "$kern_part_len" ]; then
|
||||
echo -n "The length of new kernel is invalid for current "
|
||||
echo "\"linux\" partition, please use factory-uboot.bin image."
|
||||
echo "\"linux\" partition: $kern_part_len, new kernel: $kern_bin_len"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# for TRX + UBI formatted image
|
||||
buffalo_upgrade_ubinized() {
|
||||
sync
|
||||
echo 3 > /proc/sys/vm/drop_caches
|
||||
|
||||
local mtdnum="$( find_mtd_index "ubi" )"
|
||||
# if no "ubi", don't return error for the purpose of recovery
|
||||
# ex: recovery after accidental erasing "firmware" partition
|
||||
if [ ! "$mtdnum" ]; then
|
||||
echo "cannot find ubi mtd partition \"ubi\", skip detachment"
|
||||
else
|
||||
ubidetach -m "$mtdnum"
|
||||
fi
|
||||
|
||||
# erase all data in "firmware"
|
||||
mtd erase "${PART_NAME}"
|
||||
# write TRX + UBI formatted image to "firmware"
|
||||
get_image "$1" | mtd $MTD_ARGS write - "${PART_NAME:-firmware}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to write the specified image."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
103
target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
Executable file
103
target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh
Executable file
@@ -0,0 +1,103 @@
|
||||
REQUIRE_IMAGE_METADATA=1
|
||||
RAMFS_COPY_BIN='fitblk'
|
||||
|
||||
platform_do_upgrade() {
|
||||
local board=$(board_name)
|
||||
local file_type=$(identify $1)
|
||||
|
||||
case "$board" in
|
||||
bananapi,bpi-r64|\
|
||||
linksys,e8450-ubi|\
|
||||
ubnt,unifi-6-lr-v1-ubootmod|\
|
||||
ubnt,unifi-6-lr-v2-ubootmod|\
|
||||
ubnt,unifi-6-lr-v3-ubootmod|\
|
||||
xiaomi,redmi-router-ax6s)
|
||||
fit_do_upgrade "$1"
|
||||
;;
|
||||
buffalo,wsr-2533dhp2|\
|
||||
buffalo,wsr-3200ax4s)
|
||||
local magic="$(get_magic_long "$1")"
|
||||
|
||||
# use "mtd write" if the magic is "DHP2 (0x44485032)"
|
||||
# or "DHP3 (0x44485033)"
|
||||
if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then
|
||||
buffalo_upgrade_ubinized "$1"
|
||||
else
|
||||
CI_KERNPART="firmware"
|
||||
nand_do_upgrade "$1"
|
||||
fi
|
||||
;;
|
||||
dlink,eagle-pro-ai-m32-a1|\
|
||||
dlink,eagle-pro-ai-r32-a1|\
|
||||
elecom,wrc-x3200gst3|\
|
||||
mediatek,mt7622-rfb1-ubi|\
|
||||
netgear,wax206|\
|
||||
totolink,a8000ru)
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
linksys,e8450)
|
||||
if grep -q mtdparts=slave /proc/cmdline; then
|
||||
PART_NAME=firmware2
|
||||
else
|
||||
PART_NAME=firmware1
|
||||
fi
|
||||
default_do_upgrade "$1"
|
||||
;;
|
||||
smartrg,sdg-841-t6)
|
||||
CI_KERNPART="boot"
|
||||
CI_ROOTPART="res1"
|
||||
emmc_do_upgrade "$1"
|
||||
;;
|
||||
*)
|
||||
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
|
||||
buffalo,wsr-2533dhp2|\
|
||||
buffalo,wsr-3200ax4s)
|
||||
buffalo_check_image "$board" "$magic" "$1" || return 1
|
||||
;;
|
||||
dlink,eagle-pro-ai-m32-a1|\
|
||||
dlink,eagle-pro-ai-r32-a1|\
|
||||
elecom,wrc-x3200gst3|\
|
||||
mediatek,mt7622-rfb1-ubi|\
|
||||
netgear,wax206|\
|
||||
smartrg,sdg-841-t6|\
|
||||
totolink,a8000ru)
|
||||
nand_do_platform_check "$board" "$1"
|
||||
return $?
|
||||
;;
|
||||
*)
|
||||
[ "$magic" != "d00dfeed" ] && {
|
||||
echo "Invalid image type."
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
platform_copy_config() {
|
||||
case "$(board_name)" in
|
||||
bananapi,bpi-r64)
|
||||
if [ "$CI_METHOD" = "emmc" ]; then
|
||||
emmc_copy_config
|
||||
fi
|
||||
;;
|
||||
smartrg,sdg-841-t6)
|
||||
emmc_copy_config
|
||||
;;
|
||||
esac
|
||||
}
|
||||
Reference in New Issue
Block a user