From nobody Mon Oct 19 07:36:59 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j7S6m6qjWz6w0yR for ; Mon, 19 Oct 2026 07:37:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4j7S6m4nrtz4QYC for ; Mon, 19 Oct 2026 07:37:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792395424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D57TUrSnQgSVyM5xivhJ16BUsXwhC3GdgqvIjn6d3a8=; b=JjfEFyj18JNXw7JqguMW9jc4NprmqI9MgFwVDuUtzzXX0MchTUcHuuTIchCnGvnr4l480z Lcug5nNq2iv0HPuPLSqywUyGCSJo1y2vvvzo/U2+lDFTZ4i9f31Zegy/6l+FDw+So+HVZ4 uf7Etyzz7KTBoo3RDXCIuwOYDK5HHCAlcyxjqLkl36Lm+T4TJFlDNSO/GRsxYq+2G2y6IY GB/yp3zAdTSZ7f7+oq44DomXNznyAwdgMSM2hJ840+GYwXU5dejEeFwkQYGis0gCQWj5iC UZlwpuCtZPqgqsuXAB2gFMZP4WFs/sT3HCrUx2bTqaA4CY+fo3ddgZFV7NMJJA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792395424; b=OfaPOMMc4+yxMmvUdgNlw9Y1dl2rXRfmgabuBJShfmYrmV38loIO1tUlB1UrFb6G7ClVPo oHkVR7tXc2m2CV4PSMWlwdz5Bcp/sqUZbpvEmb6NARsvjHgpJZ+8dEO+ZfjmQ/jyaKN9g6 UdIBCMXNztz4glaqk/HtdXQDVBHW1Kx7oBdfenWLxiromavdI+cQC5VeC4tv92+b+1QYYr dndiYafrjg6lGfKwQiX49bCQx5mo8fdWfAYkFPwaiGUbPEF8thFnQ5J83GLqLhejDOt4iv FsIVfS7nRsXzAKkC9Fo7UMcX5lEDCVdORsNog3jiqz6m13NUSKziJwTRVkC5+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792395424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=D57TUrSnQgSVyM5xivhJ16BUsXwhC3GdgqvIjn6d3a8=; b=ylSczu7p+tjZqeLY/VNxihD2HCN3tufF2BPZYmduRLarsr15Pz4vD80teWig0T7GM7ZGov X1hlJLvjJ6xYussw5DECkfRhWdQn8TxegVKBhKBgJg6Smru9OC8oiIorKOiPdswIziiPXl yr359gWxyYhP73SF56XnWCigT74zsU3zOTjHa2ysHKGrALPtzKKnBe0t4HaKVInuJVY29y tiqFlHOkgICesLOQlmx3xBanMfxIw31eHEHcX4NhKNMuHWR+6zZrpBmL+FhsJefgQ0Yb3O tZRco1dwxbbmRl0N9d73uHJptWuCS26rpQLofy52ro6FvfLPivBVjFR1EUo+HQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j7S6m4SK6z1QKc for ; Mon, 19 Oct 2026 07:37:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 39b69 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 19 Oct 2026 07:36:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 041802b362aa - main - Add loongarch64 as an optional boot-test.sh arch List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 041802b362aab8786419618ead6e50c389eb875a Auto-Submitted: auto-generated Date: Mon, 19 Oct 2026 07:36:59 +0000 Message-Id: <6ad5c89b.39b69.1100abbd@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=041802b362aab8786419618ead6e50c389eb875a commit 041802b362aab8786419618ead6e50c389eb875a Author: Warner Losh AuthorDate: 2026-10-19 07:03:19 +0000 Commit: Warner Losh CommitDate: 2026-10-19 07:03:19 +0000 Add loongarch64 as an optional boot-test.sh arch D59889 brings up a FreeBSD/loongarch64 EFI loader, none of it in this tree yet. Add a disabled config entry (excluded from -A, usable via -a once the port lands) using the confirmed QEMU virt/la464 recipe; hw/loongarch/virt.c defaults to virtio-blk/net, so the existing generic EFI+GPT builder needs no arch-specific QEMU code. loongarch64 has never had a FreeBSD release, so install_minimal_userland's ISO extraction can never find one. Split it into ISO and installworld-cross-build paths, selected by a new no_release capability, so archs without a release can still get a minimal userland. Differential Revision: https://reviews.freebsd.org/D59923 --- tools/boot/boot-test.json | 12 +++++++ tools/boot/boot-test.sh | 85 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 78 insertions(+), 19 deletions(-) diff --git a/tools/boot/boot-test.json b/tools/boot/boot-test.json index 91beb64e44e6..886b6167e9b9 100644 --- a/tools/boot/boot-test.json +++ b/tools/boot/boot-test.json @@ -92,6 +92,18 @@ "target_arch": "powerpc64le", "kernconf": "GENERIC64LE", "timeout": 180 + }, + "loongarch64": { + "qemu_bin": "qemu-system-loongarch64", + "qemu_machine": "-machine virt", + "qemu_extra": "-cpu la464,ptw=on -smp 8 -device virtio-rng-pci", + "efi_firmware": "/usr/local/share/qemu/edk2-loongarch64-code.fd", + "efi_bootname": "bootloongarch64", + "caps": ["efi", "zfs", "no_release"], + "target": "loongarch", + "target_arch": "loongarch64", + "timeout": 120, + "disabled": true } } } diff --git a/tools/boot/boot-test.sh b/tools/boot/boot-test.sh index 909c87fa1288..0c67c54a5e58 100755 --- a/tools/boot/boot-test.sh +++ b/tools/boot/boot-test.sh @@ -20,7 +20,9 @@ # -a ARCH Architecture to test; repeat -a to test several # (default: host arch) # Supported: amd64, aarch64, armv7, riscv64, powerpc, powerpc64, -# powerpc64le +# powerpc64le, loongarch64 +# (loongarch64 is disabled/excluded from -A until the LoongArch +# port lands in-tree; usable directly via -a once it has) # -A Test every supported architecture # -b Skip build/install phase (reuse existing tree) # -B Skip build/install and image creation (reuse existing images) @@ -82,6 +84,9 @@ have_file() { # -------------------------------------------------------------------------- # Test whether the current arch declares a capability, e.g. "has efi". +# "no_release" is special: it means the arch has never had a FreeBSD +# release, so there's no ISO to pull a minimal userland from -- see +# install_minimal_userland_world(). has() { case " ${ARCH_CAPS} " in *" $1 "*) return 0 ;; @@ -317,41 +322,83 @@ find_iso() { die "No ISO found for ${ARCH}: ${isoname} not found" } -install_minimal_userland() { - # Split the declaration from the assignment: `local iso=$(find_iso)` would - # swallow find_iso's exit status (local returns 0), so its die() -- which - # runs in the $() subshell -- would not stop this script. - local iso - iso=$(find_iso) || exit 1 - echo " Extracting minimal userland from release ISO ${iso}..." - - # Determine library paths from host equivalents of our binaries +# Paths (binaries + their libraries + rtld) to pull into DESTDIR for a minimal +# userland. Library *names* are discovered via ldd on the HOST's own copies of +# USERLAND_BINS: those paths (e.g. /lib/libc.so.7) are the same across +# architectures, only the file contents differ, so this works even when the +# files themselves are about to come from a foreign-arch source. +userland_extract_list() { local host_bins="" for b in ${USERLAND_BINS}; do host_bins="${host_bins} /${b}" done - lib_paths=$(ldd ${host_bins} 2>/dev/null \ + local lib_paths=$(ldd ${host_bins} 2>/dev/null \ | awk 'NF == 4 { print $3 }' | sort -u) - # Build the list of paths to extract: binaries + libraries + rtld - local extract_list="" + local list="" for b in ${USERLAND_BINS}; do - extract_list="${extract_list} ./${b}" + list="${list} ./${b}" done for l in ${lib_paths}; do - extract_list="${extract_list} .${l}" + list="${list} .${l}" done - extract_list="${extract_list} ./libexec/ld-elf.so.1" + list="${list} ./libexec/ld-elf.so.1" # Some architectures (e.g., armv7) need libgcc_s.so.1 even though the host # binaries don't. Always try to extract it. We'll ignore it if not there. - extract_list="${extract_list} ./lib/libgcc_s.so.1" + list="${list} ./lib/libgcc_s.so.1" + echo "${list}" +} - # Extract the files from the tarball. - tar -C ${DESTDIR} -xf ${iso} ${extract_list} \ +# Extract the minimal userland from a release ISO -- the normal path for any +# arch that has actually shipped a FreeBSD release. +install_minimal_userland_iso() { + # Split the declaration from the assignment: `local iso=$(find_iso)` would + # swallow find_iso's exit status (local returns 0), so its die() -- which + # runs in the $() subshell -- would not stop this script. + local iso + iso=$(find_iso) || exit 1 + echo " Extracting minimal userland from release ISO ${iso}..." + tar -C ${DESTDIR} -xf ${iso} $(userland_extract_list) \ >> ${LOGDIR}/installuserland.log 2>&1 || true } +# Cross-build the minimal userland via installworld instead of an ISO -- for +# architectures that have never had a FreeBSD release (no_release cap), so no +# ISO exists or ever will for the current version. Assumes buildworld has +# already been done for TARGET/TARGET_ARCH, same precondition build_tree +# already has for buildkernel. +install_minimal_userland_world() { + echo " Cross-installing minimal userland via installworld (no release for ${ARCH})..." + local worlddir=${OUTDIR}/world + rm -rf ${worlddir} + mkdir -p ${worlddir} + (cd ${SRCTOP} && ${MK} installworld \ + DESTDIR=${worlddir} \ + MK_MAN=no \ + MK_TESTS=no \ + MK_DEBUG_FILES=no \ + MK_INSTALL_AS_USER=yes) > ${LOGDIR}/installworld.log 2>&1 \ + || die "installworld failed (see ${LOGDIR}/installworld.log)" + + local item src + for item in $(userland_extract_list); do + src=${worlddir}/${item#.} + [ -f "${src}" ] || continue + mkdir -p ${DESTDIR}/$(dirname ${item#.}) + cp -p ${src} ${DESTDIR}/${item#.} + done + rm -rf ${worlddir} +} + +install_minimal_userland() { + if has no_release; then + install_minimal_userland_world + else + install_minimal_userland_iso + fi +} + # -------------------------------------------------------------------------- # Phase 1: Build the boot tree # --------------------------------------------------------------------------