integ/ostree/initramfs-ostree/debian/patches/0009-Switch-drivers-in-init...

75 lines
2.2 KiB
Diff

From ae37f72593a2f539fdcf039db38ac9dcb80f9a63 Mon Sep 17 00:00:00 2001
From: Jiping Ma <jiping.ma2@windriver.com>
Date: Wed, 26 Oct 2022 18:26:33 -0700
Subject: [PATCH] Switch drivers in initramfs
Running depmod fails on Debian loads due to ostree. Using
"ostree admin unlock --hotfix" allows the command to pass,
but that's not usable for feature/product delivery.
So we will switch drivers in initramfs. If cmdline parameter
multi-drivers-switch is set to legacy, the legacy drivers
will be loaded by "insmod" command before udevd is started,
and that ensures that the legacy drivers will be loaded
rather than the latest drivers.
We need do the following steps to switch to the legacy drivers.
1. Add cmdline parameter multi-drivers-switch=cvl-2.54
2. reboot
Do the following steps to switch back to the latest drivers.
1. Add cmdline parameter multi-drivers-switch=cvl-4.0.1
2. reboot
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
---
init-ostree.sh | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/init-ostree.sh b/init-ostree.sh
index 80d4082..eded9ff 100644
--- a/init-ostree.sh
+++ b/init-ostree.sh
@@ -64,6 +64,15 @@ do_mount_fs() {
mount -t "$1" "$1" "$2"
}
+network_modules() {
+ if grep -s -q '\smulti-drivers-switch=cvl-2.54' /proc/cmdline ; then
+ insmod /lib/modules/"$(uname -r)"/extra/ice-1.5.8.1/ice.ko
+ insmod /lib/modules/"$(uname -r)"/extra/i40e-2.14.13/i40e.ko
+ insmod /lib/modules/"$(uname -r)"/extra/iavf-4.0.1/iavf.ko
+ echo "Legacy NIC drivers have been activated"
+ fi
+}
+
early_setup() {
do_mount_fs proc /proc
@@ -72,6 +81,8 @@ early_setup() {
do_mount_fs tmpfs /tmp
do_mount_fs tmpfs /run
+ network_modules
+
$_UDEV_DAEMON --daemon
udevadm trigger --action=add
@@ -167,13 +178,6 @@ fatal() {
early_setup
-if grep -s -q '\smulti-drivers-switch=' /proc/cmdline ; then
- rm -r /lib/modules/*/updates/ice
- rm -r /lib/modules/*/updates/i40e
- rm -r /lib/modules/*/updates/iavf
- echo "Removed network drivers ice, i40e and iavf"
-fi
-
read_args
[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
--
2.35.1