build.sh: fail early on a kernel set without kernel.bin
U-Boot boots boot/kernel/kernel.bin, and the gateway's 20-kernel-update skips a kernel set without one, leaving the old kernel in place. FreeBSD 15 builds it only with WITH_KERNEL_BIN, which the 26.7.9 image build was the first to notice; check the kernel set right after it is built. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8716b582b3
commit
a72fc09862
3 changed files with 68 additions and 2 deletions
12
RELEASE.md
12
RELEASE.md
|
|
@ -212,7 +212,10 @@ release/vm.sh pull-out 15.1 26.7 # -> /scratch/mono-opnsense/out/26.7
|
|||
2. Applies `patches/<series>/*.patch` to core with `git am`. Core's version
|
||||
becomes `<release>_<patches>`.
|
||||
3. Builds base and kernel, then this repository's kernel modules, as an
|
||||
early check against the new kernel.
|
||||
early check against the new kernel. The kernel set must contain
|
||||
`boot/kernel/kernel.bin`, the image U-Boot boots: the eMMC image needs
|
||||
it, and on the gateway `20-kernel-update` skips a kernel set without
|
||||
one, so the old kernel would go on booting.
|
||||
4. Builds the ports in one tools ports step over the whole list, tools'
|
||||
`ports.conf`. Tools caches the build-only dependencies it builds (cmake,
|
||||
autoconf, the Rust and Go compilers) for the rest of a step only, and the
|
||||
|
|
@ -585,7 +588,12 @@ pgrep -l cmm || echo cmm-stopped
|
|||
`socdev_va` itself and dropped `hcr_el2`), the moved `dev/clk/clk.h`, and
|
||||
`cpu_dcache_wbinv_range()` now taking a pointer. To find every compile
|
||||
error in one pass rather than one per build, run tools' `buildkernel`
|
||||
by hand in the VM with `make -k ... KERNFAST=1` after a failure.
|
||||
by hand in the VM with `make -k ... KERNFAST=1` after a failure. A third
|
||||
commit sets `makeoptions WITH_KERNEL_BIN=t`: FreeBSD 15 builds
|
||||
`kernel.bin` only when asked, and the 26.7.9 image build was the first
|
||||
to notice. To rebuild just the kernel set after such a change, remove
|
||||
it from the VM's `sets/` and run tools' `kernel` step, then `sign`
|
||||
again.
|
||||
2. **Core patches:** write `patches/26.7/` against core 26.7.x. For 26.7.9:
|
||||
- the CMM restart moved from `interfaces_assign.php`, which 26.7 no
|
||||
longer has, to the MVC assignment API
|
||||
|
|
|
|||
|
|
@ -175,6 +175,15 @@ host_pkg()
|
|||
fi
|
||||
}
|
||||
|
||||
# check_kernel_bin SET: U-Boot boots boot/kernel/kernel.bin, and the gateway's
|
||||
# 20-kernel-update skips a kernel set without it, leaving the old kernel booting.
|
||||
# FreeBSD 15 builds it only with WITH_KERNEL_BIN in the kernel config.
|
||||
check_kernel_bin()
|
||||
{
|
||||
tar -tf "${1}" ./boot/kernel/kernel.bin > /dev/null 2>&1 ||
|
||||
die "$(basename "${1}") has no boot/kernel/kernel.bin (makeoptions WITH_KERNEL_BIN=t in the kernel config)"
|
||||
}
|
||||
|
||||
# build_ports: tools' ports step, over the whole ports list in one run. Tools caches
|
||||
# the build-only dependencies it builds (cmake, autoconf, the Rust and Go compilers)
|
||||
# for the rest of a run only, and keeps just the listed ports and their runtime
|
||||
|
|
@ -447,6 +456,7 @@ build()
|
|||
step "base kernel"
|
||||
# shellcheck disable=SC2086
|
||||
${TOOLS} ${UNSIGNED} base kernel
|
||||
check_kernel_bin "${SETS}/kernel-${VERSION}-aarch64-GATEWAY.txz"
|
||||
sysroot_base
|
||||
step "mono-gateway kernel modules (early check against the new kernel)"
|
||||
make -C "${DEPS}" -j"$(sysctl -n hw.ncpu)" modules OPS_SETTINGS="${SERIES}"
|
||||
|
|
|
|||
|
|
@ -1074,6 +1074,54 @@ class ExitTrapTest(unittest.TestCase):
|
|||
self.assertIn("build.sh build SERIES VERSION", r.stderr)
|
||||
|
||||
|
||||
class CheckKernelBinTest(unittest.TestCase):
|
||||
"""build.sh's check_kernel_bin: the kernel set must have the kernel U-Boot boots."""
|
||||
|
||||
def setUp(self):
|
||||
self.tmp = tempfile.mkdtemp(prefix="gw-kbin-")
|
||||
self.addCleanup(shutil.rmtree, self.tmp)
|
||||
self.func = build_function("die") + build_function("check_kernel_bin")
|
||||
|
||||
def kernel_set(self, *members):
|
||||
src = os.path.join(self.tmp, "src")
|
||||
for m in members:
|
||||
os.makedirs(os.path.join(src, os.path.dirname(m)), exist_ok=True)
|
||||
with open(os.path.join(src, m), "w") as f:
|
||||
f.write("x")
|
||||
path = os.path.join(self.tmp, "kernel-26.7.9-aarch64-GATEWAY.txz")
|
||||
subprocess.run(["tar", "-C", src, "-cJf", path, "."], check=True)
|
||||
return path
|
||||
|
||||
def check(self, path):
|
||||
return subprocess.run(["sh", "-c", "set -eu\n" + self.func + '\ncheck_kernel_bin "$1"', "sh", path],
|
||||
capture_output=True, text=True)
|
||||
|
||||
def test_with_kernel_bin(self):
|
||||
r = self.check(self.kernel_set("boot/kernel/kernel", "boot/kernel/kernel.bin"))
|
||||
self.assertEqual(r.returncode, 0, r.stderr)
|
||||
|
||||
def test_without_kernel_bin(self):
|
||||
r = self.check(self.kernel_set("boot/kernel/kernel", "boot/kernel/if_dpaa.ko"))
|
||||
self.assertNotEqual(r.returncode, 0)
|
||||
self.assertIn("kernel-26.7.9-aarch64-GATEWAY.txz has no boot/kernel/kernel.bin", r.stderr)
|
||||
self.assertIn("WITH_KERNEL_BIN", r.stderr)
|
||||
|
||||
def test_kernel_bin_elsewhere(self):
|
||||
r = self.check(self.kernel_set("boot/kernel/kernel", "boot/kernel.old/kernel.bin", "kernel.bin"))
|
||||
self.assertNotEqual(r.returncode, 0)
|
||||
|
||||
def test_missing_set(self):
|
||||
r = self.check(os.path.join(self.tmp, "nonexistent.txz"))
|
||||
self.assertNotEqual(r.returncode, 0)
|
||||
self.assertIn("has no boot/kernel/kernel.bin", r.stderr)
|
||||
|
||||
def test_corrupt_set(self):
|
||||
path = os.path.join(self.tmp, "kernel-26.7.9-aarch64-GATEWAY.txz")
|
||||
with open(path, "wb") as f:
|
||||
f.write(b"not a tar")
|
||||
self.assertNotEqual(self.check(path).returncode, 0)
|
||||
|
||||
|
||||
class SignAuxRepoTest(unittest.TestCase):
|
||||
"""build.sh's sign_aux_repo: the aux set's catalogue signed with KEYDIR's key."""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue