1217044Snwhitehorn# $FreeBSD$
2217044Snwhitehorn
3217044Snwhitehorn.include <bsd.own.mk>
4217044SnwhitehornMK_SSP=		no
5217044Snwhitehorn
6217044SnwhitehornPROG=		loader.ps3
7217044SnwhitehornNEWVERSWHAT=	"Playstation 3 loader" ${MACHINE_ARCH}
8217044SnwhitehornBINDIR?=	/boot
9217044SnwhitehornINSTALLFLAGS=	-b
10217044Snwhitehorn
11217044Snwhitehorn# Architecture-specific loader code
12217044SnwhitehornSRCS=		start.S conf.c metadata.c vers.c main.c devicename.c ppc64_elf_freebsd.c
13224857SnwhitehornSRCS+=		lv1call.S ps3cons.c font.h ps3mmu.c ps3net.c ps3repo.c \
14224857Snwhitehorn		ps3stor.c ps3disk.c ps3cdrom.c
15217044SnwhitehornSRCS+=		ucmpdi2.c
16217044Snwhitehorn
17217044SnwhitehornLOADER_DISK_SUPPORT?=	yes
18217044SnwhitehornLOADER_UFS_SUPPORT?=	yes
19217044SnwhitehornLOADER_CD9660_SUPPORT?=	yes
20224106SnwhitehornLOADER_EXT2FS_SUPPORT?=	yes
21217044SnwhitehornLOADER_NET_SUPPORT?=	yes
22217044SnwhitehornLOADER_NFS_SUPPORT?=	yes
23217044SnwhitehornLOADER_TFTP_SUPPORT?=	no
24217044SnwhitehornLOADER_GZIP_SUPPORT?=	yes
25217044SnwhitehornLOADER_FDT_SUPPORT?=	no
26217044SnwhitehornLOADER_BZIP2_SUPPORT?=	no
27217044Snwhitehorn
28217044Snwhitehorn.if ${LOADER_DISK_SUPPORT} == "yes"
29217044SnwhitehornCFLAGS+=	-DLOADER_DISK_SUPPORT
30217044Snwhitehorn.endif
31217044Snwhitehorn.if ${LOADER_UFS_SUPPORT} == "yes"
32217044SnwhitehornCFLAGS+=	-DLOADER_UFS_SUPPORT
33217044Snwhitehorn.endif
34217044Snwhitehorn.if ${LOADER_CD9660_SUPPORT} == "yes"
35217044SnwhitehornCFLAGS+=	-DLOADER_CD9660_SUPPORT
36217044Snwhitehorn.endif
37217044Snwhitehorn.if ${LOADER_EXT2FS_SUPPORT} == "yes"
38217044SnwhitehornCFLAGS+=	-DLOADER_EXT2FS_SUPPORT
39217044Snwhitehorn.endif
40217044Snwhitehorn.if ${LOADER_GZIP_SUPPORT} == "yes"
41217044SnwhitehornCFLAGS+=	-DLOADER_GZIP_SUPPORT
42217044Snwhitehorn.endif
43217044Snwhitehorn.if ${LOADER_BZIP2_SUPPORT} == "yes"
44217044SnwhitehornCFLAGS+=	-DLOADER_BZIP2_SUPPORT
45217044Snwhitehorn.endif
46217044Snwhitehorn.if ${LOADER_NET_SUPPORT} == "yes"
47217044SnwhitehornCFLAGS+=	-DLOADER_NET_SUPPORT
48217044Snwhitehorn.endif
49217044Snwhitehorn.if ${LOADER_NFS_SUPPORT} == "yes"
50217044SnwhitehornCFLAGS+=	-DLOADER_NFS_SUPPORT
51217044Snwhitehorn.endif
52217044Snwhitehorn.if ${LOADER_TFTP_SUPPORT} == "yes"
53217044SnwhitehornCFLAGS+=	-DLOADER_TFTP_SUPPORT
54217044Snwhitehorn.endif
55217044Snwhitehorn.if ${LOADER_FDT_SUPPORT} == "yes"
56217044SnwhitehornCFLAGS+=	-I${.CURDIR}/../../fdt
57217044SnwhitehornCFLAGS+=	-I${.OBJDIR}/../../fdt
58217044SnwhitehornCFLAGS+=	-DLOADER_FDT_SUPPORT
59217044SnwhitehornLIBFDT=		${.OBJDIR}/../../fdt/libfdt.a
60217044Snwhitehorn.endif
61217044Snwhitehorn
62217044Snwhitehorn
63217044Snwhitehorn.if ${MK_FORTH} != "no"
64217044Snwhitehorn# Enable BootForth
65217044SnwhitehornBOOT_FORTH=	yes
66217044SnwhitehornCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/powerpc
67217044SnwhitehornLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
68217044Snwhitehorn.endif
69217044Snwhitehorn
70217044Snwhitehorn# Avoid the open-close-dance for every file access as some firmwares perform
71217044Snwhitehorn# an auto-negotiation on every open of the network interface and thus causes
72217044Snwhitehorn# netbooting to take horribly long.
73217044SnwhitehornCFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE -mcpu=powerpc64
74217044Snwhitehorn
75217044Snwhitehorn# Always add MI sources
76217044Snwhitehorn.PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern
77217044Snwhitehorn.include	"${.CURDIR}/../../common/Makefile.inc"
78217044SnwhitehornCFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../../..
79217044SnwhitehornCFLAGS+=	-I.
80217044Snwhitehorn
81217044SnwhitehornCLEANFILES+=	vers.c loader.help
82217044Snwhitehorn
83217044SnwhitehornCFLAGS+=	-Wall -ffreestanding -msoft-float -DAIM
84217044Snwhitehorn# load address. set in linker script
85217044SnwhitehornRELOC?=		0x0
86217044SnwhitehornCFLAGS+=	-DRELOC=${RELOC}
87217044Snwhitehorn
88217044SnwhitehornLDFLAGS=	-nostdlib -static -T ${.CURDIR}/ldscript.powerpc
89217044Snwhitehorn
90217044Snwhitehorn# 64-bit bridge extensions
91217044SnwhitehornCFLAGS+= -Wa,-mppc64bridge
92217044Snwhitehorn
93217044Snwhitehorn# Pull in common loader code
94217044Snwhitehorn#.PATH:		${.CURDIR}/../../ofw/common
95217044Snwhitehorn#.include	"${.CURDIR}/../../ofw/common/Makefile.inc"
96217044Snwhitehorn
97217044Snwhitehorn# where to get libstand from
98271130SemasteLIBSTAND=	${.OBJDIR}/../../libstand32/libstand.a
99217044SnwhitehornCFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
100217044Snwhitehorn
101217044SnwhitehornDPADD=		${LIBFICL} ${LIBOFW} ${LIBSTAND}
102271130SemasteLDADD=		${LIBFICL} ${LIBOFW} ${LIBSTAND}
103217044Snwhitehorn
104217044SnwhitehornSC_DFLT_FONT=cp437
105217044Snwhitehorn
106217044Snwhitehornfont.h:
107217044Snwhitehorn	uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h
108217044Snwhitehorn
109217044Snwhitehornvers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
110217044Snwhitehorn	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
111217044Snwhitehorn
112246647Skientzleloader.help: help.common help.ps3 ${.CURDIR}/../../fdt/help.fdt
113217044Snwhitehorn	cat ${.ALLSRC} | \
114217044Snwhitehorn	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
115217044Snwhitehorn
116217044Snwhitehorn.PATH: ${.CURDIR}/../../forth
117217044SnwhitehornFILES=	loader.help loader.4th support.4th loader.conf
118222472SjulianFILES+=	screen.4th frames.4th
119222417SjulianFILES+=	beastie.4th brand.4th check-password.4th color.4th delay.4th
120242688SdteskeFILES+=	menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
121217044SnwhitehornFILESDIR_loader.conf=	/boot/defaults
122217044Snwhitehorn
123217044Snwhitehorn.if !exists(${DESTDIR}/boot/loader.rc)
124217044SnwhitehornFILES+= loader.rc
125217044Snwhitehorn.endif
126217044Snwhitehorn
127222417Sjulian.if !exists(${DESTDIR}/boot/menu.rc)
128222417SjulianFILES+= menu.rc
129222417Sjulian.endif
130222417Sjulian
131217044Snwhitehorn.include <bsd.prog.mk>
132