Merge "Switch drivers in initramfs"

This commit is contained in:
Zuul 2022-10-28 21:40:18 +00:00 committed by Gerrit Code Review
commit 6c1979d4a4
2 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,74 @@
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

View File

@ -5,3 +5,4 @@
0006-init-ostree-install.sh-break-hardlinks-in-var.patch
0007-Add-support-for-StarlingX-partitioning-formatting.patch
0008-Support-multi-drivers-in-initramfs.patch
0009-Switch-drivers-in-initramfs.patch