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

This commit is contained in:
domenico
2025-06-24 14:35:53 +02:00
commit c06fb25d1f
9263 changed files with 1750214 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
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
for dir in /sys/class/net/*; do
[ -r "$dir/of_node/openwrt,netdev-name" ] || continue
read -r label < "$dir/of_node/openwrt,netdev-name"
netdev="${dir##*/}"
[ "$netdev" = "$label" ] && continue
ip link set "$netdev" name "$label"
done
}
boot_hook_add preinit_main set_netdev_labels

View File

@@ -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

View File

@@ -0,0 +1,40 @@
. /lib/functions/system.sh
preinit_set_mac_address() {
case $(board_name) in
acer,predator-w6|\
acer,predator-w6d)
$(mmc_get_mac_ascii u-boot-env WANMAC)
$(mmc_get_mac_ascii u-boot-env LANMAC)
ip link set dev lan1 address "$lan_mac"
ip link set dev lan2 address "$lan_mac"
ip link set dev lan3 address "$lan_mac"
ip link set dev game address "$lan_mac"
ip link set dev eth1 address "$wan_mac"
;;
acer,vero-w6m)
wan_mac=$(mmc_get_mac_ascii u-boot-env WANMAC)
lan_mac=$(mmc_get_mac_ascii u-boot-env LANMAC)
ip link set dev lan1 address "$lan_mac"
ip link set dev lan2 address "$lan_mac"
ip link set dev lan3 address "$lan_mac"
ip link set dev internet address "$wan_mac"
;;
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)"
;;
*)
;;
esac
}
boot_hook_add preinit_main preinit_set_mac_address

View File

@@ -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