Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
snap: use build_kernel.sh to build the kernel
Browse files Browse the repository at this point in the history
In order to support kernel config fragments in the snap, the kernel should
be built using the build_kernel.sh script.

fixes #438

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes committed Apr 25, 2019
1 parent 4115942 commit fb92eaf
Showing 1 changed file with 12 additions and 47 deletions.
59 changes: 12 additions & 47 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,7 @@ 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]
after: [kernel-dump, scripts-dump]
plugin: kernel
build-packages:
- libelf-dev
Expand All @@ -190,48 +184,11 @@ parts:
build-snaps:
- yq
override-build: |
versions_url=https://raw.githubusercontent.com/kata-containers/runtime/${SNAPCRAFT_PROJECT_VERSION}/versions.yaml
versions_url=https://raw.githubusercontent.com/kata-containers/runtime/master/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}"
;;
"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
${SNAPCRAFT_STAGE}/kernel/build-kernel.sh setup
# 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
cd kata-linux-${version}-*
make -j $(($(nproc)-1)) EXTRAVERSION=".container"
kernel_suffix=${version}.container
Expand All @@ -256,6 +213,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]
Expand Down

0 comments on commit fb92eaf

Please sign in to comment.