Revert "implement load extra kernel modules"

This reverts commit 67e9c0e8365a66d04c878b064a63ffb8ed6b21cc.
This commit is contained in:
jumkey 2021-10-08 12:35:36 +08:00
parent 6cf6a9d0e6
commit 97e3db07f3
6 changed files with 5 additions and 82 deletions

View File

@ -27,8 +27,7 @@
"ramdisk": [
"@@@COMMON@@@/ramdisk-001-disable-root-pwd.patch",
"@@@COMMON@@@/v7.0.1/ramdisk-002-init-script.patch",
"@@@COMMON@@@/v7.0.1/ramdisk-003-post-init-script.patch",
"@@@COMMON@@@/v7.0.1/ramdisk-004-extra-modules.patch"
"@@@COMMON@@@/v7.0.1/ramdisk-003-post-init-script.patch"
]
},
"synoinfo": {

View File

@ -26,8 +26,7 @@
"ramdisk": [
"@@@COMMON@@@/ramdisk-001-disable-root-pwd.patch",
"@@@COMMON@@@/v7.0.1/ramdisk-002-init-script.patch",
"@@@COMMON@@@/v7.0.1/ramdisk-003-post-init-script.patch",
"@@@COMMON@@@/v7.0.1/ramdisk-004-extra-modules.patch"
"@@@COMMON@@@/v7.0.1/ramdisk-003-post-init-script.patch"
]
},

View File

@ -1,16 +1,14 @@
--- a/linuxrc.syno.impl
+++ b/linuxrc.syno.impl
@@ -155,6 +155,9 @@ fi
@@ -155,6 +155,7 @@ fi
# insert basic USB modules for detect f401/FDT
echo "Insert basic USB modules..."
SYNOLoadModules $USB_MODULES
+SYNOLoadModules "usb-storage"
+DISK_MODULES=`cat /lib/modules-load.d/??-disk-????-*.conf | xargs`
+SYNOLoadModules $DISK_MODULES
# insert Etron USB3.0 drivers
@@ -270,7 +273,7 @@ if [ "x" != "x`/bin/get_key_value /etc.d
@@ -270,7 +271,7 @@ if [ "x" != "x`/bin/get_key_value /etc.d
fi
if [ "$UniqueRD" = "kvmx64" -o \
"$UniqueRD" = "nextkvmx64" -o \

View File

@ -1,6 +1,6 @@
--- a/usr/sbin/init.post
+++ b/usr/sbin/init.post
@@ -18,6 +18,54 @@ if [ "$UniqueRD" = "nextkvmx64" ]; then
@@ -18,6 +18,27 @@ if [ "$UniqueRD" = "nextkvmx64" ]; then
fi
Mount "$RootDevice" /tmpRoot -o barrier=1
@ -11,33 +11,6 @@
+
+@@@CONFIG-GENERATED@@@
+
+DISK_MODULES=`cat /lib/modules-load.d/??-disk-????-*.conf | xargs`
+EXTRA_MODULES=`cat /lib/modules-load.d/??-extra-????-*.conf | xargs`
+OPTIONAL_MODULES=`cat /lib/modules-load.d/??-optional-????-*.conf | xargs`
+# FIXME should not copy all firmware
+EXTRA_FIRMWARES=`find /lib/firmware/ -printf "%P\n" | xargs`
+mkdir /tmpRoot/lib/modules-load.d/
+cp -a /lib/modules-load.d/??-disk-????-*.conf /tmpRoot/lib/modules-load.d/
+cp -a /lib/modules-load.d/??-extra-????-*.conf /tmpRoot/lib/modules-load.d/
+cp -a /lib/modules-load.d/??-optional-????-*.conf /tmpRoot/lib/modules-load.d/
+ln -s /bin/kmod /tmpRoot/usr/sbin/depmod
+
+for mod in $DISK_MODULES $EXTRA_MODULES $OPTIONAL_MODULES; do
+ src=/usr/lib/modules/${mod}.ko
+ dest=/usr/lib/modules/update/${mod}.ko
+ _cp_mod $src $dest
+ #echo "install $mod returns $?"
+done
+
+for fw in $EXTRA_FIRMWARES; do
+ path=/usr/lib/firmware/${fw}
+ _cp_fw $path $path
+ #echo "install $fw returns $?"
+done
+ln -s /tmpRoot/bin/kmod /usr/sbin/depmod
+/usr/sbin/depmod -a -b /tmpRoot
+rm /usr/sbin/depmod
+
+UPSTART="/tmpRoot/usr/share/init"
+
+if ! echo; then

View File

@ -1,11 +0,0 @@
--- a/etc/rc
+++ b/etc/rc
@@ -175,6 +175,8 @@ if [ "$PLATFORM" = "grantley" ]; then
fi
SYNOLoadIPv6
+EXTRA_MODULES=`cat /lib/modules-load.d/??-extra-????-*.conf | xargs`
+KERNEL_MODULES="${KERNEL_MODULES} ${EXTRA_MODULES}"
SYNOLoadModules ${KERNEL_MODULES}
SYNOLoadAdt7490
SoftLink7490fanInput

View File

@ -5,41 +5,6 @@
# be able to execute in the initramfs/preboot environment (so no bashism etc)
# All comments will be stripped, functions here should NOT start with brp_ as they're not part of the builder
# $1 src, $2 dst, $3 shortname
_cp_mod()
{
local dest="/tmpRoot/$2"
[ -f "$1" ] || return 1
/tmpRoot/usr/bin/cmp -s "$1" "$dest" && return 2
if [ -f "$dest" ]; then
echo "Updating $dest..."
else
[ "x$1" != "x$2" -a -f "/tmpRoot/$1" ] &&
/tmpRoot/usr/bin/cmp -s "$1" "/tmpRoot/$1" &&
return 3
echo "Installing $dest..."
local d=`dirname "$dest"`
[ -d "$d" ] || mkdir -p "$d" || return 4
fi
cp -a "$1" "$dest"
}
# should modify module to avoid overwrite firmware
# otherwise there is no good way to update firmware
_cp_fw()
{
local dst="/tmpRoot/$2"
/tmpRoot/usr/bin/cmp -s "$1" "$dst" && return 1
if [ -f "$dst" ]; then
echo "Updating $dst..."
else
local d=`dirname "$dst"`
[ -d "$d" ] || mkdir -p "$d" || return 2
echo "Installing $dst..."
fi
cp -a "$1" "/tmpRoot/$2"
}
if [ -z ${SED_PATH+x} ]; then
echo "Your SED_PATH variable is not set/is empty!"