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 <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
Gabriela Cervantes 2019-09-19 02:26:22 -05:00
parent 827e85d259
commit feb28593f7
3 changed files with 44 additions and 18 deletions

View File

@ -370,10 +370,16 @@ install_kata() {
install --mode 0644 -D "vmlinux" "${install_path}/${vmlinux}" install --mode 0644 -D "vmlinux" "${install_path}/${vmlinux}"
install --mode 0644 -D ./.config "${install_path}/config-${kernel_version}" install --mode 0644 -D ./.config "${install_path}/config-${kernel_version}"
ln -sf "${vmlinuz}" "${install_path}/vmlinuz.container" if [[ ${experimental_kernel} == "true" ]]; then
ln -sf "${vmlinux}" "${install_path}/vmlinux.container" sufix="-virtiofs.container"
ls -la "${install_path}/vmlinux.container" else
ls -la "${install_path}/vmlinuz.container" 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 popd >>/dev/null
} }
@ -427,7 +433,11 @@ main() {
if [ -z "${kernel_path}" ]; then if [ -z "${kernel_path}" ]; then
config_version=$(get_config_version) 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}" info "Config version: ${config_version}"
fi fi

View File

@ -1 +1 @@
51 52

View File

@ -20,6 +20,9 @@ readonly GOPATH="${tmp_dir}/go"
push=false push=false
export GOPATH export GOPATH
workdir="${WORKDIR:-$PWD}" workdir="${WORKDIR:-$PWD}"
# This flag help us to test and run this script with changes
# that are local
test_local="false"
exit_handler() { exit_handler() {
[ -d "${tmp_dir}" ] || sudo rm -rf "${tmp_dir}" [ -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: options:
-h : Show this help -h : Show this help
-l : Run this script to test changes locally
-p : push tarball to ${project_to_attach} -p : push tarball to ${project_to_attach}
-w <dir>: directory where tarball will be created -w <dir>: directory where tarball will be created
@ -89,23 +93,34 @@ install_image() {
#Install kernel asset #Install kernel asset
install_kernel() { install_kernel() {
go get "github.com/${project}/packaging" || true if [[ "$test_local" == "true" ]]; then
( pushd "${script_dir}/../"
cd ${GOPATH}/src/github.com/${project}/packaging >>/dev/null 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}-kernel-config" ||
git checkout "${kata_version}" git checkout "${kata_version}"
fi
info "build kernel" info "build kernel"
./kernel/build-kernel.sh setup ./kernel/build-kernel.sh setup
./kernel/build-kernel.sh build ./kernel/build-kernel.sh build
info "install kernel" info "install kernel"
DESTDIR="${destdir}" PREFIX="${prefix}" ./kernel/build-kernel.sh install DESTDIR="${destdir}" PREFIX="${prefix}" ./kernel/build-kernel.sh install
) popd
} }
#Install experimental kernel asset #Install experimental kernel asset
install_experimental_kernel() { 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" info "build experimental kernel"
./kernel/build-kernel.sh -e setup ./kernel/build-kernel.sh -e setup
./kernel/build-kernel.sh -e build ./kernel/build-kernel.sh -e build
@ -208,9 +223,10 @@ EOT
} }
main() { main() {
while getopts "hpw:" opt; do while getopts "hlpw:" opt; do
case $opt in case $opt in
h) usage 0 ;; h) usage 0 ;;
l) test_local="true" ;;
p) push="true" ;; p) push="true" ;;
w) workdir="${OPTARG}" ;; w) workdir="${OPTARG}" ;;
esac esac
@ -226,8 +242,8 @@ main() {
mkdir -p "${destdir}" mkdir -p "${destdir}"
install_image install_image
install_kata_components install_kata_components
install_kernel
install_experimental_kernel install_experimental_kernel
install_kernel
install_qemu install_qemu
install_qemu_virtiofsd install_qemu_virtiofsd
install_nemu install_nemu