1217044Snwhitehorn# $FreeBSD: stable/10/sys/boot/powerpc/ps3/Makefile 314922 2017-03-08 22:39:45Z pfg $
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
66314922SpfgCFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl
67314922SpfgCFLAGS+=	-I${.CURDIR}/../../ficl/powerpc
68217044SnwhitehornLIBFICL=	${.OBJDIR}/../../ficl/libficl.a
69217044Snwhitehorn.endif
70217044Snwhitehorn
71217044Snwhitehorn# Avoid the open-close-dance for every file access as some firmwares perform
72217044Snwhitehorn# an auto-negotiation on every open of the network interface and thus causes
73217044Snwhitehorn# netbooting to take horribly long.
74217044SnwhitehornCFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE -mcpu=powerpc64
75217044Snwhitehorn
76217044Snwhitehorn# Always add MI sources
77217044Snwhitehorn.PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern
78217044Snwhitehorn.include	"${.CURDIR}/../../common/Makefile.inc"
79217044SnwhitehornCFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../../..
80217044SnwhitehornCFLAGS+=	-I.
81217044Snwhitehorn
82217044SnwhitehornCLEANFILES+=	vers.c loader.help
83217044Snwhitehorn
84217044SnwhitehornCFLAGS+=	-Wall -ffreestanding -msoft-float -DAIM
85217044Snwhitehorn# load address. set in linker script
86217044SnwhitehornRELOC?=		0x0
87217044SnwhitehornCFLAGS+=	-DRELOC=${RELOC}
88217044Snwhitehorn
89217044SnwhitehornLDFLAGS=	-nostdlib -static -T ${.CURDIR}/ldscript.powerpc
90217044Snwhitehorn
91217044Snwhitehorn# 64-bit bridge extensions
92217044SnwhitehornCFLAGS+= -Wa,-mppc64bridge
93217044Snwhitehorn
94217044Snwhitehorn# Pull in common loader code
95217044Snwhitehorn#.PATH:		${.CURDIR}/../../ofw/common
96217044Snwhitehorn#.include	"${.CURDIR}/../../ofw/common/Makefile.inc"
97217044Snwhitehorn
98217044Snwhitehorn# where to get libstand from
99271130SemasteLIBSTAND=	${.OBJDIR}/../../libstand32/libstand.a
100217044SnwhitehornCFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
101217044Snwhitehorn
102217044SnwhitehornDPADD=		${LIBFICL} ${LIBOFW} ${LIBSTAND}
103271130SemasteLDADD=		${LIBFICL} ${LIBOFW} ${LIBSTAND}
104217044Snwhitehorn
105217044SnwhitehornSC_DFLT_FONT=cp437
106217044Snwhitehorn
107217044Snwhitehornfont.h:
108217044Snwhitehorn	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
109217044Snwhitehorn
110217044Snwhitehornvers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
111217044Snwhitehorn	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
112217044Snwhitehorn
113246647Skientzleloader.help: help.common help.ps3 ${.CURDIR}/../../fdt/help.fdt
114217044Snwhitehorn	cat ${.ALLSRC} | \
115217044Snwhitehorn	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
116217044Snwhitehorn
117283289Sgjb.PATH: ${.CURDIR}/../../forth
118281843Sdteske.include	"${.CURDIR}/../../forth/Makefile.inc"
119217044Snwhitehorn
120293294SdteskeFILES+= loader.rc menu.rc
121217044Snwhitehorn
122217044Snwhitehorn.include <bsd.prog.mk>
123