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 12:51:15 +02:00
commit 27c9d80f51
10493 changed files with 1885777 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
#
# Copyright © 2017 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
board_config_update
case "$(board_name)" in
cisco-mx100-hw)
ucidef_set_led_usbport "usb" "USB" "mx100:green:usb" "1-1-port2"
ucidef_set_led_default "diag" "DIAG" "mx100:green:tricolor" "1"
;;
pc-engines-apu1|pc-engines-apu2|pc-engines-apu3|pc-engines-apu4|pc-engines-apu5|pc-engines-apu6)
ucidef_set_led_netdev "wan" "WAN" "apu:green:3" "eth0"
ucidef_set_led_netdev "lan" "LAN" "apu:green:2" "br-lan"
ucidef_set_led_default "diag" "DIAG" "apu:green:1" "1"
;;
sophos-sg-105wr1|sophos-sg-125wr1|sophos-sg-135wr1|sophos-xg-105wr1|sophos-xg-125wr1|sophos-xg-135wr1)
ucidef_set_led_netdev "wlan" "WiFi" "ath9k-phy0" "phy0tpt"
;;
sophos-sg-105wr2|sophos-sg-125wr2|sophos-sg-135wr2|sophos-xg-105wr2|sophos-xg-125wr2|sophos-xg-135wr2|\
sophos-sg-105wr3|sophos-sg-125wr3|sophos-sg-135wr3|sophos-xg-105wr3|sophos-xg-125wr3|sophos-xg-135wr3)
ucidef_set_led_netdev "wlan" "WiFi" "ath10k-phy0" "phy0tpt"
;;
traverse-technologies-geos)
ucidef_set_led_netdev "lan" "LAN" "geos:1" "br-lan" "tx rx"
ucidef_set_led_netdev "wlan" "WiFi" "geos:2" "phy0tpt"
ucidef_set_led_default "diag" "DIAG" "geos:3" "1"
;;
silicom-80500-0214-*)
ucidef_set_led_netdev "wan" "WAN" "multicolor:fp_center" "wan0"
ucidef_set_led_netdev "lan" "LAN" "multicolor:fp_right" "br-lan"
;;
esac
board_config_flush
exit 0

View File

