Skip to content

Commit a8c2926

Browse files
committed
workflows: bootlinux: add clean builds configuration option
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]>
1 parent 1ba6341 commit a8c2926

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

playbooks/roles/bootlinux/tasks/build/9p.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@
109109
$ {{ ansible_callback_diy.result.output.cmd | join(' ') }}
110110
{{ ansible_callback_diy.result.output.stdout | default('') }}
111111
112+
- name: Clean kernel source before configuration (make mrproper) on the control node
113+
community.general.make:
114+
chdir: "{{ bootlinux_9p_host_path }}"
115+
target: "mrproper"
116+
when: bootlinux_clean_before_build|default(false)|bool
117+
run_once: true
118+
delegate_to: localhost
119+
tags: ["build-linux"]
120+
112121
- name: Copy configuration for Linux {{ target_linux_tree }} on the control node
113122
ansible.builtin.template:
114123
src: "{{ linux_config }}"

playbooks/roles/bootlinux/tasks/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
when:
3232
- linux_next_configs.matched > 0
3333

34+
- name: Clean kernel source before configuration (make mrproper) for non-9P builds
35+
community.general.make:
36+
chdir: "{{ target_linux_dir_path }}"
37+
target: "mrproper"
38+
when:
39+
- bootlinux_clean_before_build|default(false)|bool
40+
- not bootlinux_9p|bool
41+
3442
- name: Set the .config file for building the test kernel
3543
ansible.builtin.set_fact:
3644
linux_config: "{{ item | basename }}"

workflows/linux/Kconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,28 @@ config BOOTLINUX_REPRODUCIBLE_BUILDS
188188
Recommended for CI/CD environments and when build reproducibility
189189
is required. Compatible with both GCC and Clang toolchains.
190190

191+
config BOOTLINUX_CLEAN_BEFORE_BUILD
192+
bool "Clean kernel source before building (make mrproper)"
193+
output yaml
194+
default n
195+
help
196+
If enabled, run 'make mrproper' before kernel configuration and
197+
building. This ensures a completely clean build from pristine
198+
source code by removing all configuration files, build artifacts,
199+
and generated files.
200+
201+
Enable this for:
202+
- Deterministic, reproducible builds
203+
- Debugging configuration issues
204+
- Ensuring no stale artifacts interfere
205+
206+
Disable this for:
207+
- Faster incremental builds during development
208+
- Preserving existing .config when not using fragments
209+
210+
Note: This adds significant build time as all objects must be
211+
rebuilt from scratch.
212+
191213
menu "ccache configuration"
192214

193215
config BOOTLINUX_CCACHE

0 commit comments

Comments
 (0)