kernel: Re-work get_tee_kernel()

00aadfe20a introduced a regression on
`make cc-tdx-kernel-tarball` as we stopped passing all the needed
information to the `build-kernel.sh` script, leading to requiring `yq`
installed in the container used to build the kernel.

This commit partially reverts the faulty one, rewritting it in a way the
old behaviour is brought back, without changing the behaviour that was
added by the faulty commit.

Fixes: #5043

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio
2022-08-30 20:35:01 +02:00
parent 1b92a946d6
commit a1fdc08275
2 changed files with 5 additions and 7 deletions

View File

@@ -128,13 +128,12 @@ get_tee_kernel() {
[ -z "${kernel_url}" ] && kernel_url=$(get_from_kata_deps "assets.kernel.${tee}.url")
kernel_tarball="linux-${version}.tar.gz"
tarball_name=$(get_from_kata_deps "assets.kernel.${tee}.tarball")
[ -z "$tarball_name" ] || kernel_tarball="$tarball_name"
local kernel_tarball="${version}.tar.gz"
if [ ! -f "${kernel_tarball}" ]; then
curl --fail -OL "${kernel_url}/${kernel_tarball}"
fi
# Depending on where we're getting the terball from it may have a
# different name, such as linux-${version}.tar.gz or simply
# ${version}.tar.gz. Let's try both before failing.
curl --fail -OL "${kernel_url}/linux-${kernel_tarball}" || curl --fail -OL "${kernel_url}/${kernel_tarball}"
mkdir -p ${kernel_path}
tar --strip-components=1 -xf ${kernel_tarball} -C ${kernel_path}