Skip to content

Commit

Permalink
kernel: measured rootfs as argument to build-kernel.sh
Browse files Browse the repository at this point in the history
By convention the caller of tools/packaging/kernel/build-kernel.sh changes
the script behavior by passing arguments, whereas, for measured rootfs
it has used an environment variable (MEASURED_ROOTFS). This refactor
the script so that the caller now must pass the "-m" argument to enable
the build of the kernel with measured rootfs support.

Fixes kata-containers#6674
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
  • Loading branch information
wainersm authored and Amulyam24 committed Jan 3, 2024
1 parent 8ee89f2 commit 3833bda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ install_kernel_helper() {

install_cached_kernel_tarball_component ${kernel_name} ${module_dir} && return 0

if [ "${MEASURED_ROOTFS}" == "yes" ]; then
info "build initramfs for cc kernel"
"${initramfs_builder}"
# Turn on the flag to build the kernel with support to
# measured rootfs.
extra_cmd+=" -m"
fi

info "build ${kernel_name}"
info "Kernel version ${kernel_version}"
DESTDIR="${destdir}" PREFIX="${prefix}" "${kernel_builder}" -v "${kernel_version}" ${extra_cmd}
Expand Down
3 changes: 1 addition & 2 deletions tools/packaging/kernel/build-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,7 @@ setup_kernel() {
[ -n "${hypervisor_target}" ] || hypervisor_target="kvm"
[ -n "${kernel_config_path}" ] || kernel_config_path=$(get_default_kernel_config "${kernel_version}" "${hypervisor_target}" "${arch_target}" "${kernel_path}")

if [ "${measured_rootfs}" == "true" ]; then
check_initramfs_or_die
if [ "${measured_rootfs}" == "true" ] && [ -f "${default_initramfs}" ]; then
info "Copying initramfs from: ${default_initramfs}"
cp "${default_initramfs}" ./
fi
Expand Down

0 comments on commit 3833bda

Please sign in to comment.