git: d2434697bc9c - main - loader.kboot: Build on amd64

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 08 Nov 2024 00:59:57 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=d2434697bc9cc2d36da0f356cc5942b33df87896

commit d2434697bc9cc2d36da0f356cc5942b33df87896
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-11-07 22:59:04 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-11-07 23:23:26 +0000

    loader.kboot:  Build on amd64
    
    But comment out FDT stuff for amd64 built inside kboot. This also
    restricts a bit the powerpc platforms we build on to powerpc64.
    
    Sponsored by:           Netflix
---
 stand/Makefile             | 2 +-
 stand/kboot/kboot/Makefile | 5 ++++-
 stand/kboot/kboot/main.c   | 5 ++++-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/stand/Makefile b/stand/Makefile
index ce91802d4a8b..5d81e5f8a032 100644
--- a/stand/Makefile
+++ b/stand/Makefile
@@ -37,7 +37,7 @@ INTERP_DEPENDS+=	lua
 .include <bsd.arch.inc.mk>
 
 S.${MK_EFI}+=		efi
-.if ${MK_FDT} != "no"
+.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "powerpc64"
 S.${MK_LOADER_KBOOT}+=	kboot
 .endif
 S.${MK_LOADER_UBOOT}+=	uboot
diff --git a/stand/kboot/kboot/Makefile b/stand/kboot/kboot/Makefile
index d354e1bc7e60..064d43701ebd 100644
--- a/stand/kboot/kboot/Makefile
+++ b/stand/kboot/kboot/Makefile
@@ -24,12 +24,15 @@ SRCS=	\
 		hostdisk.c \
 		hostfs.c \
 		init.c \
-		kbootfdt.c \
 		main.c \
 		seg.c \
 		util.c \
 		vers.c
 
+.if ${MK_FDT} != "no"
+SRCS+=		kbootfdt.c
+.endif
+
 .if ${MK_LOADER_ZFS} != "no"
 CFLAGS+=	-I${ZFSSRC}
 CFLAGS+=        -I${SYSDIR}/contrib/openzfs/include
diff --git a/stand/kboot/kboot/main.c b/stand/kboot/kboot/main.c
index 994df1ec9fa1..a9ea2d9354c9 100644
--- a/stand/kboot/kboot/main.c
+++ b/stand/kboot/kboot/main.c
@@ -26,7 +26,9 @@
 #include <stand.h>
 #include <sys/param.h>
 #include <sys/boot.h>
+#ifdef LOADER_FDT_SUPPORT
 #include <fdt_platform.h>
+#endif
 
 #include <machine/cpufunc.h>
 #include <bootstrap.h>
@@ -620,6 +622,7 @@ kboot_zfs_probe(void)
 #endif
 }
 
+#ifdef LOADER_FDT_SUPPORT
 /*
  * Since proper fdt command handling function is defined in fdt_loader_cmd.c,
  * and declaring it as extern is in contradiction with COMMAND_SET() macro
@@ -634,4 +637,4 @@ command_fdt(int argc, char *argv[])
 }
 
 COMMAND_SET(fdt, "fdt", "flattened device tree handling", command_fdt);
-
+#endif