xref: /NextBSD/sys/boot/powerpc/kboot/Makefile (revision 4557fabb34e865d7f40be64b39c9e34fa41dbb60)
1# $FreeBSD$
2
3.include <src.opts.mk>
4MK_SSP=		no
5MAN=
6
7PROG=		loader.kboot
8NEWVERSWHAT=	"kboot loader" ${MACHINE_ARCH}
9BINDIR?=	/boot
10INSTALLFLAGS=	-b
11
12# Architecture-specific loader code
13SRCS=		conf.c metadata.c vers.c main.c ppc64_elf_freebsd.c
14SRCS+=		host_syscall.S hostcons.c hostdisk.c kerneltramp.S kbootfdt.c
15SRCS+=		ucmpdi2.c
16
17LOADER_DISK_SUPPORT?=	yes
18LOADER_UFS_SUPPORT?=	yes
19LOADER_CD9660_SUPPORT?=	yes
20LOADER_EXT2FS_SUPPORT?=	yes
21LOADER_NET_SUPPORT?=	yes
22LOADER_NFS_SUPPORT?=	yes
23LOADER_TFTP_SUPPORT?=	no
24LOADER_GZIP_SUPPORT?=	yes
25LOADER_FDT_SUPPORT=	yes
26LOADER_BZIP2_SUPPORT?=	no
27
28.if ${LOADER_DISK_SUPPORT} == "yes"
29CFLAGS+=	-DLOADER_DISK_SUPPORT
30.endif
31.if ${LOADER_UFS_SUPPORT} == "yes"
32CFLAGS+=	-DLOADER_UFS_SUPPORT
33.endif
34.if ${LOADER_CD9660_SUPPORT} == "yes"
35CFLAGS+=	-DLOADER_CD9660_SUPPORT
36.endif
37.if ${LOADER_EXT2FS_SUPPORT} == "yes"
38CFLAGS+=	-DLOADER_EXT2FS_SUPPORT
39.endif
40.if ${LOADER_GZIP_SUPPORT} == "yes"
41CFLAGS+=	-DLOADER_GZIP_SUPPORT
42.endif
43.if ${LOADER_BZIP2_SUPPORT} == "yes"
44CFLAGS+=	-DLOADER_BZIP2_SUPPORT
45.endif
46.if ${LOADER_NET_SUPPORT} == "yes"
47CFLAGS+=	-DLOADER_NET_SUPPORT
48.endif
49.if ${LOADER_NFS_SUPPORT} == "yes"
50CFLAGS+=	-DLOADER_NFS_SUPPORT
51.endif
52.if ${LOADER_TFTP_SUPPORT} == "yes"
53CFLAGS+=	-DLOADER_TFTP_SUPPORT
54.endif
55.if ${LOADER_FDT_SUPPORT} == "yes"
56CFLAGS+=	-I${.CURDIR}/../../fdt
57CFLAGS+=	-I${.OBJDIR}/../../fdt
58CFLAGS+=	-I${.CURDIR}/../../../contrib/libfdt
59CFLAGS+=	-DLOADER_FDT_SUPPORT
60LIBFDT=		${.OBJDIR}/../../fdt/libfdt.a
61.endif
62
63
64.if ${MK_FORTH} != "no"
65# Enable BootForth
66BOOT_FORTH=	yes
67CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/powerpc
68LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
69.endif
70
71# Avoid the open-close-dance for every file access as some firmwares perform
72# an auto-negotiation on every open of the network interface and thus causes
73# netbooting to take horribly long.
74CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE -mcpu=powerpc64
75
76# Always add MI sources
77.PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern
78.include	"${.CURDIR}/../../common/Makefile.inc"
79CFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../../..
80CFLAGS+=	-I.
81
82CLEANFILES+=	vers.c loader.help
83
84CFLAGS+=	-Wall -ffreestanding -msoft-float -DAIM
85# load address. set in linker script
86RELOC?=		0x0
87CFLAGS+=	-DRELOC=${RELOC}
88
89LDFLAGS=	-nostdlib -static -T ${.CURDIR}/ldscript.powerpc
90
91# 64-bit bridge extensions
92CFLAGS+= -Wa,-mppc64bridge
93
94# Pull in common loader code
95#.PATH:		${.CURDIR}/../../ofw/common
96#.include	"${.CURDIR}/../../ofw/common/Makefile.inc"
97
98# where to get libstand from
99LIBSTAND=	${.OBJDIR}/../../libstand32/libstand.a
100CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
101
102DPADD=		${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
103LDADD=		${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
104
105vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
106	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
107
108loader.help: help.common help.kboot ${.CURDIR}/../../fdt/help.fdt
109	cat ${.ALLSRC} | \
110	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
111
112.PATH: ${.CURDIR}/../../forth
113.include	"${.CURDIR}/../../forth/Makefile.inc"
114
115FILES+= loader.rc menu.rc
116
117.include <bsd.prog.mk>
118