[PATCH v2 4/4] workflows: bootlinux: add clean builds configuration option
Daniel Gomez <[email protected]>
| Newsgroups | dev.linux.lists.kdevops |
|---|---|
| Message-ID | <[email protected]> |
From: Daniel Gomez <[email protected]> Add CONFIG_BOOTLINUX_CLEAN_BEFORE_BUILD option to enable clean builds for both fragment and monolithic configurations via configurable mrproper execution. Changes: - Add CONFIG_BOOTLINUX_CLEAN_BEFORE_BUILD Kconfig option (default: n) - Add global mrproper task in config.yml for non-9P builds - Add mrproper task in 9P build workflow for localhost builds - Conditional execution based on bootlinux_clean_before_build variable This provides deterministic builds when needed while preserving incremental build performance by default. The mrproper task runs before configuration to ensure pristine source state. Features: - Works with both monolithic and fragment configurations - Separate handling for 9P vs target builds - Clear documentation of trade-offs (clean vs incremental builds) - Maintains existing workflow compatibility Generated-by: Claude AI Signed-off-by: Daniel Gomez <[email protected]> --- playbooks/roles/bootlinux/tasks/build/9p.yml | 9 +++++++++ playbooks/roles/bootlinux/tasks/config.yml | 8 ++++++++ workflows/linux/Kconfig | 22 ++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/playbooks/roles/bootlinux/tasks/build/9p.yml b/playbooks/roles/bootlinux/tasks/build/9p.yml index 08512c90..f390f028 100644 --- a/playbooks/roles/bootlinux/tasks/build/9p.yml +++ b/playbooks/roles/bootlinux/tasks/build/9p.yml @@ -109,6 +109,15 @@ $ {{ ansible_callback_diy.result.output.cmd | join(' ') }} {{ ansible_callback_diy.result.output.stdout | default('') }} +- name: Clean kernel source before configuration (make mrproper) on the control node + community.general.make: + chdir: "{{ bootlinux_9p_host_path }}" + target: "mrproper" + when: bootlinux_clean_before_build|default(false)|bool + run_once: true + delegate_to: localhost + tags: ["build-linux"] + - name: Copy configuration for Linux {{ target_linux_tree }} on the control node ansible.builtin.template: src: "{{ linux_config }}" diff --git a/playbooks/roles/bootlinux/tasks/config.yml b/playbooks/roles/bootlinux/tasks/config.yml index c1ecbaed..66442ad2 100644 --- a/playbooks/roles/bootlinux/tasks/config.yml +++ b/playbooks/roles/bootlinux/tasks/config.yml @@ -31,6 +31,14 @@ when: - linux_next_configs.matched > 0 +- name: Clean kernel source before configuration (make mrproper) for non-9P builds + community.general.make: + chdir: "{{ target_linux_dir_path }}" + target: "mrproper" + when: + - bootlinux_clean_before_build|default(false)|bool + - not bootlinux_9p|bool + - name: Set the .config file for building the test kernel ansible.builtin.set_fact: linux_config: "{{ item | basename }}" diff --git a/workflows/linux/Kconfig b/workflows/linux/Kconfig index cae82382..c0534ae4 100644 --- a/workflows/linux/Kconfig +++ b/workflows/linux/Kconfig @@ -188,6 +188,28 @@ config BOOTLINUX_REPRODUCIBLE_BUILDS Recommended for CI/CD environments and when build reproducibility is required. Compatible with both GCC and Clang toolchains. +config BOOTLINUX_CLEAN_BEFORE_BUILD + bool "Clean kernel source before building (make mrproper)" + output yaml + default n + help + If enabled, run 'make mrproper' before kernel configuration and + building. This ensures a completely clean build from pristine + source code by removing all configuration files, build artifacts, + and generated files. + + Enable this for: + - Deterministic, reproducible builds + - Debugging configuration issues + - Ensuring no stale artifacts interfere + + Disable this for: + - Faster incremental builds during development + - Preserving existing .config when not using fragments + + Note: This adds significant build time as all objects must be + rebuilt from scratch. + menu "ccache configuration" config BOOTLINUX_CCACHE -- 2.50.1