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:
@@ -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
|
||||
@@ -0,0 +1,25 @@
|
||||
. /lib/functions/system.sh
|
||||
|
||||
predator_w6_factory_extract() {
|
||||
local mmc_part
|
||||
|
||||
mmc_part="$(find_mmc_part qcidata)"
|
||||
|
||||
mkdir -p /var/qcidata/data
|
||||
mkdir -p /var/qcidata/mount
|
||||
|
||||
mount -r "$mmc_part" /var/qcidata/mount
|
||||
|
||||
cp /var/qcidata/mount/factory/*MAC "/var/qcidata/data/"
|
||||
umount "/var/qcidata/mount"
|
||||
}
|
||||
|
||||
preinit_extract_factory() {
|
||||
case $(board_name) in
|
||||
acer,predator-w6)
|
||||
predator_w6_factory_extract
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main preinit_extract_factory
|
||||
@@ -0,0 +1,24 @@
|
||||
. /lib/functions/system.sh
|
||||
|
||||
mount_ubi_part() {
|
||||
local part_name="$1"
|
||||
local mtd_num=$(grep $part_name /proc/mtd | cut -c4)
|
||||
local ubi_num=$(ubiattach -m $mtd_num | \
|
||||
awk -F',' '/UBI device number [0-9]{1,}/{print $1}' | \
|
||||
awk '{print $4}')
|
||||
mkdir /tmp/$part_name
|
||||
mount -r -t ubifs ubi$ubi_num:$part_name /tmp/$part_name
|
||||
}
|
||||
|
||||
preinit_mount_cfg_part() {
|
||||
case $(board_name) in
|
||||
mercusys,mr90x-v1|\
|
||||
tplink,re6000xd)
|
||||
mount_ubi_part "tp_data"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main preinit_mount_cfg_part
|
||||
@@ -0,0 +1,49 @@
|
||||
. /lib/functions/system.sh
|
||||
|
||||
preinit_set_mac_address() {
|
||||
case $(board_name) in
|
||||
acer,predator-w6)
|
||||
key_path="/var/qcidata/data"
|
||||
ip link set dev lan1 address "$(cat $key_path/LANMAC)"
|
||||
ip link set dev lan2 address "$(cat $key_path/LANMAC)"
|
||||
ip link set dev lan3 address "$(cat $key_path/LANMAC)"
|
||||
ip link set dev game address "$(cat $key_path/LANMAC)"
|
||||
ip link set dev eth1 address "$(cat $key_path/WANMAC)"
|
||||
;;
|
||||
asus,tuf-ax4200|\
|
||||
asus,tuf-ax6000)
|
||||
CI_UBIPART="UBI_DEV"
|
||||
addr=$(mtd_get_mac_binary_ubi "Factory" 0x4)
|
||||
ip link set dev eth0 address "$addr"
|
||||
ip link set dev eth1 address "$addr"
|
||||
;;
|
||||
mercusys,mr90x-v1|\
|
||||
tplink,re6000xd)
|
||||
addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0)
|
||||
ip link set dev eth1 address "$(macaddr_add $addr 1)"
|
||||
;;
|
||||
smartrg,sdg-8612|\
|
||||
smartrg,sdg-8614|\
|
||||
smartrg,sdg-8733|\
|
||||
smartrg,sdg-8734)
|
||||
addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
|
||||
lan_addr=$(macaddr_add $addr 1)
|
||||
ip link set dev wan address "$addr"
|
||||
ip link set dev eth0 address "$lan_addr"
|
||||
ip link set dev lan1 address "$lan_addr"
|
||||
ip link set dev lan2 address "$lan_addr"
|
||||
ip link set dev lan3 address "$lan_addr"
|
||||
ip link set dev lan4 address "$lan_addr"
|
||||
;;
|
||||
smartrg,sdg-8622|\
|
||||
smartrg,sdg-8632)
|
||||
addr=$(mmc_get_mac_ascii mfginfo MFG_MAC)
|
||||
ip link set dev wan address "$addr"
|
||||
ip link set dev lan address "$(macaddr_add $addr 1)"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main preinit_set_mac_address
|
||||
@@ -0,0 +1,35 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
|
||||
|
||||
rootfs_create() {
|
||||
local blocks
|
||||
|
||||
blocks=$(cat /sys/class/ubi/ubi0/avail_eraseblocks)
|
||||
[ -z "$blocks" ] && {
|
||||
echo "Failed to read amount of available erase blocks" >&2
|
||||
return
|
||||
}
|
||||
|
||||
# Delete after getting available blocks: Make sure enough space is
|
||||
# left to recreate these volumes.
|
||||
ubirmvol /dev/ubi0 -N kernel_backup
|
||||
ubirmvol /dev/ubi0 -N rootfs_backup
|
||||
|
||||
# Use 90% of remaining flash size for "rootfs_data"
|
||||
ubimkvol /dev/ubi0 -n 20 -N rootfs_data --lebs $((blocks / 100 * 90))
|
||||
mknod -m 0600 /dev/ubi0_20 c 250 21
|
||||
}
|
||||
|
||||
rootfs_prepare() {
|
||||
case $(board_name) in
|
||||
netgear,wax220)
|
||||
if ! ubinfo /dev/ubi0 -N rootfs_data &>/dev/null; then
|
||||
echo "Creating \"rootfs_data\" UBI volume"
|
||||
rootfs_create
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main rootfs_prepare
|
||||
243
target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
Executable file
243
target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
Executable file
@@ -0,0 +1,243 @@
|
||||
REQUIRE_IMAGE_METADATA=1
|
||||
RAMFS_COPY_BIN='fitblk'
|
||||
|
||||
asus_initial_setup()
|
||||
{
|
||||
# initialize UBI if it's running on initramfs
|
||||
[ "$(rootfs_type)" = "tmpfs" ] || return 0
|
||||
|
||||
ubirmvol /dev/ubi0 -N rootfs
|
||||
ubirmvol /dev/ubi0 -N rootfs_data
|
||||
ubirmvol /dev/ubi0 -N jffs2
|
||||
ubimkvol /dev/ubi0 -N jffs2 -s 0x3e000
|
||||
}
|
||||
|
||||
xiaomi_initial_setup()
|
||||
{
|
||||
# initialize UBI and setup uboot-env if it's running on initramfs
|
||||
[ "$(rootfs_type)" = "tmpfs" ] || return 0
|
||||
|
||||
local mtdnum="$( find_mtd_index ubi )"
|
||||
if [ ! "$mtdnum" ]; then
|
||||
echo "unable to find mtd partition ubi"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local kern_mtdnum="$( find_mtd_index ubi_kernel )"
|
||||
if [ ! "$kern_mtdnum" ]; then
|
||||
echo "unable to find mtd partition ubi_kernel"
|
||||
return 1
|
||||
fi
|
||||
|
||||
ubidetach -m "$mtdnum"
|
||||
ubiformat /dev/mtd$mtdnum -y
|
||||
|
||||
ubidetach -m "$kern_mtdnum"
|
||||
ubiformat /dev/mtd$kern_mtdnum -y
|
||||
|
||||
if ! fw_printenv -n flag_try_sys2_failed &>/dev/null; then
|
||||
echo "failed to access u-boot-env. skip env setup."
|
||||
return 0
|
||||
fi
|
||||
|
||||
fw_setenv boot_wait on
|
||||
fw_setenv uart_en 1
|
||||
fw_setenv flag_boot_rootfs 0
|
||||
fw_setenv flag_last_success 1
|
||||
fw_setenv flag_boot_success 1
|
||||
fw_setenv flag_try_sys1_failed 8
|
||||
fw_setenv flag_try_sys2_failed 8
|
||||
|
||||
local board=$(board_name)
|
||||
case "$board" in
|
||||
xiaomi,mi-router-ax3000t|\
|
||||
xiaomi,mi-router-wr30u-stock)
|
||||
fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)"
|
||||
;;
|
||||
xiaomi,redmi-router-ax6000-stock)
|
||||
fw_setenv mtdparts "nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),30720k(ubi),30720k(ubi1),51200k(overlay)"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
platform_do_upgrade() {
|
||||
local board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
abt,asr3000|\
|
||||
bananapi,bpi-r3|\
|
||||
bananapi,bpi-r3-mini|\
|
||||
bananapi,bpi-r4|\
|
||||
bananapi,bpi-r4-poe|\
|
||||
cmcc,rax3000m|\
|
||||
jdcloud,re-cp-03|\
|
||||
mediatek,mt7988a-rfb|\
|
||||
nokia,ea0326gmp|\
|
||||
openwrt,one|\
|
||||
tplink,tl-xdr4288|\
|
||||
tplink,tl-xdr6086|\
|
||||
tplink,tl-xdr6088|\
|
||||
tplink,tl-xtr8488|\
|
||||
xiaomi,redmi-router-ax6000-ubootmod)
|
||||
fit_do_upgrade "$1"
|
||||
;;
|
||||
acer,predator-w6|\
|
||||
smartrg,sdg-8612|\
|
||||
smartrg,sdg-8614|\
|
||||
smartrg,sdg-8622|\
|
||||
smartrg,sdg-8632|\
|
||||
smartrg,sdg-8733|\
|
||||
smartrg,sdg-8734)
|
||||
CI_KERNPART="kernel"
|
||||
CI_ROOTPART="rootfs"
|
||||
emmc_do_upgrade "$1"
|
||||
;;
|
||||
asus,rt-ax59u|\
|
||||
asus,tuf-ax4200|\
|
||||
asus,tuf-ax6000)
|
||||
CI_UBIPART="UBI_DEV"
|
||||
CI_KERNPART="linux"
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
cudy,re3000-v1|\
|
||||
cudy,wr3000-v1|\
|
||||
yuncore,ax835)
|
||||
default_do_upgrade "$1"
|
||||
;;
|
||||
glinet,gl-mt2500|\
|
||||
glinet,gl-mt6000|\
|
||||
glinet,gl-x3000|\
|
||||
glinet,gl-xe3000)
|
||||
CI_KERNPART="kernel"
|
||||
CI_ROOTPART="rootfs"
|
||||
emmc_do_upgrade "$1"
|
||||
;;
|
||||
h3c,magic-nx30-pro|\
|
||||
jcg,q30-pro|\
|
||||
mediatek,mt7981-rfb|\
|
||||
netcore,n60|\
|
||||
qihoo,360t7|\
|
||||
xiaomi,mi-router-ax3000t-ubootmod|\
|
||||
xiaomi,mi-router-wr30u-ubootmod)
|
||||
CI_KERNPART="fit"
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
mercusys,mr90x-v1|\
|
||||
tplink,re6000xd)
|
||||
CI_UBIPART="ubi0"
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
ubnt,unifi-6-plus)
|
||||
CI_KERNPART="kernel0"
|
||||
EMMC_ROOT_DEV="$(cmdline_get_var root)"
|
||||
emmc_do_upgrade "$1"
|
||||
;;
|
||||
xiaomi,mi-router-ax3000t|\
|
||||
xiaomi,mi-router-wr30u-stock|\
|
||||
xiaomi,redmi-router-ax6000-stock)
|
||||
CI_KERN_UBIPART=ubi_kernel
|
||||
CI_ROOT_UBIPART=ubi
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
zyxel,ex5601-t0-ubootmod)
|
||||
CI_KERNPART="fit"
|
||||
CI_ROOTPART="ubi_rootfs"
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
unielec,u7981-01*)
|
||||
local rootdev="$(cmdline_get_var root)"
|
||||
rootdev="${rootdev##*/}"
|
||||
rootdev="${rootdev%p[0-9]*}"
|
||||
case "$rootdev" in
|
||||
mmc*)
|
||||
CI_ROOTDEV="$rootdev"
|
||||
CI_KERNPART="kernel"
|
||||
CI_ROOTPART="rootfs"
|
||||
emmc_do_upgrade "$1"
|
||||
;;
|
||||
*)
|
||||
CI_KERNPART="fit"
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
nand_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-r3|\
|
||||
bananapi,bpi-r3-mini|\
|
||||
bananapi,bpi-r4|\
|
||||
bananapi,bpi-r4-poe|\
|
||||
cmcc,rax3000m)
|
||||
[ "$magic" != "d00dfeed" ] && {
|
||||
echo "Invalid image type."
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
nand_do_platform_check "$board" "$1"
|
||||
return $?
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
platform_copy_config() {
|
||||
case "$(board_name)" in
|
||||
bananapi,bpi-r3|\
|
||||
bananapi,bpi-r3-mini|\
|
||||
bananapi,bpi-r4|\
|
||||
bananapi,bpi-r4-poe|\
|
||||
cmcc,rax3000m)
|
||||
if [ "$CI_METHOD" = "emmc" ]; then
|
||||
emmc_copy_config
|
||||
fi
|
||||
;;
|
||||
acer,predator-w6|\
|
||||
glinet,gl-mt2500|\
|
||||
glinet,gl-mt6000|\
|
||||
glinet,gl-x3000|\
|
||||
glinet,gl-xe3000|\
|
||||
jdcloud,re-cp-03|\
|
||||
smartrg,sdg-8612|\
|
||||
smartrg,sdg-8614|\
|
||||
smartrg,sdg-8622|\
|
||||
smartrg,sdg-8632|\
|
||||
smartrg,sdg-8733|\
|
||||
smartrg,sdg-8734|\
|
||||
ubnt,unifi-6-plus)
|
||||
emmc_copy_config
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
platform_pre_upgrade() {
|
||||
local board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
asus,rt-ax59u|\
|
||||
asus,tuf-ax4200|\
|
||||
asus,tuf-ax6000)
|
||||
asus_initial_setup
|
||||
;;
|
||||
xiaomi,mi-router-ax3000t|\
|
||||
xiaomi,mi-router-wr30u-stock|\
|
||||
xiaomi,redmi-router-ax6000-stock)
|
||||
xiaomi_initial_setup
|
||||
;;
|
||||
esac
|
||||
}
|
||||
Reference in New Issue
Block a user