Jiping Ma db0c0bcfec Make driver package release a command line param
Instead of hard-coding driver versions in the initramfs init script,
this commit makes the driver package release (e.g., "cvl-2.54") a kernel
command line parameter. As an example, if a driver package release is
specified with the command line argument multi-drivers-switch=<release>,
then the initramfs init script will look for the drivers in
"/lib/modules/$(uname -r)/{ice,iavf,i40e}-<release>/". This way, the
initramfs will not need further modifications for new/different driver
package releases that are integrated into StarlingX in the future.

It also changes the legacy driver deb package names from
	ice-1.5.8.1-legacy
	iavf-4.0.1-legacy
	i40e-2.14.13-legacy
to
	ice-cvl-2.54
	iavf-cvl-2.54
	i40e-cvl-2.54

Legacy drivers location folder:
ls /lib/modules/$(uname -r)/extra/
i40e-cvl-2.54  iavf-cvl-2.54  ice-cvl-2.54

Latest driverslocation folder:
/lib/modules/$(uname -r)/updates/
i40e-cvl-4.0.1  iavf-cvl-4.0.1  ice-cvl-4.0.1

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.

Story: 2010326
Task: 46705

Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
Change-Id: Ic20922dacee0807b908354189ec185ace2737810
2022-11-03 22:47:31 -04:00

70 lines
2.4 KiB
Makefile
Executable File

#!/usr/bin/make -f
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
%:
dh $@
WITH_MOD_SIGN ?= 1
kheaders_name=$(shell ls /usr/src | grep linux@KERNEL_TYPE@-headers | grep amd64)
kheaders_common=$(shell ls /usr/src | grep linux@KERNEL_TYPE@-headers | grep common)
export KSRC=/usr/src/$(kheaders_name)
export KSRC_COMMON=/usr/src/$(kheaders_common)
kversion=$(shell echo $(kheaders_name) | sed 's/linux@KERNEL_TYPE@-headers-//g')
kmod_name=iavf
version=$(shell dpkg-parsechangelog | sed -n 's/^Version: *\([^-]\+\)-.\+/\1/p')
bundle_version=cvl-2.54
ifeq ($(WITH_MOD_SIGN),1)
pkg_name=iavf-$(bundle_version)@KERNEL_TYPE@
endif
pkg_common_name=iavf-$(bundle_version)-common
_sysconfdir=/etc
_defaultdocdir=/usr/share/doc
_mandir=/usr/share/man
ifeq ($(WITH_MOD_SIGN),1)
_keydir ?= /usr/src/kernels/$(kversion)/
privkey ?= $(_keydir)/signing_key.pem
pubkey ?= $(_keydir)/signing_key.x509
endif
override_dh_auto_install:
dh_install src/$(kmod_name).ko /lib/modules/$(kversion)/extra/$(kmod_name)-$(bundle_version)/
dh_install -p$(pkg_common_name) pci.updates $(_defaultdocdir)/kmod-$(kmod_name)-$(version)/
dh_install -p$(pkg_common_name) README $(_defaultdocdir)/kmod-$(kmod_name)-$(version)/
dh_install -p$(pkg_common_name) $(kmod_name).7 $(_mandir)/man7/$(kmod_name)-$(version)/
override_dh_strip:
dh_strip
find debian -name '*.ko' | xargs strip -g
ifeq ($(WITH_MOD_SIGN),1)
@echo "Sign the modules!"
/usr/lib/linux@KERNEL_TYPE@-kbuild-*/scripts/sign-file sha256 $(privkey) $(pubkey) \
./debian/$(pkg_name)/lib/modules/$(kversion)/extra/$(kmod_name)-$(bundle_version)/$(kmod_name).ko
endif
override_dh_auto_build:
dh_auto_build -D ./src