Merge "Make driver package release a command line param"

This commit is contained in:
Zuul 2022-11-10 02:48:18 +00:00 committed by Gerrit Code Review
commit fa933d905f
4 changed files with 84 additions and 114 deletions

View File

@ -0,0 +1,83 @@
From e5f3bfdb1bf1438d4d1c4b2625eb8830b554cf69 Mon Sep 17 00:00:00 2001
From: Jiping Ma <jiping.ma2@windriver.com>
Date: Thu, 3 Nov 2022 20:39:50 -0700
Subject: [PATCH] Make driver switch more adaptable
This commit makes it flexible to address future requirements.
It will load drivers based on multi-drivers-switch=version, if the
legacy drivers are put into /lib/modules/$(uname -r)/extra/.
That means we do not need to modify initramfs if we need to support
more drivers in the future.
Legacy drivers:
ls /lib/modules/$(uname -r)/extra/
i40e-cvl-2.54 iavf-cvl-2.54 ice-cvl-2.54
i40e-cvl-x.xx iavf-cvl-x.xx ice-cvl-x.xx
Latest drivers:
/lib/modules/$(uname -r)/updates/
i40e-cvl-4.0.1 iavf-cvl-4.0.1 ice-cvl-4.0.1
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
---
init-ostree.sh | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/init-ostree.sh b/init-ostree.sh
index b6eacbf..d0b0dda 100644
--- a/init-ostree.sh
+++ b/init-ostree.sh
@@ -64,6 +64,22 @@ do_mount_fs() {
mount -t "$1" "$1" "$2"
}
+network_modules() {
+ if grep -s -q '\smulti-drivers-switch=' /proc/cmdline ; then
+ if [ -d /lib/modules/"$(uname -r)"/extra/ice-"${DRIVER_VERSION}" ]; then
+ insmod /lib/modules/"$(uname -r)"/extra/ice-"${DRIVER_VERSION}"/ice.ko
+ insmod /lib/modules/"$(uname -r)"/extra/i40e-"${DRIVER_VERSION}"/i40e.ko
+ insmod /lib/modules/"$(uname -r)"/extra/iavf-"${DRIVER_VERSION}"/iavf.ko
+ echo "Legacy NIC ${DRIVER_VERSION} drivers have been activated"
+ elif [ -d /lib/modules/"$(uname -r)"/updates/ice-"${DRIVER_VERSION}" ]; then
+ insmod /lib/modules/"$(uname -r)"/updates/ice-"${DRIVER_VERSION}"/ice.ko
+ insmod /lib/modules/"$(uname -r)"/updates/i40e-"${DRIVER_VERSION}"/i40e.ko
+ insmod /lib/modules/"$(uname -r)"/updates/iavf-"${DRIVER_VERSION}"/iavf.ko
+ echo "NIC ${DRIVER_VERSION} drivers have been activated"
+ fi
+ fi
+}
+
early_setup() {
do_mount_fs proc /proc
@@ -72,6 +88,9 @@ early_setup() {
do_mount_fs tmpfs /tmp
do_mount_fs tmpfs /run
+ read_args
+ network_modules
+
$_UDEV_DAEMON --daemon
udevadm trigger --action=add
@@ -103,6 +122,8 @@ read_args() {
DEBUGFATAL=1 ;;
flux=*)
OSTREE_LABEL_FLUXDATA=$optarg ;;
+ multi-drivers-switch=*)
+ DRIVER_VERSION=$optarg ;;
esac
done
}
@@ -167,8 +188,6 @@ fatal() {
early_setup
-read_args
-
[ -z "$CONSOLE" ] && CONSOLE="/dev/console"
[ -z "$INIT" ] && INIT="/sbin/init"
--
2.35.1

View File

@ -1,38 +0,0 @@
From 21919ca120e0693419c3b97fb442edf040f660f2 Mon Sep 17 00:00:00 2001
From: Jiping Ma <jiping.ma2@windriver.com>
Date: Thu, 15 Sep 2022 02:48:39 -0700
Subject: [PATCH] Support multi-drivers in initramfs.
Remove the network drivers ice, i40e and iavf if multi-drivers-switch
is set in cmdline, which ensures that ice, i40e and iavf drivers will
not be loaded during initramfs stage.
pxe-network-installer will not be impacted because the parameter
multi-drivers-switch is not set in this stage.
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
---
init-ostree.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/init-ostree.sh b/init-ostree.sh
index 6017fcf..b0d46a1 100644
--- a/init-ostree.sh
+++ b/init-ostree.sh
@@ -167,6 +167,13 @@ 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

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

@ -4,5 +4,4 @@
0005-Wait-for-devices-to-be-configured-after-boot.patch
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
0008-Make-driver-switch-more-adaptable.patch