From 571997b05369d4544b4f3b1c2e292638e6044017 Mon Sep 17 00:00:00 2001 From: Gunjan Gupta Date: Fri, 6 Oct 2023 00:35:48 +0530 Subject: [PATCH] cli: add command to rewrite/refresh kernel configs --- lib/functions/artifacts/artifact-kernel.sh | 2 +- lib/functions/cli/commands.sh | 2 ++ lib/functions/compilation/kernel-config.sh | 8 +++++--- lib/functions/compilation/kernel.sh | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/functions/artifacts/artifact-kernel.sh b/lib/functions/artifacts/artifact-kernel.sh index 41fc8b6ee..76b78ab0a 100644 --- a/lib/functions/artifacts/artifact-kernel.sh +++ b/lib/functions/artifacts/artifact-kernel.sh @@ -244,7 +244,7 @@ function artifact_kernel_cli_adapter_pre_run() { function artifact_kernel_cli_adapter_config_prep() { # Sanity check / cattle guard # If KERNEL_CONFIGURE=yes, or CREATE_PATCHES=yes, user must have used the correct CLI commands, and only add those params. - if [[ "${KERNEL_CONFIGURE}" == "yes" && "${ARMBIAN_COMMAND}" != "kernel-config" ]]; then + if [[ "${KERNEL_CONFIGURE}" == "yes" && "${ARMBIAN_COMMAND}" != *kernel-config ]]; then exit_with_error "KERNEL_CONFIGURE=yes is not supported anymore. Please use the new 'kernel-config' CLI command. Current command: '${ARMBIAN_COMMAND}'" fi diff --git a/lib/functions/cli/commands.sh b/lib/functions/cli/commands.sh index 782f47a4e..8de1123be 100644 --- a/lib/functions/cli/commands.sh +++ b/lib/functions/cli/commands.sh @@ -59,6 +59,7 @@ function armbian_register_commands() { ["kernel"]="artifact" ["kernel-patch"]="artifact" ["kernel-config"]="artifact" + ["rewrite-kernel-config"]="artifact" ["uboot"]="artifact" ["uboot-patch"]="artifact" @@ -110,6 +111,7 @@ function armbian_register_commands() { ["kernel"]="WHAT='kernel' ${common_cli_artifact_vars}" ["kernel-config"]="WHAT='kernel' KERNEL_CONFIGURE='yes' ${common_cli_artifact_interactive_vars} ${common_cli_artifact_vars}" + ["rewrite-kernel-config"]="WHAT='kernel' KERNEL_CONFIGURE='yes' ARTIFACT_WILL_NOT_BUILD='yes' ARTIFACT_IGNORE_CACHE='yes' ${common_cli_artifact_vars}" ["kernel-patch"]="WHAT='kernel' CREATE_PATCHES='yes' ${common_cli_artifact_interactive_vars} ${common_cli_artifact_vars}" ["uboot"]="WHAT='uboot' ${common_cli_artifact_vars}" diff --git a/lib/functions/compilation/kernel-config.sh b/lib/functions/compilation/kernel-config.sh index a606a7c76..6b5ff3795 100644 --- a/lib/functions/compilation/kernel-config.sh +++ b/lib/functions/compilation/kernel-config.sh @@ -33,9 +33,11 @@ function kernel_config() { LOG_SECTION="kernel_config_initialize" do_with_logging do_with_hooks kernel_config_initialize if [[ "${KERNEL_CONFIGURE}" == "yes" ]]; then - # This piece is interactive, no logging - display_alert "Starting (interactive) kernel ${KERNEL_MENUCONFIG:-menuconfig}" "${LINUXCONFIG}" "debug" - run_kernel_make_dialog "${KERNEL_MENUCONFIG:-menuconfig}" + if [[ "${ARMBIAN_COMMAND}" == "kernel-config" ]]; then + # This piece is interactive, no logging + display_alert "Starting (interactive) kernel ${KERNEL_MENUCONFIG:-menuconfig}" "${LINUXCONFIG}" "debug" + run_kernel_make_dialog "${KERNEL_MENUCONFIG:-menuconfig}" + fi # Export, but log about it too. LOG_SECTION="kernel_config_export" do_with_logging do_with_hooks kernel_config_export diff --git a/lib/functions/compilation/kernel.sh b/lib/functions/compilation/kernel.sh index db7cee500..4bb5be227 100644 --- a/lib/functions/compilation/kernel.sh +++ b/lib/functions/compilation/kernel.sh @@ -77,7 +77,7 @@ function compile_kernel() { # Stop after configuring kernel, but only if using a specific CLI command ("kernel-config"). # Normal "KERNEL_CONFIGURE=yes" (during image build) is still allowed. - if [[ "${KERNEL_CONFIGURE}" == yes && "${ARMBIAN_COMMAND}" == "kernel-config" ]]; then + if [[ "${KERNEL_CONFIGURE}" == yes && "${ARMBIAN_COMMAND}" == *kernel-config ]]; then display_alert "Stopping after configuring kernel" "" "cachehit" return 0 fi