Initial commit

This commit is contained in:
domenico
2025-06-24 13:14:22 +02:00
commit 4002f145fc
9002 changed files with 1731834 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
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)"
[ -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
"PC Engines:APU")
product="apu1"
break
;;
"Sophos:SG"|"Sophos:XG")
case "$(cat /sys/devices/virtual/dmi/id/product_version 2>/dev/null)" in
105*)
product="${product}-105"
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,18 @@
upgrade_bootloader() {
local diskdev
. /lib/upgrade/common.sh
if [ ! -f /boot/grub/upgraded ] && export_bootdevice && export_partdevice diskdev 0; then
part_magic_efi "/dev/$diskdev" && return 0
echo "(hd0) /dev/$diskdev" > /tmp/device.map
/usr/sbin/grub-bios-setup \
-m "/tmp/device.map" \
-d "/boot/grub" \
-r "hd0,msdos1" \
"/dev/$diskdev" \
&& touch /boot/grub/upgraded
fi
}
[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main upgrade_bootloader