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:
65
target/linux/x86/base-files/lib/preinit/01_sysinfo
Normal file
65
target/linux/x86/base-files/lib/preinit/01_sysinfo
Normal 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
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
|
||||
5
target/linux/x86/base-files/lib/preinit/20_check_iso
Normal file
5
target/linux/x86/base-files/lib/preinit/20_check_iso
Normal 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
|
||||
19
target/linux/x86/base-files/lib/preinit/79_move_config
Normal file
19
target/linux/x86/base-files/lib/preinit/79_move_config
Normal 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
|
||||
Reference in New Issue
Block a user