public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Daniel Gomez <da.gomez@kernel.org>
To: Luis Chamberlain <mcgrof@kernel.org>,
	 Chuck Lever <chuck.lever@oracle.com>
Cc: kdevops@lists.linux.dev, Daniel Gomez <da.gomez@samsung.com>
Subject: [PATCH v2 4/4] workflows: bootlinux: add clean builds configuration option
Date: Fri, 19 Sep 2025 14:25:10 +0200	[thread overview]
Message-ID: <20250919-kernel-fragment-support-v2-4-8d2b7b8cb4e4@samsung.com> (raw)
In-Reply-To: <20250919-kernel-fragment-support-v2-0-8d2b7b8cb4e4@samsung.com>

From: Daniel Gomez <da.gomez@samsung.com>

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 <da.gomez@samsung.com>
---
 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


  parent reply	other threads:[~2025-09-19 12:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 12:25 [PATCH v2 0/4] workflows: bootlinux: enhance kernel configuration fragment support Daniel Gomez
2025-09-19 12:25 ` [PATCH v2 1/4] workflows: bootlinux: add reproducible builds support Daniel Gomez
2025-09-19 12:25 ` [PATCH v2 2/4] workflows: bootlinux: add comprehensive ccache support Daniel Gomez
2025-09-19 12:25 ` [PATCH v2 3/4] workflows: bootlinux: add kernel configuration fragments support Daniel Gomez
2025-09-19 12:25 ` Daniel Gomez [this message]
2025-09-19 18:10 ` [PATCH v2 0/4] workflows: bootlinux: enhance kernel configuration fragment support Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250919-kernel-fragment-support-v2-4-8d2b7b8cb4e4@samsung.com \
    --to=da.gomez@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=da.gomez@samsung.com \
    --cc=kdevops@lists.linux.dev \
    --cc=mcgrof@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox