From ec26e52cda7726411b2300df61002fed767b0bc9 Mon Sep 17 00:00:00 2001 From: Jiping Ma Date: Thu, 27 Oct 2022 01:58:46 -0400 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 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 Change-Id: I95922988e70615fe8efb1354f09c421972f014a0 --- .../0009-Switch-drivers-in-initramfs.patch | 74 +++++++++++++++++++ ostree/initramfs-ostree/debian/patches/series | 1 + 2 files changed, 75 insertions(+) create mode 100644 ostree/initramfs-ostree/debian/patches/0009-Switch-drivers-in-initramfs.patch diff --git a/ostree/initramfs-ostree/debian/patches/0009-Switch-drivers-in-initramfs.patch b/ostree/initramfs-ostree/debian/patches/0009-Switch-drivers-in-initramfs.patch new file mode 100644 index 000000000..a2d0cbdd1 --- /dev/null +++ b/ostree/initramfs-ostree/debian/patches/0009-Switch-drivers-in-initramfs.patch @@ -0,0 +1,74 @@ +From ae37f72593a2f539fdcf039db38ac9dcb80f9a63 Mon Sep 17 00:00:00 2001 +From: Jiping Ma +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 +--- + 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 + diff --git a/ostree/initramfs-ostree/debian/patches/series b/ostree/initramfs-ostree/debian/patches/series index 901fffccd..59ebed057 100644 --- a/ostree/initramfs-ostree/debian/patches/series +++ b/ostree/initramfs-ostree/debian/patches/series @@ -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