summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/stand/ofwboot/Makefile
blob: f1f3dd453eb53ef17817e0a723580e26a8c81ee0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#	$NetBSD: Makefile,v 1.42 2023/06/03 21:26:28 lukem Exp $

.include <bsd.init.mk>

CURDIR=	${.CURDIR}
S=	${CURDIR}/../../../..

#
# Override normal settings
#

WARNS?=		2
KLINK_MACHINE=	sparc64

PROG?=		ofwboot
SRCS=		srt0.s Locore.c boot.c ofdev.c alloc.c net.c netif_of.c
SRCS+=		bootinfo.c loadfile_machdep.c promlib.c prf.c isfloppy.c
.if ${MACHINE_ARCH} == "sparc64"
SRCS+=		hvcall.S
CPPFLAGS+=	-DSUN4V
.endif
.PATH:		${S}/arch/sparc64/sparc64 ${S}/arch/sparc/stand/common

# XXX SHOULD NOT NEED TO DEFINE THESE!
LIBCRT0=
LIBCRTI=
LIBC=
LIBCRTBEGIN=
LIBCRTEND=

COPTS+=		-ffreestanding -mcpu=v9
CWARNFLAGS+=	-Wno-main
CFLAGS+=	${COPTS}
CPPFLAGS+=	-D_STANDALONE
CPPFLAGS+=	-DBOOT_ELF32 -DBOOT_ELF64 -DBOOT_AOUT
CPPFLAGS+=	-DNETBOOT
CPPFLAGS+=	-DSUPPORT_DHCP
#CPPFLAGS+=	-DNETIF_DEBUG 
#CPPFLAGS+=	-D_DEBUG

# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
# accessors -- they don't actually dereference the resulting pointer,
# just use it for type-checking.
CWARNFLAGS+=	${CC_WNO_ADDRESS_OF_PACKED_MEMBER}

LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net

NOMAN=		# defined
STRIPFLAG=
BINMODE=	444

NEWVERSWHAT=	"OpenFirmware Boot"

#
# Elf64 defaults to 1MB
#
# We may get address conflicts with other bootloaders, say
# Sun's ufsboot, so we'll pick a reasonably empty address.
#
RELOC=		100000

ENTRY=		_start

CPPFLAGS+=	-I${CURDIR}/../../.. -I${CURDIR}/../../../.. -I${CURDIR} -I.
CPPFLAGS+=	-I${CURDIR}/../../../../../common/include
CPPFLAGS+=	-DRELOC=0x${RELOC}

#
# XXXXX FIXME
#
CPPFLAGS+=	-DSPARC_BOOT_AOUT
CPPFLAGS+=	-DSPARC_BOOT_ELF
CPPFLAGS+=	-DSPARC_BOOT_UFS
CPPFLAGS+=	-DSPARC_BOOT_NFS
CPPFLAGS+=	-DSPARC_BOOT_CD9660

### find out what to use for libkern
KERN_AS=	library
.include "${S}/lib/libkern/Makefile.inc"
LIBKERN=	${KERNLIB}

### find out what to use for libz
Z_AS=		library
.include "${S}/lib/libz/Makefile.inc"
LIBZ=		${ZLIB}

### find out what to use for libsa
SA_AS=		library
SAMISCMAKEFLAGS= SA_USE_LOADFILE=yes SA_USE_CREAD=yes
SAMISCCPPFLAGS+= -DCOMPAT_SOLARIS_UFS
.include "${S}/lib/libsa/Makefile.inc"
LIBSA=		${SALIB}

.include "${S}/conf/newvers_stand.mk"

.include <bsd.own.mk>
.include <bsd.klinks.mk>

.if CROSS
${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
	${_MKTARGET_LINK}
	${LD} -N -p -Ttext ${RELOC} -e ${ENTRY} >lderr -o ${PROG} \
	    ${OBJS} -L${SADST} -lsa -L${ZDST} -lz -L${KERNDST} -lkern # solaris linker
.else
${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
	${_MKTARGET_LINK}
	${LD} -X -N -S -Ttext ${RELOC} -e ${ENTRY} -o ${PROG} \
	    ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}	# native linker
.endif

.include <bsd.prog.mk>

CPUFLAGS+=		-mcpu=v9
AFLAGS+=		-Wa,-Av9a
AFLAGS+=		-x assembler-with-cpp -D_LOCORE -D__ELF__

NORMAL_S=	${CC} ${AFLAGS} ${AFLAGS.${<:T}}  ${CPPFLAGS} -c $<
srt0.o: srt0.s
	${NORMAL_S}

hvcall.o: hvcall.S
	${NORMAL_S}


# Explicit dependency for this.
boot.o: boot.c