@@ -0,0 +1,92 @@
#
# Copyright © 2017 OpenWrt.org
#
. /lib/functions/system.sh
. /lib/functions/uci-defaults.sh
board_config_update
case "$(board_name)" in
barracuda-networks-inc-barracuda-ng-firewall-f12)
ucidef_set_network_device_path "eth1" "pci0000:00/0000:00:14.0/0000:01:00.0"
ucidef_set_network_device_path "eth2" "pci0000:00/0000:00:14.1/0000:02:00.0"
ucidef_set_network_device_path "eth3" "pci0000:00/0000:00:13.0/0000:03:00.0"
ucidef_set_network_device_path "eth4" "pci0000:00/0000:00:13.1/0000:04:00.0"
ucidef_set_network_device_path "eth5" "pci0000:00/0000:00:13.2/0000:05:00.0"
ucidef_set_interfaces_lan_wan "eth2 eth3 eth4 eth5" "eth1"
;;
cisco-mx100-hw)
ucidef_set_network_device_path "mgmt" "pci0000:00/0000:00:01.2/0000:03:00.3"
ucidef_set_network_device_path "wan" "pci0000:00/0000:00:01.2/0000:03:00.2"
ucidef_set_network_device_path "eth2" "pci0000:00/0000:00:01.2/0000:03:00.1"
ucidef_set_network_device_path "eth3" "pci0000:00/0000:00:01.2/0000:03:00.0"
ucidef_set_network_device_path "eth4" "pci0000:00/0000:00:01.0/0000:01:00.2"
ucidef_set_network_device_path "eth5" "pci0000:00/0000:00:01.0/0000:01:00.1"
ucidef_set_network_device_path "eth6" "pci0000:00/0000:00:01.0/0000:01:00.4"
ucidef_set_network_device_path "eth7" "pci0000:00/0000:00:01.0/0000:01:00.3"
ucidef_set_network_device_path "eth8" "pci0000:00/0000:00:01.1/0000:02:00.1"
ucidef_set_network_device_path "eth9" "pci0000:00/0000:00:01.1/0000:02:00.0"
ucidef_set_network_device_path "eth10" "pci0000:00/0000:00:01.1/0000:02:00.3"
ucidef_set_network_device_path "eth11" "pci0000:00/0000:00:01.1/0000:02:00.2"
ucidef_set_interfaces_lan_wan "mgmt eth2 eth3 eth4 eth5 eth6 eth7 eth8 eth9 eth10 eth11" "wan"
;;
pc-engines-apu1|pc-engines-apu2|pc-engines-apu3)
ucidef_set_interfaces_lan_wan "eth1 eth2" "eth0"
;;
pc-engines-apu5)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
;;
pc-engines-apu4|pc-engines-apu6)
ucidef_set_interfaces_lan_wan "eth1 eth2 eth3" "eth0"
;;
roqos-roqos-core-rc10)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
;;
sophos-sg-105r1|sophos-xg-105r1| \
sophos-sg-105wr1|sophos-xg-105wr1| \
sophos-sg-105r2|sophos-xg-105r2| \
sophos-sg-105wr2|sophos-xg-105wr2| \
sophos-sg-115r1|sophos-xg-115r1| \
sophos-sg-115wr1|sophos-xg-115wr1| \
sophos-sg-115r2|sophos-xg-115r2| \
sophos-sg-115wr2|sophos-xg-115wr2| \
sophos-xg-85*|sophos-xg-86*)
ucidef_set_interfaces_lan_wan "eth0 eth2 eth3" "eth1"
;;
sophos-sg-125r1|sophos-xg-125r1| \
sophos-sg-125wr1|sophos-xg-125wr1| \
sophos-sg-125r2|sophos-xg-125r2| \
sophos-sg-125wr2|sophos-xg-125wr2| \
sophos-sg-135r1|sophos-xg-135r1| \
sophos-sg-135wr1|sophos-xg-135wr1| \
sophos-sg-135r2|sophos-xg-135r2| \
sophos-sg-135wr2|sophos-xg-135wr2)
ucidef_set_interfaces_lan_wan "eth0 eth2 eth3 eth4 eth5 eth6 eth7" "eth1"
;;
sophos-sg-135r3|sophos-xg-135r3| \
sophos-sg-135wr3|sophos-xg-135wr3)
ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3 eth5 eth7 eth8" "eth6"
;;
traverse-technologies-geos)
ucidef_set_interface_lan "eth0 eth1"
ucidef_add_atm_bridge "0" "35" "llc" "bridged"
ucidef_set_interface_wan "nas0" "dhcp"
macaddr="$(cat /sys/class/net/eth0/address)" 2>/dev/null
[ -n "$macaddr" ] && ucidef_set_interface_macaddr "wan" "$macaddr"
;;
silicom-80500-0214-*)
ucidef_set_network_device_path "wan0" "pci0000:00/0000:00:16.0/0000:03:00.0"
ucidef_set_network_device_path "wan1" "pci0000:00/0000:00:16.0/0000:03:00.1"
ucidef_set_network_device_path "media0" "pci0000:00/0000:00:17.0/0000:02:00.1"
ucidef_set_network_device_path "media1" "pci0000:00/0000:00:17.0/0000:02:00.0"
ucidef_set_network_device_path "eth0" "pci0000:00/0000:00:0c.0/0000:04:00.0"
ucidef_set_network_device_path "eth1" "pci0000:00/0000:00:0e.0/0000:05:00.0"
ucidef_set_network_device_path "eth2" "pci0000:00/0000:00:0f.0/0000:06:00.0"
ucidef_set_network_device_path "eth3" "pci0000:00/0000:00:10.0/0000:07:00.0"
ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3" "wan0"
;;
esac
board_config_flush
exit 0

