packaging: Add function to get the kernel modules directory

Right now this is just being added but not used yet.  The idea is to use
this to both cache and later on untar the kernel modules needed for some
of the kernel targets we have (specifically looking at the confidential
one).

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2024-02-01 12:19:34 +01:00
parent 9c0312d466
commit 33ac5468fe
No known key found for this signature in database
GPG Key ID: EE926C2BDACC177B

View File

@ -126,6 +126,24 @@ EOF
exit "${return_code}"
}
get_kernel_modules_dir() {
local kernel_version="${1:-}"
local kernel_kata_config_version="${2:-}"
local kernel_name"=${3:-}"
[ -z "${kernel_version}" ] && die "kernel version is a required argument"
[ -z "${kernel_kata_config_version}" ] && die "kernel kata config version is a required argument"
[ -z "${kernel_name}" ] && die "kernel name is a required argument"
local version=${kernel_version#v}
local numeric_final_version=${version}
# Every first release of a kernel is x.y, while the resulting folder would be x.y.0
local dots=$(echo ${version} | grep -o '\.' | wc -l)
[ "${dots}" == "1" ] && numeric_final_version="${version}.0"
echo "${repo_root_dir}/tools/packaging/kata-deploy/local-build/build/${kernel_name}/builddir/kata-linux-${version}-${kernel_kata_config_version}/lib/modules/${numeric_final_version}"
}
cleanup_and_fail() {
rm -f "${component_tarball_name}"
return 1