make usb: remove the image's work files before and after the build; keep one image backup

The install image left about 34 GB of work files in build/obj/distrib/amd64/
installimage (work/, work.rootfs, imgroot.fs, work.img), and a killed run
left install(1)'s temporary copy in RELEASEDIR/images (6.3 GB,
Makronix-0.99.11-amd64-install.img.inst.f7YyCj).  The root disk was at 99%
(15 GB free) while make usb still had 20 GB to write.

make usb now runs NetBSD's clean target of Makefile.bootimage before and
after install-image and removes *.img.inst.* first.  keep-images.sh keeps
one build/keep-* by default instead of two (each holds 10-20 GB).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lotherkandClaude Opus 5.5 committed 2026-11-18 19:31:40 +00:00
1 parent b2a65a76df
commit 118b19a171
3 files changed
+16 -4

No files matched your search

+13 -1
View File
@@ -99,6 +99,15 @@ iso:
# install-image runs no `make obj': without its object directory nbmake builds
# in src/distrib/<arch>/installimage, and those untracked files changed the
# build stamp ("sources changed", 2026-11-18). The directory is made here.
# The work files of the image (work/, work.rootfs, imgroot.fs, work.img and the
# image itself, about 34 GB) are removed with NetBSD's own `clean' target of
# distrib/common/bootimage/Makefile.bootimage (CLEANFILES, WORKDIR) before the
# build, so a killed run leaves nothing behind, and after it, once install(1)
# has copied the image to RELEASEDIR/images. The temporary files install(1)
# leaves there when it is killed (`*.img.inst.XXXXXX', 6.3 GB on 2026-11-18)
# go too. Konrad, 2026-11-18: "verhinder das so ne scheisse uebrig bleibt".
INSTIMG_CLEAN = (cd $(SRC)/distrib/$(MACHINE)/installimage && \
$(OBJ)/tooldir.*/bin/nbmake-$(MACHINE) clean >/dev/null)
usb:
@tools/build-lock.sh 'if ! tools/build-stamp.sh -c; then exit 1; fi; \
if [ ! -d $(OBJ)/releasedir/source/sets ]; then \
@@ -106,8 +115,11 @@ usb:
echo "make usb: run make sourcesets after make release so the stick carries /source." >&2; \
exit 1; \
fi; \
rm -f $(OBJ)/releasedir/images/*.img.inst.*; \
mkdir -p $(OBJ)/distrib/$(MACHINE)/installimage; \
$(BUILD_SH) -V INSTIMG_RAW=yes -V INSTIMG_BIOS=no install-image'
$(INSTIMG_CLEAN) && \
$(BUILD_SH) -V INSTIMG_RAW=yes -V INSTIMG_BIOS=no install-image && \
$(INSTIMG_CLEAN)'
# pack the install images for a download (tools/images.sh): nothing is
# compressed by the other steps
+1 -1
View File
@@ -57,7 +57,7 @@ Build and release (called by `make`):
`ext/src/mcde/pkgsrc/PLIST`.
- `keep-images.sh [-n N] NAME` -- copies the install images to `build/keep-NAME/` before the
next `make release` removes the release directory; keeps NAME and the newest N
(by time, default 2) `build/keep-*`, removes the older ones.
(by time, default 1: one 10 GB medium is enough) `build/keep-*`, removes the older ones.
- `pkg-binaries.sh` -- fetch the NetBSD project's binary packages.
- `images.sh` -- `unpack|pack|sums` of the install images (`make usb`,
`make compress`); images stay raw unless packing is asked for.
+2 -2
View File
@@ -15,10 +15,10 @@
set -eu
TOP=$(cd "$(dirname "$0")/.." && pwd)
N=2
N=1
while [ $# -gt 0 ]; do
case "$1" in
-n) shift; N=${1:-2}; shift ;;
-n) shift; N=${1:-1}; shift ;;
*) break ;;
esac
done