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

Testing:
- An ISO image can be built successfully.
- PXE boot-based installation onto an All-in-One Duplex lab was
  successful with rt and std kernels.
- Latest driver versions are loaded by default and the DDP
  firmware version is correct. It is 1.3.30.0.
- It is possible to switch to the legacy drivers manually with
  command line parameter multi-drivers-switch=cvl-2.54, and the DDP
  firmware version is 1.3.26.0.
- It is also possible to switch back to the latest drivers manually
  with command line parameter multi-drivers-switch=cvl-4.0.1.

Closes-Bug: 1994914
Depends-On: https://review.opendev.org/c/starlingx/tools/+/862783

Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
Change-Id: I95922988e70615fe8efb1354f09c421972f014a0
This commit is contained in:
Jiping Ma 2022-10-27 01:58:46 -04:00
parent 1ac6d8adc9
commit ec26e52cda
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

@ -6,3 +6,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