make: the kernel is built by 'make' and installed by 'make install'

installworld puts no kernel on the system.  build now ends with build.sh kernel=$(KERNEL), install
runs tools/kernel-install.sh on the result: /netbsd with /netbsd.old kept, and the same on
/cgdboot of an encrypted installation, as mxupgrade(8) does.  No restart.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
lotherkandClaude Sonnet 5.5 committed 2026-11-24 11:36:55 +00:00
1 parent beab1997a6
commit a09daa2093
2 files changed
+40 -2

No files matched your search

+2 -2
View File
@@ -74,7 +74,7 @@ stamp:
# `make all install' on a running Makronix is the whole update (Konrad,
# 2026-11-24); `release' adds the kernels' media on top of the same two steps.
build:
@tools/build-lock.sh 'tools/build-stamp.sh && tools/userland.sh && $(BUILD_SH) distribution'
@tools/build-lock.sh 'tools/build-stamp.sh && tools/userland.sh && $(BUILD_SH) distribution && $(BUILD_SH) kernel=$(KERNEL)'
# A release is everything: the packages of the makronix set (tools/userland.sh
# fills destdir/usr/pkg and src/distrib/sets/lists/makronix/mi -- without it
@@ -196,7 +196,7 @@ install:
echo "make install: which only makes sense on Makronix/NetBSD."; \
echo "make install: on $$(uname -s), build with 'make' instead."; \
exit 1; }
@tools/build-lock.sh '$(BUILD_SH) install=/'
@tools/build-lock.sh '$(BUILD_SH) install=/ && $(TOP)/tools/kernel-install.sh $(OBJ)/sys/arch/$(MACHINE)/compile/$(KERNEL)/netbsd'
tools:
@tools/build-lock.sh '$(BUILD_SH) tools'
+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh
# $Makronix$
# License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree.
#
# kernel-install.sh -- put a built kernel where the running system boots from
#
# usage: tools/kernel-install.sh <path to the built netbsd>
#
# `make install' (installworld) installs the sets and no kernel. This is the
# kernel half of it, the way src/BUILDING and mxupgrade(8) do it: the old
# kernel stays as /netbsd.old, and on an encrypted installation (/cgdboot in
# fstab) the boot loader starts the kernel from that small partition, so the
# same copy goes there with netbsd.old kept (mxupgrade.sh does the same
# after sysupgrade). The system is not restarted.
#
# POSIX sh.
set -eu
k=${1:?usage: kernel-install.sh <path to the built netbsd>}
CGDBOOT=${MXUPGRADE_CGDBOOT:-/cgdboot}
[ -f "$k" ] || { echo "kernel-install: $k is not a file" >&2; exit 1; }
[ "$(uname -s)" = NetBSD ] || { echo "kernel-install: NetBSD only" >&2; exit 1; }
echo "kernel-install: $k -> /netbsd (old one: /netbsd.old)"
[ ! -f /netbsd ] || cp -p /netbsd /netbsd.old
cp -p "$k" /netbsd.new
mv -f /netbsd.new /netbsd
if grep -q "[[:space:]]$CGDBOOT[[:space:]]" /etc/fstab 2>/dev/null; then
echo "kernel-install: boot partition $CGDBOOT"
mount "$CGDBOOT"
[ ! -f "$CGDBOOT/netbsd" ] || cp -p "$CGDBOOT/netbsd" "$CGDBOOT/netbsd.old"
cp -p /netbsd "$CGDBOOT/netbsd"
umount "$CGDBOOT"
fi
echo "kernel-install: done; reboot to run it (shutdown -r now)"