mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-18 01:13:56 +00:00
kernel: Add KERNEL_DEBUG_ENABLED to build scripts
We want to be able to build a debug version of the kernel for various use-cases like debugging, tracing and others. Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
parent
b7af7f344b
commit
a4597672c0
@ -60,6 +60,7 @@ KERNEL_HEADERS_PKG_TYPE="${KERNEL_HEADERS_PKG_TYPE:-deb}"
|
|||||||
RELEASE="${RELEASE:-"no"}"
|
RELEASE="${RELEASE:-"no"}"
|
||||||
KBUILD_SIGN_PIN="${KBUILD_SIGN_PIN:-}"
|
KBUILD_SIGN_PIN="${KBUILD_SIGN_PIN:-}"
|
||||||
RUNTIME_CHOICE="${RUNTIME_CHOICE:-both}"
|
RUNTIME_CHOICE="${RUNTIME_CHOICE:-both}"
|
||||||
|
KERNEL_DEBUG_ENABLED=${KERNEL_DEBUG_ENABLED:-"no"}
|
||||||
|
|
||||||
workdir="${WORKDIR:-$PWD}"
|
workdir="${WORKDIR:-$PWD}"
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ readonly default_initramfs="${script_dir}/initramfs.cpio.gz"
|
|||||||
readonly VENDOR_INTEL="intel"
|
readonly VENDOR_INTEL="intel"
|
||||||
readonly VENDOR_NVIDIA="nvidia"
|
readonly VENDOR_NVIDIA="nvidia"
|
||||||
readonly KBUILD_SIGN_PIN=${KBUILD_SIGN_PIN:-""}
|
readonly KBUILD_SIGN_PIN=${KBUILD_SIGN_PIN:-""}
|
||||||
|
readonly KERNEL_DEBUG_ENABLED=${KERNEL_DEBUG_ENABLED:-"no"}
|
||||||
|
|
||||||
#Path to kernel directory
|
#Path to kernel directory
|
||||||
kernel_path=""
|
kernel_path=""
|
||||||
@ -315,6 +316,12 @@ get_kernel_frag_path() {
|
|||||||
all_configs="${all_configs} ${sign_configs}"
|
all_configs="${all_configs} ${sign_configs}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ${KERNEL_DEBUG_ENABLED} == "yes" ]]; then
|
||||||
|
info "Enable kernel debug"
|
||||||
|
local debug_configs="$(ls ${common_path}/common/debug.conf)"
|
||||||
|
all_configs="${all_configs} ${debug_configs}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$force_setup_generate_config" == "true" ]]; then
|
if [[ "$force_setup_generate_config" == "true" ]]; then
|
||||||
info "Remove existing config ${config_path} due to '-f'"
|
info "Remove existing config ${config_path} due to '-f'"
|
||||||
[ -f "$config_path" ] && rm -f "${config_path}"
|
[ -f "$config_path" ] && rm -f "${config_path}"
|
||||||
|
@ -4,3 +4,9 @@
|
|||||||
# configuration used for the running kernel.
|
# configuration used for the running kernel.
|
||||||
CONFIG_IKCONFIG=y
|
CONFIG_IKCONFIG=y
|
||||||
CONFIG_IKCONFIG_PROC=y
|
CONFIG_IKCONFIG_PROC=y
|
||||||
|
|
||||||
|
# Enable debugging features for the kernel
|
||||||
|
CONFIG_DEBUG_INFO=y
|
||||||
|
CONFIG_DEBUG_KERNEL=y
|
||||||
|
CONFIG_DEBUG_FS=y
|
||||||
|
CONFIG_DEBUG_INFO_DWARF4=y
|
||||||
|
@ -24,6 +24,7 @@ container_image="${KERNEL_CONTAINER_BUILDER:-$(get_kernel_image_name)}"
|
|||||||
MEASURED_ROOTFS=${MEASURED_ROOTFS:-no}
|
MEASURED_ROOTFS=${MEASURED_ROOTFS:-no}
|
||||||
KBUILD_SIGN_PIN="${KBUILD_SIGN_PIN:-}"
|
KBUILD_SIGN_PIN="${KBUILD_SIGN_PIN:-}"
|
||||||
kernel_builder_args="-a ${ARCH} $*"
|
kernel_builder_args="-a ${ARCH} $*"
|
||||||
|
KERNEL_DEBUG_ENABLED=${KERNEL_DEBUG_ENABLED:-"no"}
|
||||||
|
|
||||||
if [ "${MEASURED_ROOTFS}" == "yes" ]; then
|
if [ "${MEASURED_ROOTFS}" == "yes" ]; then
|
||||||
info "build initramfs for cc kernel"
|
info "build initramfs for cc kernel"
|
||||||
@ -51,6 +52,7 @@ docker pull ${container_image} || \
|
|||||||
|
|
||||||
docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
docker run --rm -i -v "${repo_root_dir}:${repo_root_dir}" \
|
||||||
-w "${PWD}" \
|
-w "${PWD}" \
|
||||||
|
--env KERNEL_DEBUG_ENABLED="${KERNEL_DEBUG_ENABLED}" \
|
||||||
--user "$(id -u)":"$(id -g)" \
|
--user "$(id -u)":"$(id -g)" \
|
||||||
"${container_image}" \
|
"${container_image}" \
|
||||||
bash -c "${kernel_builder} ${kernel_builder_args} setup"
|
bash -c "${kernel_builder} ${kernel_builder_args} setup"
|
||||||
|
Loading…
Reference in New Issue
Block a user