mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-12 20:39:30 +00:00
static-build: cross build kernel
Prepare cross build environment based on current Dockerfile. Fixes: #6557 Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
This commit is contained in:
committed by
Fabiano Fidêncio
parent
e2c31fce23
commit
7923de8999
@@ -65,6 +65,8 @@ kernel_url=""
|
||||
#Linux headers for GPU guest fs module building
|
||||
linux_headers=""
|
||||
|
||||
CROSS_BUILD_ARG=""
|
||||
|
||||
MEASURED_ROOTFS=${MEASURED_ROOTFS:-no}
|
||||
|
||||
packaging_scripts_dir="${script_dir}/../scripts"
|
||||
@@ -436,7 +438,7 @@ setup_kernel() {
|
||||
|
||||
info "Copying config file from: ${kernel_config_path}"
|
||||
cp "${kernel_config_path}" ./.config
|
||||
make oldconfig
|
||||
ARCH=${arch_target} make oldconfig ${CROSS_BUILD_ARG}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -447,7 +449,7 @@ build_kernel() {
|
||||
[ -n "${arch_target}" ] || arch_target="$(uname -m)"
|
||||
arch_target=$(arch_to_kernel "${arch_target}")
|
||||
pushd "${kernel_path}" >>/dev/null
|
||||
make -j $(nproc ${CI:+--ignore 1}) ARCH="${arch_target}"
|
||||
make -j $(nproc ${CI:+--ignore 1}) ARCH="${arch_target}" ${CROSS_BUILD_ARG}
|
||||
if [ "${conf_guest}" == "sev" ]; then
|
||||
make -j $(nproc ${CI:+--ignore 1}) INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=${kernel_path} modules_install
|
||||
fi
|
||||
@@ -658,6 +660,8 @@ main() {
|
||||
|
||||
info "Kernel version: ${kernel_version}"
|
||||
|
||||
[ "${arch_target}" != "" -a "${arch_target}" != $(uname -m) ] && CROSS_BUILD_ARG="CROSS_COMPILE=${arch_target}-linux-gnu-"
|
||||
|
||||
case "${subcmd}" in
|
||||
build)
|
||||
build_kernel "${kernel_path}"
|
||||
|
Reference in New Issue
Block a user