- cdtest takes one lock around release, iso and the VM test; the nested make calls reuse it through BUILD_LOCK_HELD (re-entrant). MAKE_CMD keeps make -n cdtest from executing the recipe: GNU make runs a recipe with $(MAKE) even under -n, and the rest of the line starts a VM. - mcde-linux and mcde-host take the lock too; they read ext/src/mcde and the distfiles a release reads. - build-lock.sh: --held for the tools, --check for read-only callers, pid plus process start time for stale locks, the child is killed on INT/TERM, and nested calls reuse the outer lock. - build-stamp, cd2, cd3, cd-source, images, srctree-stage, userland, mcde-linux and mcde-host refuse to run outside the lock (the file and the message name the way in: make or tools/build-lock.sh).
99 lines
3.7 KiB
Bash
Executable File
99 lines
3.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
|
|
# cd-source.sh -- the source DVD: the one source set, on its own medium.
|
|
#
|
|
# usage: cd-source.sh
|
|
#
|
|
# The install DVD carries the system and the programs; the sources are their
|
|
# own DVD (Konrad, 2026-11-15). It is a data DVD, ISO 9660 with Rock Ridge,
|
|
# made with the build's own makefs (nbmakefs). ISO 9660 stores a file size
|
|
# in 32 bits, and makefs truncated the 5.8 GB set at 4 GB (measured
|
|
# 2026-11-15: the installer's gzip saw a 1.5 GB file and stopped with
|
|
# "unexpected end of file"). The set is therefore split into parts of 2 GiB
|
|
# and sysinst cats them; the layout the installer looks for is
|
|
#
|
|
# source/sets/src.tgz MD5 SHA512 the one set, unpacked to /usr/src
|
|
# README the commands to install it
|
|
#
|
|
# Written to RELEASEDIR/images/Makronix-<version>-amd64-source.iso. Run by
|
|
# `make isosrc' after `make sourcesets'. The set is 5.5 GB (2026-11-15), so
|
|
# the medium is a dual-layer DVD (8.5 GB), not a DVD-5.
|
|
|
|
set -eu
|
|
|
|
TOP=$(cd "$(dirname "$0")/.." && pwd)
|
|
# This tool writes build/obj or releasedir: only inside the build lock.
|
|
if [ -z "${BUILD_LOCK_HELD:-}" ] || [ ! -d "$BUILD_LOCK_HELD" ]; then
|
|
echo "${0##*/}: run this through make or tools/build-lock.sh" >&2
|
|
exit 1
|
|
fi
|
|
|
|
OBJ=$TOP/build/obj
|
|
REL=$OBJ/releasedir
|
|
SETS=$REL/source/sets
|
|
STAGE=$TOP/build/cdsource
|
|
VER=$(cat "$TOP/src/sys/conf/makronix-release")
|
|
|
|
die()
|
|
{
|
|
echo "cd-source: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
MAKEFS=$(ls "$OBJ"/tooldir.*/bin/nbmakefs 2>/dev/null | head -1)
|
|
[ -x "$MAKEFS" ] || die "no nbmakefs in $OBJ/tooldir.*/bin"
|
|
[ -f "$SETS/src.tgz" ] || die "no $SETS/src.tgz (make sourcesets first)"
|
|
[ -f "$SETS/MD5" ] || die "no $SETS/MD5 (make sourcesets first)"
|
|
[ -f "$SETS/SHA512" ] || die "no $SETS/SHA512 (make sourcesets first)"
|
|
|
|
rm -rf "$STAGE"
|
|
mkdir -p "$STAGE/source/sets"
|
|
# ISO 9660 stores a file size in 32 bits: split the set into parts below
|
|
# 2 GiB. sysinst cats them (set_file_exists_p, extract_file_to) and the
|
|
# README says how to do it by hand.
|
|
split -b 2000m "$SETS/src.tgz" "$STAGE/source/sets/src.tgz."
|
|
cp -p "$SETS/MD5" "$SETS/SHA512" "$STAGE/source/sets/"
|
|
if [ -f "$SETS/SHA512.sig" ]; then
|
|
cp -p "$SETS/SHA512.sig" "$STAGE/source/sets/"
|
|
fi
|
|
|
|
cat > "$STAGE/README" <<EOF
|
|
The Makronix source set, version $VER
|
|
=====================================
|
|
|
|
This DVD carries the whole Makronix tree: src/, xsrc/, ext/, pkgsrc/,
|
|
mobile/, www/, docs/, tools/, the root files, the pins and the distfiles of
|
|
the Makronix packages. It unpacks to /usr/src, and a system with it can
|
|
rebuild itself without a network.
|
|
|
|
Install it on a running system, as root. The set is split into parts
|
|
because one ISO 9660 file cannot be larger than 4 GiB; cat them in order:
|
|
|
|
mkdir -p /mnt
|
|
mount -t cd9660 /dev/cd0a /mnt
|
|
cat /mnt/source/sets/src.tgz.* | tar -xzpf - -C /
|
|
umount /mnt
|
|
|
|
The set is root:wsrc; the user that builds is in the wsrc group. Then:
|
|
|
|
cd /usr/src
|
|
export MAKRONIX_TOP=/usr/src
|
|
make release ARCH=amd64
|
|
|
|
Size and hashes: source/sets/MD5, source/sets/SHA512. The SHA512 is signed
|
|
(root key -> release key, signify); check it before you unpack:
|
|
|
|
signify -V -p /etc/signify/makronix-root.pub -m /etc/signify/makronix-0.99.pub -x /etc/signify/makronix-0.99.pub.sig
|
|
signify -V -p /etc/signify/makronix-0.99.pub -m /mnt/source/sets/SHA512 -x /mnt/source/sets/SHA512.sig
|
|
|
|
The install DVD carries the system and the programs, not the sources; this
|
|
DVD is the one that does.
|
|
EOF
|
|
|
|
mkdir -p "$REL/images"
|
|
OUT=$REL/images/Makronix-$VER-amd64-source.iso
|
|
rm -f "$OUT"
|
|
"$MAKEFS" -t cd9660 -o rockridge,label=MAKRONIX_SOURCE,publisher=Makronix \
|
|
"$OUT" "$STAGE"
|
|
echo "cd-source: ${OUT#$TOP/}: $(du -h "$OUT" | cut -f1)"
|