From nobody Wed Jun 18 18:42:37 2025 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 4bMszy1JyFz5q03X; Wed, 18 Jun 2025 18:42:38 +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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bMszx5zNSz3pj3; Wed, 18 Jun 2025 18:42:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750272157; 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=tF8cqZLJX+5u+WKQIeEOhqkgkQbcvfHu/hTKVeHZrRE=; b=yzW/bWkzXEdEsuuXkr7+c0IbUWo8wRLRi5A4qN3j27dUk2PpwMf/vK1Ww60lPCRxgcMcnQ db4LIPcccaJkoKNSrk5jp/2b0lzNUXYBqUsOzKX9FmhFEOnJxNpluvTjjxWHhVQrlX6p1V 0reZi3b6pxnSpDzvTlnoVi4f4gsv3Dq3X5xiY3JlICjEiu2OTH1WSIlzxDB5IN+0+rQM+Q p0UUU1ayhsTgwpiVAUD0zzqED9lVph277oxgiyJkqH31qvwPSBvm/+8byX+RuLjTq8wYUt MZZ++xAVgoQ1AJsZRzUGa6FDPiE0ktzoE7B2EUYIetskbg6oCAyEcgWrRl4Psg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750272157; 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=tF8cqZLJX+5u+WKQIeEOhqkgkQbcvfHu/hTKVeHZrRE=; b=tcjKTt6Y76u7etQJ4RV9cezXeGjg+R5cgZNGd/4eTgZ00xbk9EjRHRTbBz5tlbL/7Wa582 eB8pMWY9uu7v7LqJkLDGXVEBnV3s4kIfejS/z24lhvUjTFwy3sLgn4IwzJd7mFMUPPcLhw KVDJamdIP0vJYC3WsHpkLGmI27I/76HOD2drV4t5Ej2wHnsgFDfq81hKyKFIyyit94ddte 0ucKzGN6tmvyk05CUxWqZOdQ9DimCBq9WYfftREQNgCkmc7AhbfAt/Ubt7PTgyNzAUifWS rz3dBVePWFyrYiZg7/RHNHQh9KqveGADrudhh0x9V8PvT71TlVuvEkVq+NnKrw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750272157; a=rsa-sha256; cv=none; b=J2j4RLx+Ucu84yt0GltUjLX8ptp8QBhR8YgqqQXdysOP76bhkK/y+ufVirKhse32Wok0kD 84vPYanVZb08pZht5Vq1M7VfxlvH8+ocoaO65lbtwRIV1azWvoqGGYeGV05QS+y/yLYE3U lmxgcoN74Nj8pW2ahHxn4CKNhYvP960J35sKXkGelVoCpyTkeko5tRm+c8sIFEkhh2bKXN t8lEdun9B70SC8txY/BH4YqAAy8jsE7giDbYqhAk1geyQWCpIgw5x1LAWM70Jb4IDPX63r 9kLNmey7BOWIib2lawPZAyUxRNSOTbDGNWhvyFH3rMsuLgM/x7/RvXjcpQ2q7Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bMszx5Tp1zj2X; Wed, 18 Jun 2025 18:42:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55IIgbK4085492; Wed, 18 Jun 2025 18:42:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55IIgb6B085489; Wed, 18 Jun 2025 18:42:37 GMT (envelope-from git) Date: Wed, 18 Jun 2025 18:42:37 GMT Message-Id: <202506181842.55IIgb6B085489@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: eca56377601f - main - stand: userboot: allow building on !x86 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eca56377601fb87afb0a001d59adaadb33d137ad Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=eca56377601fb87afb0a001d59adaadb33d137ad commit eca56377601fb87afb0a001d59adaadb33d137ad Author: Kyle Evans AuthorDate: 2025-06-18 18:42:29 +0000 Commit: Kyle Evans CommitDate: 2025-06-18 18:42:29 +0000 stand: userboot: allow building on !x86 We can still get plenty of use out of a userboot that doesn't know anything about how to load or boot a kernel; notably, the test harness in tools/boot can still be used to test lua changes. Hack out the necessary bits to simply build on other platforms, and add a small warning with ample time to view the warning on other platforms. We still won't build userboot by default on these platforms, since the build product isn't useful for most people. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D41529 --- stand/userboot/userboot/Makefile | 16 ++++++++++++++++ stand/userboot/userboot/conf.c | 4 ++++ stand/userboot/userboot/main.c | 5 +++++ 3 files changed, 25 insertions(+) diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile index a1ba1b4d700e..2a66c0e3f8fe 100644 --- a/stand/userboot/userboot/Makefile +++ b/stand/userboot/userboot/Makefile @@ -13,18 +13,30 @@ SHLIB_NAME= userboot_${LOADER_INTERP}.so STRIP= LIBDIR= /boot +.if ${MACHINE_CPUARCH} == "amd64" +USERBOOT_KERNEL_SUPPORT= yes +.else +USERBOOT_KERNEL_SUPPORT= no +.endif + .PATH: ${.CURDIR}/../userboot SRCS= autoload.c SRCS+= bcache.c +.if ${MACHINE_CPUARCH} == "amd64" SRCS+= biossmap.c +.endif +.if ${USERBOOT_KERNEL_SUPPORT} == "yes" SRCS+= bootinfo.c SRCS+= bootinfo32.c SRCS+= bootinfo64.c +.endif SRCS+= conf.c SRCS+= copy.c SRCS+= devicename.c +.if ${USERBOOT_KERNEL_SUPPORT} == "yes" SRCS+= elf32_freebsd.c SRCS+= elf64_freebsd.c +.endif SRCS+= host.c SRCS+= main.c SRCS+= userboot_cons.c @@ -49,6 +61,10 @@ VERSION_FILE?= ${.CURDIR}/../userboot/version LINKS+= ${BINDIR}/${SHLIB_NAME} ${BINDIR}/userboot.so .endif +.if ${USERBOOT_KERNEL_SUPPORT} == "yes" +CFLAGS+= -DUSERBOOT_KERNEL_SUPPORT +.endif + .if ${MK_LOADER_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT HAVE_ZFS=yes diff --git a/stand/userboot/userboot/conf.c b/stand/userboot/userboot/conf.c index abfd16c592e7..63f64cb97fbe 100644 --- a/stand/userboot/userboot/conf.c +++ b/stand/userboot/userboot/conf.c @@ -83,16 +83,20 @@ struct netif_driver *netif_drivers[] = { * Sort formats so that those that can detect based on arguments * rather than reading the file go first. */ +#if defined(__amd64__) extern struct file_format i386_elf; extern struct file_format i386_elf_obj; extern struct file_format amd64_elf; extern struct file_format amd64_elf_obj; +#endif struct file_format *file_formats[] = { +#if defined(__amd64__) &i386_elf, &i386_elf_obj, &amd64_elf, &amd64_elf_obj, +#endif NULL }; diff --git a/stand/userboot/userboot/main.c b/stand/userboot/userboot/main.c index 53b76c685d92..03f226c08bb9 100644 --- a/stand/userboot/userboot/main.c +++ b/stand/userboot/userboot/main.c @@ -205,6 +205,11 @@ loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks) devinit(); extract_currdev(); +#if !defined(USERBOOT_KERNEL_SUPPORT) + printf("WARNING: This userboot does not support loading a kernel\n"); + delay(1500000); +#endif + /* * Checking the interpreter isn't worth the overhead unless we * actually have the swap_interpreter callback, so we actually version