From feb28593f70eec247e0adbae7ff711a7f2241d93 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Thu, 19 Sep 2019 02:26:22 -0500 Subject: [PATCH] kernel: Fix to test locally changes and rename vmlinuz or vmlinux for virtiofs This will allow to test local changes to the kernel as well it will allow us to have vmlinuz or vmlinux with virtiofs. Depends-on: github.com/kata-containers/runtime#2078 Fixes #717 Signed-off-by: Gabriela Cervantes --- kernel/build-kernel.sh | 20 ++++++++++++----- kernel/kata_config_version | 2 +- release/kata-deploy-binaries.sh | 40 +++++++++++++++++++++++---------- 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/kernel/build-kernel.sh b/kernel/build-kernel.sh index 3f8ac2d500..cb3011a1d2 100755 --- a/kernel/build-kernel.sh +++ b/kernel/build-kernel.sh @@ -370,10 +370,16 @@ install_kata() { install --mode 0644 -D "vmlinux" "${install_path}/${vmlinux}" install --mode 0644 -D ./.config "${install_path}/config-${kernel_version}" - ln -sf "${vmlinuz}" "${install_path}/vmlinuz.container" - ln -sf "${vmlinux}" "${install_path}/vmlinux.container" - ls -la "${install_path}/vmlinux.container" - ls -la "${install_path}/vmlinuz.container" + if [[ ${experimental_kernel} == "true" ]]; then + sufix="-virtiofs.container" + else + sufix=".container" + fi + + ln -sf "${vmlinuz}" "${install_path}/vmlinuz${sufix}" + ln -sf "${vmlinux}" "${install_path}/vmlinux${sufix}" + ls -la "${install_path}/vmlinux${sufix}" + ls -la "${install_path}/vmlinuz${sufix}" popd >>/dev/null } @@ -427,7 +433,11 @@ main() { if [ -z "${kernel_path}" ]; then config_version=$(get_config_version) - kernel_path="${PWD}/kata-linux-${kernel_version}-${config_version}" + if [[ ${experimental_kernel} == "true" ]]; then + kernel_path="${PWD}/kata-linux-experimental-${kernel_version}-${config_version}" + else + kernel_path="${PWD}/kata-linux-${kernel_version}-${config_version}" + fi info "Config version: ${config_version}" fi diff --git a/kernel/kata_config_version b/kernel/kata_config_version index 82cced27d7..0691f67b20 100644 --- a/kernel/kata_config_version +++ b/kernel/kata_config_version @@ -1 +1 @@ -51 +52 diff --git a/release/kata-deploy-binaries.sh b/release/kata-deploy-binaries.sh index 0802c2c8ba..a7e34aae83 100755 --- a/release/kata-deploy-binaries.sh +++ b/release/kata-deploy-binaries.sh @@ -20,6 +20,9 @@ readonly GOPATH="${tmp_dir}/go" push=false export GOPATH workdir="${WORKDIR:-$PWD}" +# This flag help us to test and run this script with changes +# that are local +test_local="false" exit_handler() { [ -d "${tmp_dir}" ] || sudo rm -rf "${tmp_dir}" @@ -58,6 +61,7 @@ version: The kata version that will be use to create the tarball options: -h : Show this help +-l : Run this script to test changes locally -p : push tarball to ${project_to_attach} -w : directory where tarball will be created @@ -89,23 +93,34 @@ install_image() { #Install kernel asset install_kernel() { - go get "github.com/${project}/packaging" || true - ( - cd ${GOPATH}/src/github.com/${project}/packaging >>/dev/null + if [[ "$test_local" == "true" ]]; then + pushd "${script_dir}/../" + else + go get "github.com/${project}/packaging" || true + pushd ${GOPATH}/src/github.com/${project}/packaging >>/dev/null git checkout "${kata_version}-kernel-config" || git checkout "${kata_version}" + fi - info "build kernel" - ./kernel/build-kernel.sh setup - ./kernel/build-kernel.sh build - info "install kernel" - DESTDIR="${destdir}" PREFIX="${prefix}" ./kernel/build-kernel.sh install - ) + info "build kernel" + ./kernel/build-kernel.sh setup + ./kernel/build-kernel.sh build + info "install kernel" + DESTDIR="${destdir}" PREFIX="${prefix}" ./kernel/build-kernel.sh install + popd } #Install experimental kernel asset install_experimental_kernel() { - pushd ${GOPATH}/src/github.com/${project}/packaging + if [[ "$test_local" == "true" ]]; then + pushd "${script_dir}/../" + else + go get "github.com/${project}/packaging" || true + pushd ${GOPATH}/src/github.com/${project}/packaging >>/dev/null + git checkout "${kata_version}-kernel-config" || + git checkout "${kata_version}" + fi + info "build experimental kernel" ./kernel/build-kernel.sh -e setup ./kernel/build-kernel.sh -e build @@ -208,9 +223,10 @@ EOT } main() { - while getopts "hpw:" opt; do + while getopts "hlpw:" opt; do case $opt in h) usage 0 ;; + l) test_local="true" ;; p) push="true" ;; w) workdir="${OPTARG}" ;; esac @@ -226,8 +242,8 @@ main() { mkdir -p "${destdir}" install_image install_kata_components - install_kernel install_experimental_kernel + install_kernel install_qemu install_qemu_virtiofsd install_nemu