From c53a630c19fee4e25e8bfcb968c1f2d1693b4bd4 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 18 Jul 2023 15:12:04 +0200 Subject: [PATCH] scripts/kernel-test: add KERNEL_SKIP_REBUILD Speed up local test cycles by not building the kernel again from source if not needed. Change-Id: Iaa401918d7c09ec92ec546071d8961e99a4cbb47 --- README.md | 2 ++ jenkins-common.sh | 1 + scripts/kernel-test/kernel-build.sh | 13 +++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0e59fe3d..7a7c1aba 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,8 @@ Environment variables: repositories in the same local linux clone, default: net-next) * `KERNEL_URL`: git remote url (default: net-next.git on kernel.org) * `KERNEL_BRANCH` branch to checkout (default: master) +* `KERNEL_SKIP_REBUILD`: set to 1 to not build the kernel again if already + built with `KERNEL_BUILD=1` The OBS repository mirror consists of `${OSMOCOM_REPO_MIRROR}/${OSMOCOM_REPO_PATH}/${OSMOCOM_REPO_VERSION}`, diff --git a/jenkins-common.sh b/jenkins-common.sh index 20c1c4e7..56c06fc4 100644 --- a/jenkins-common.sh +++ b/jenkins-common.sh @@ -451,6 +451,7 @@ kernel_test_prepare() { -e "KERNEL_CONFIG_BASE=$kernel_config_base" \ -e "KERNEL_REMOTE_NAME=$KERNEL_REMOTE_NAME" \ -e "KERNEL_URL=$KERNEL_URL" \ + -e "KERNEL_SKIP_REBUILD=$KERNEL_SKIP_REBUILD" \ "$@" \ "$docker_image" \ "/kernel-test/prepare.sh" diff --git a/scripts/kernel-test/kernel-build.sh b/scripts/kernel-test/kernel-build.sh index 5f246ae1..d2127e4c 100755 --- a/scripts/kernel-test/kernel-build.sh +++ b/scripts/kernel-test/kernel-build.sh @@ -61,8 +61,13 @@ update_kernel_config() { cp .config "$previous" } -prepare_git_repo -update_kernel_config +output="$KERNEL_DIR"/arch/x86/boot/bzImage -make "-j$(nproc)" -cp arch/x86/boot/bzImage /cache/kernel-test/linux +if [ ! -e "$output" ] || [ "$KERNEL_SKIP_REBUILD" != 1 ]; then + prepare_git_repo + update_kernel_config + + make "-j$(nproc)" +fi + +cp "$output" /cache/kernel-test/linux