git: edf8a9a42d30 - stable/14 - kboot: Cleanup libkern reference

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 16 Apr 2024 20:12:21 UTC
The branch stable/14 has been updated by imp:

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

commit edf8a9a42d3057f701228f37e73c0c551a47225e
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-01-28 18:28:05 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-16 19:54:20 +0000

    kboot: Cleanup libkern reference
    
    For aarch64 and amd64, we don't pull in anything from libkern, so we
    don't need it in our path.  However, powerpc needs ucmpdi2 from libkern,
    so bring it into libkboot's build and omit it from loader.kboot.
    
    Sponsored by:           Netflix
    
    (cherry picked from commit 4aabaa1890e927ed3dd34ccc4642268ea6a505ce)
---
 stand/kboot/kboot/Makefile                       | 1 -
 stand/kboot/kboot/arch/powerpc64/Makefile.inc    | 3 +--
 stand/kboot/libkboot/Makefile                    | 2 ++
 stand/kboot/libkboot/arch/powerpc64/Makefile.inc | 4 ++++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/stand/kboot/kboot/Makefile b/stand/kboot/kboot/Makefile
index 4054bb1da9f2..ae32d878a3f4 100644
--- a/stand/kboot/kboot/Makefile
+++ b/stand/kboot/kboot/Makefile
@@ -57,7 +57,6 @@ HELP_FILENAME=	loader.help.kboot
 
 # Always add MI sources
 .include	"${BOOTSRC}/loader.mk"
-.PATH:		${SYSDIR}/libkern
 CFLAGS+=	-I${.CURDIR} -I${.CURDIR}/arch/${MACHINE_ARCH}
 
 CFLAGS+=	-Wall
diff --git a/stand/kboot/kboot/arch/powerpc64/Makefile.inc b/stand/kboot/kboot/arch/powerpc64/Makefile.inc
index c29e69970505..338d1222ab65 100644
--- a/stand/kboot/kboot/arch/powerpc64/Makefile.inc
+++ b/stand/kboot/kboot/arch/powerpc64/Makefile.inc
@@ -1,7 +1,6 @@
 CFLAGS+=	-mcpu=powerpc64
 
-SRCS+=		ppc64_elf_freebsd.c host_syscall.S kerneltramp.S load_addr.c fdt_arch.c
-SRCS+=		ucmpdi2.c
+SRCS+=		ppc64_elf_freebsd.c kerneltramp.S load_addr.c fdt_arch.c
 
 LDFLAGS=	-nostdlib -static -T ${.CURDIR}/arch/${MACHINE_ARCH}/ldscript.powerpc
 
diff --git a/stand/kboot/libkboot/Makefile b/stand/kboot/libkboot/Makefile
index 415571617d2a..1b030ccfe018 100644
--- a/stand/kboot/libkboot/Makefile
+++ b/stand/kboot/libkboot/Makefile
@@ -7,4 +7,6 @@ CFLAGS+=-I${.CURDIR} -I${.CURDIR}/arch/${MACHINE_ARCH}
 
 SRCS=	crt1.c
 
+.sinclude "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc"
+
 .include <bsd.lib.mk>
diff --git a/stand/kboot/libkboot/arch/powerpc64/Makefile.inc b/stand/kboot/libkboot/arch/powerpc64/Makefile.inc
new file mode 100644
index 000000000000..4cafaee28847
--- /dev/null
+++ b/stand/kboot/libkboot/arch/powerpc64/Makefile.inc
@@ -0,0 +1,4 @@
+CFLAGS+=	-mcpu=powerpc64
+
+.PATH:		${SYSDIR}/libkern
+SRCS+=		ucmpdi2.c