View File

@@ -0,0 +1,84 @@
#!/bin/sh
#
# Copyright © 2017 OpenWrt.org
#
. /lib/functions.sh
. /lib/functions/leds.sh
. /usr/share/libubox/jshn.sh
preinit_match_diag_led() {
local CFG keys key cfg name sysfs default
CFG=/etc/board.json
if [ ! -s $CFG ]; then
CFG=/tmp/board.json
[ -s /tmp/sysinfo/model ] || return
/bin/board_detect $CFG || return
fi
json_init
json_load "$(cat $CFG)"
json_get_keys keys led
json_is_a led object || return
json_select led
for key in $keys; do
json_select "$key"
json_get_vars name sysfs default
if [ "$name" = "DIAG" -a "$default" = "1" ]; then
status_led="$sysfs"
return
fi
json_select ..
done
}
match_diag_led() {
local name
local default
local sysfs
config_get name "$1" name
config_get default "$1" default
config_get sysfs "$1" sysfs
if [ "$name" = "DIAG" -a "$default" = "1" ]; then
status_led="$sysfs"
fi
}
get_status_led() {
if [ -s /etc/config/system ]; then
config_load system
config_foreach match_diag_led led
else
preinit_match_diag_led
fi
}
set_state() {
get_status_led
case "$1" in
preinit)
status_led_blink_preinit
;;
failsafe)
status_led_blink_failsafe
;;
preinit_regular)
status_led_blink_preinit_regular
;;
upgrade)
status_led_blink_preinit_regular
;;
done)
status_led_on
;;
esac
}

View File

@@ -0,0 +1,5 @@
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
@GRUB_SERIAL@::askfirst:/usr/libexec/login.sh
hvc0::askfirst:/usr/libexec/login.sh
tty1::askfirst:/usr/libexec/login.sh

View File

@@ -0,0 +1,65 @@
sanitize_name_x86() {
sed -e '
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;
s/[^a-z0-9_-]\+/-/g;
s/^-//;
s/-$//;
' "$@"
}
do_sysinfo_x86() {
local vendor product file
for file in sys_vendor board_vendor; do
vendor="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)"
case "$vendor" in
empty | \
System\ manufacturer | \
To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.)
continue
;;
esac
[ -n "$vendor" ] && break
done
for file in product_name board_name; do
product="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)"
case "$vendor:$product" in
?*:empty | \
?*:System\ Product\ Name | \
?*:To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.)
continue
;;
"PC Engines:APU")
product="apu1"
break
;;
"Sophos:SG"|"Sophos:XG")
local product_version
product_version="$(cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null)"
case "$product_version" in
105*|115*|125*|135*|85*|86*)
product="${product}-${product_version}"
break
;;
esac
;;
"Supermicro:Super Server")
continue
;;
?*:?*)
break
;;
esac
done
[ -n "$vendor" -a -n "$product" ] || return
mkdir -p /tmp/sysinfo
echo "$vendor $product" > /tmp/sysinfo/model
sanitize_name_x86 /tmp/sysinfo/model > /tmp/sysinfo/board_name
}
boot_hook_add preinit_main do_sysinfo_x86

View File

@@ -0,0 +1,9 @@
# Copyright (C) 2018 OpenWrt.org
do_load_x86_ucode() {
if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
echo 1 > /sys/devices/system/cpu/microcode/reload
fi
}
boot_hook_add preinit_main do_load_x86_ucode

View File

@@ -0,0 +1,7 @@
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
do_mount_procfs() {
mount -o noatime -t proc none /proc
}

View File

@@ -0,0 +1,5 @@
check_for_iso() {
grep -qE '/dev/root.*iso9660' /proc/mounts && ramoverlay
}
boot_hook_add preinit_mount_root check_for_iso

View File

