mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 19:16:23 +00:00
snap: setup kernel using build-kernel.sh
Setup the kernel by hand is prone to errors. Use `build-kernel.sh setup` to pull and setup the kata kernel. fixes #438 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
335b8846ed
commit
a0d0a20c98
@ -206,65 +206,22 @@ parts:
|
||||
TARGET=kata-ksm-throttler
|
||||
|
||||
kernel:
|
||||
override-pull: |
|
||||
versions_url=https://raw.githubusercontent.com/kata-containers/runtime/${SNAPCRAFT_PROJECT_VERSION}/versions.yaml
|
||||
version="$(curl -sSL ${versions_url} | yq r - assets.kernel.version | tr -d v)"
|
||||
url="$(curl -sSL ${versions_url} | yq r - assets.kernel.url)"
|
||||
curl -LO ${url}/linux-${version}.tar.xz
|
||||
tar -xf linux-${version}.tar.xz --strip-components=1
|
||||
after: [kernel-dump]
|
||||
plugin: kernel
|
||||
after: [kernel-dump, scripts-dump, yq]
|
||||
plugin: nil
|
||||
build-packages:
|
||||
- libelf-dev
|
||||
- curl
|
||||
- build-essential
|
||||
- bison
|
||||
- flex
|
||||
build-snaps:
|
||||
- yq
|
||||
override-build: |
|
||||
versions_url=https://raw.githubusercontent.com/kata-containers/runtime/${SNAPCRAFT_PROJECT_VERSION}/versions.yaml
|
||||
version="$(curl -sSL ${versions_url} | yq r - assets.kernel.version | tr -d v)"
|
||||
x_version="$(echo $version | sed -e 's|.[[:digit:]]*$||').x"
|
||||
case "$(uname -m)" in
|
||||
"x86_64")
|
||||
config="x86_64_kata_kvm_${x_version}"
|
||||
;;
|
||||
yq=$(realpath ../../yq/build/yq)
|
||||
|
||||
"ppc64le")
|
||||
config="powerpc_kata_kvm_${x_version}"
|
||||
;;
|
||||
|
||||
"aarch64")
|
||||
config="arm64_kata_kvm_${x_version}"
|
||||
;;
|
||||
|
||||
"s390x")
|
||||
config="s390_kata_kvm_${x_version}"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "ERROR: Unsupported architecture $(uname -m)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
make mrproper
|
||||
|
||||
|
||||
# Apply patches
|
||||
for patch in ${SNAPCRAFT_STAGE}/kernel/patches/${x_version}/*.patch; do
|
||||
echo "Applying $(basename "$patch") ..."
|
||||
patch \
|
||||
--batch \
|
||||
--forward \
|
||||
--strip 1 \
|
||||
--input "$patch"
|
||||
done
|
||||
|
||||
# Copy config file
|
||||
cp ${SNAPCRAFT_STAGE}/kernel/configs/${config} .config
|
||||
make -s oldconfig EXTRAVERSION=".container" > /dev/null
|
||||
# Say 'no' to everithing, fix issues with incomplete .config files
|
||||
yes "n" | ${SNAPCRAFT_STAGE}/kernel/build-kernel.sh setup
|
||||
kernel_dir_prefix="kata-linux-"
|
||||
cd ${kernel_dir_prefix}*
|
||||
version=$(basename ${PWD} | sed 's|'"${kernel_dir_prefix}"'||' | cut -d- -f1)
|
||||
make -j $(($(nproc)-1)) EXTRAVERSION=".container"
|
||||
|
||||
kernel_suffix=${version}.container
|
||||
@ -289,6 +246,14 @@ parts:
|
||||
prime:
|
||||
- -*
|
||||
|
||||
scripts-dump:
|
||||
source: scripts
|
||||
plugin: dump
|
||||
organize:
|
||||
'*' : scripts/
|
||||
prime:
|
||||
- -*
|
||||
|
||||
qemu:
|
||||
plugin: make
|
||||
after: [qemu-scripts-dump, qemu-lite-patches-dump, qemu-aarch64-patches-dump]
|
||||
|
Loading…
Reference in New Issue
Block a user