build-image: make --rmwork opt-in to speed up local dev rebuilds - #11
Draft
flehoussel wants to merge 5 commits into
Draft
build-image: make --rmwork opt-in to speed up local dev rebuilds#11flehoussel wants to merge 5 commits into
flehoussel wants to merge 5 commits into
Conversation
Add support to the RM_WORK option in Buildroot, enabling cleanup of package build directories after installation while preserving necessary stamp and tracking files.
The old positional shell argument only entered a bash shell and couldn't be combined with building a specific board. Take the board as the first argument instead, validate that its defconfig exists before merging and expose the previous shell behavior as -s/--shell so it can be combined with a board. Add -r/--rmwork to persist RM_WORK=y in local.mk, wiring up the conditional build-directory cleanup added to the buildroot patch.
Keeps package build directories from piling up and running the CI runner out of disk space.
flehoussel
marked this pull request as draft
August 7, 2026 14:25
build-image.sh derives PROJECT_DIR from its own script location to find external/configs and buildroot. With the script copied to /build-image.sh, that resolved to / instead of /app (where docker-dev.sh mounts the repo), so the board config lookup always failed inside the container. Copying it to /app/build-image.sh makes it resolve the same path as interactive use.
flehoussel
marked this pull request as ready for review
August 7, 2026 15:51
flehoussel
marked this pull request as draft
August 7, 2026 17:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
No change in CI behavior: the workflow now passes
--rmworkexplicitly,so build directories are still cleaned up after each build exactly as
before.
For local development, cleanup is now opt-in instead of automatic.
Without
--rmwork, package build directories are kept, sobuild-image.shcan be re-run on the same board without rebuilding every package from
scratch.
Also,
--shellnow enters a shell in an already-initialized boardenvironment (defconfig merged, patches applied, buildroot configured),
instead of just opening a bare bash shell before any setup ran.
The board argument is now validated (its defconfig must exist) before
the defconfig merge runs, so an invalid board name fails fast with the
list of available boards instead of merging first and failing later.
Fixes a container-only bug introduced by this rework:
build-image.shderives its working paths from its own script location, but the
Dockerfile copied it to
/build-image.shwhile the repo is mounted at/app, so board config lookups always failed inside the container.The script is now placed at
/app/build-image.sh.Changes
br-patches/0006-remove-after-install.patch: gate the post-installcleanup behind
RM_WORK=y, and preserve.stamp_*,.files-list*and
.applied_patches_listinstead of wiping the whole build directory.build-image.sh: take the board as a positional argument, validatethat its defconfig exists before merging (listing available boards on
failure), and add
-s/--shelland-r/--rmworkflags.--shellnowdrops into a shell after the board environment is initialized instead
of skipping setup entirely;
--rmworkpersistsRM_WORK=yinlocal.mk.Dockerfile: copybuild-image.shto/app/build-image.sh(insteadof container root) so it resolves the same base directory as
interactive use via
docker-dev.sh..github/workflows/build.yml: pass--rmworkto keep the CI runner'sdisk usage unchanged.
README.md: document the new options.