@@ -0,0 +1,19 @@
# Copyright (C) 2012-2015 OpenWrt.org
move_config() {
local partdev parttype=ext4
. /lib/upgrade/common.sh
if export_bootdevice && export_partdevice partdev 1; then
mkdir -p /boot
part_magic_fat "/dev/$partdev" && parttype=vfat
mount -t $parttype -o rw,noatime "/dev/$partdev" /boot
if [ -f "/boot/$BACKUP_FILE" ]; then
mv -f "/boot/$BACKUP_FILE" /
fi
mount --bind /boot/boot /boot
fi
}
boot_hook_add preinit_mount_root move_config

View File

@@ -0,0 +1,130 @@
RAMFS_COPY_BIN='grub-bios-setup'
platform_check_image() {
local diskdev partdev diff
[ "$#" -gt 1 ] && return 1
case "$(get_magic_word "$1")" in
eb48|eb63) ;;
*)
v "Invalid image type"
return 1
;;
esac
export_bootdevice && export_partdevice diskdev 0 || {
v "Unable to determine upgrade device"
return 1
}
get_partitions "/dev/$diskdev" bootdisk
v "Extract boot sector from the image"
get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b
get_partitions /tmp/image.bs image
#compare tables
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
if [ -n "$diff" ]; then
v "Partition layout has changed. Full image will be written."
ask_bool 0 "Abort" && exit 1
return 0
fi
}
platform_copy_config() {
local partdev parttype=ext4
if export_partdevice partdev 1; then
part_magic_fat "/dev/$partdev" && parttype=vfat
mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt
cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE"
umount /mnt
fi
}
platform_do_bootloader_upgrade() {
local bootpart parttable=msdos
local diskdev="$1"
if export_partdevice bootpart 1; then
mkdir -p /tmp/boot
mount -o rw,noatime "/dev/$bootpart" /tmp/boot
echo "(hd0) /dev/$diskdev" > /tmp/device.map
part_magic_efi "/dev/$diskdev" && parttable=gpt
v "Upgrading bootloader on /dev/$diskdev..."
grub-bios-setup \
-m "/tmp/device.map" \
-d "/tmp/boot/boot/grub" \
-r "hd0,${parttable}1" \
"/dev/$diskdev"
umount /tmp/boot
fi
}
platform_do_upgrade() {
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev 0 || {
v "Unable to determine upgrade device"
return 1
}
sync
if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then
get_partitions "/dev/$diskdev" bootdisk
v "Extract boot sector from the image"
get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b
get_partitions /tmp/image.bs image
#compare tables
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
else
diff=1
fi
if [ -n "$diff" ]; then
get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync
# Separate removal and addtion is necessary; otherwise, partition 1
# will be missing if it overlaps with the old partition 2
partx -d - "/dev/$diskdev"
partx -a - "/dev/$diskdev"
return 0
fi
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
if export_partdevice partdev $part; then
v "Writing image to /dev/$partdev..."
get_image_dd "$1" of="/dev/$partdev" ibs=512 obs=1M skip="$start" count="$size" conv=fsync
else
v "Unable to find partition $part device, skipped."
fi
done < /tmp/partmap.image
v "Writing new UUID to /dev/$diskdev..."
get_image_dd "$1" of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
platform_do_bootloader_upgrade "$diskdev"
local parttype=ext4
part_magic_efi "/dev/$diskdev" || return 0
if export_partdevice partdev 1; then
part_magic_fat "/dev/$partdev" && parttype=vfat
mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt
set -- $(dd if="/dev/$diskdev" bs=1 skip=1168 count=16 2>/dev/null | hexdump -v -e '8/1 "%02x "" "2/1 "%02x""-"6/1 "%02x"')
sed -i "s/\(PARTUUID=\)[a-f0-9-]\+/\1$4$3$2$1-$6$5-$8$7-$9/ig" /mnt/boot/grub/grub.cfg
umount /mnt
fi
}