Skip to content

build-image: make --rmwork opt-in to speed up local dev rebuilds - #11

Draft
flehoussel wants to merge 5 commits into
aa-proxy:mainfrom
flehoussel:build-image-rework
Draft

build-image: make --rmwork opt-in to speed up local dev rebuilds#11
flehoussel wants to merge 5 commits into
aa-proxy:mainfrom
flehoussel:build-image-rework

Conversation

@flehoussel

@flehoussel flehoussel commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

No change in CI behavior: the workflow now passes --rmwork explicitly,
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, so build-image.sh
can be re-run on the same board without rebuilding every package from
scratch.

Also, --shell now enters a shell in an already-initialized board
environment (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.sh
derives its working paths from its own script location, but the
Dockerfile copied it to /build-image.sh while 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-install
    cleanup behind RM_WORK=y, and preserve .stamp_*, .files-list*
    and .applied_patches_list instead of wiping the whole build directory.
  • build-image.sh: take the board as a positional argument, validate
    that its defconfig exists before merging (listing available boards on
    failure), and add -s/--shell and -r/--rmwork flags. --shell now
    drops into a shell after the board environment is initialized instead
    of skipping setup entirely; --rmwork persists RM_WORK=y in
    local.mk.
  • Dockerfile: copy build-image.sh to /app/build-image.sh (instead
    of container root) so it resolves the same base directory as
    interactive use via docker-dev.sh.
  • .github/workflows/build.yml: pass --rmwork to keep the CI runner's
    disk usage unchanged.
  • README.md: document the new options.

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
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
flehoussel marked this pull request as ready for review August 7, 2026 15:51
@flehoussel
flehoussel marked this pull request as draft August 7, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant