Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to build kernel in a container. Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
- Loading branch information
Showing
5 changed files
with
62 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright (c) 2021 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
FROM ubuntu | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# kernel deps | ||
RUN apt update | ||
RUN apt install -y \ | ||
bc \ | ||
bison \ | ||
build-essential \ | ||
curl \ | ||
flex \ | ||
git \ | ||
iptables \ | ||
libelf-dev \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2021 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
readonly repo_root_dir="$(cd "${script_dir}/../../../.." && pwd)" | ||
readonly kernel_builder="${repo_root_dir}/tools/packaging/kernel/build-kernel.sh" | ||
|
||
|
||
kernel_version=${1} | ||
DESTDIR=${DESTDIR:-${PWD}} | ||
PREFIX=${PREFIX:-/opt/kata} | ||
container_image="kata-kernel-builder" | ||
|
||
sudo docker build -t "${container_image}" "${script_dir}" | ||
|
||
echo "build ${kernel_version}" | ||
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ | ||
-w "${PWD}" \ | ||
"${container_image}" \ | ||
bash -c "${kernel_builder} -v ${kernel_version} setup" | ||
|
||
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ | ||
-w "${PWD}" \ | ||
"${container_image}" \ | ||
bash -c "${kernel_builder} -v ${kernel_version} build" | ||
|
||
sudo docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \ | ||
-w "${PWD}" \ | ||
--env DESTDIR="${DESTDIR}" --env PREFIX="${PREFIX}" \ | ||
"${container_image}" \ | ||
bash -c "${kernel_builder} -v ${kernel_version} install" |