summaryrefslogtreecommitdiff
path: root/sys/arch/cobalt/stand/boot/Makefile
blob: 3814cfb1dcc2ddd24eea79bc84b0e804666b4948 (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
#	$NetBSD: Makefile,v 1.32 2017/04/08 19:53:20 christos Exp $

NOMAN= # defined

.include <bsd.init.mk>

S=	${.CURDIR}/../../../..
MIPS=	${S}/arch/mips
COBALT=	${S}/arch/cobalt
LIBSADIR=	${S}/lib/libsa

# .PATH:	${.CURDIR}/../common

BINMODE?= 444

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

realall: ${PROG}

# Load @15Mb boundary as most (all?) of the Cobalt boxes
# had been shipped with at least 16Mb.
#
# XXX The proper fix is to load at the kernel base address
# and to relocate itself at the end of available memory.
LOAD_ADDRESS?=0x80F00000

COMPORT?=0x0
COMSPEED?=115200
COMPROBE?=0xa020001c

ZSCHAN?=0x01		# 0x01: ZS_CHAN_A, 0x00: ZS_CHAN_B
ZSSPEED?=115200
ZSPROBE?=0xa020001c

AFLAGS+=	-D_LOCORE -D_KERNEL -DASSEMBLER -mno-abicalls

# -I${.CURDIR}/../.. done by Makefile.inc
CPPFLAGS+=	-nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
#CPPFLAGS+=	-D_DEBUG	\
#		-DLIBSA_PRINTF_LONGLONG_SUPPORT -DLIBSA_PRINTF_WIDTH_SUPPORT
CPPFLAGS+=	-I${.OBJDIR} -I${S} -I${S}/arch -I${LIBSADIR}
CPPFLAGS+=	-DCONS_SERIAL -DCOMPORT=${COMPORT}
CPPFLAGS+=	-DCOMSPEED=${COMSPEED} -DCOMPROBE=${COMPROBE}
CPPFLAGS+=	-DCONS_ZS -DZSCHAN=${ZSCHAN}
CPPFLAGS+=	-DZSSPEED=${ZSSPEED} -DZSPROBE=${ZSPROBE}
CPPFLAGS+=	-DSUPPORT_DHCP -DSUPPORT_BOOTP
#CPPFLAGS+=	-DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG
#CPPFLAGS+=	-DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID

# compiler flags for smallest code size
CFLAGS=		-Os -mmemcpy -ffreestanding -mno-abicalls -msoft-float -G 128
AFLAGS+=	-mips3
CFLAGS+=	-mips3
.if ${MACHINE_ARCH} == "mips64el"
AFLAGS+=	-mabi=32
CFLAGS+=	-mabi=32
LINKFORMAT=	-m elf32ltsmip
.endif

CFLAGS+=	-Wall -Werror
CFLAGS+=	-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
CFLAGS+=	-Wno-pointer-sign

NETBSD_VERS!=	${HOST_SH} ${S}/conf/osrelease.sh
CPPFLAGS+=	-DNETBSD_VERS='"${NETBSD_VERS}"'

LDSCRIPT?=	${MIPS}/conf/stand.ldscript

PROG=		boot
# common sources
SRCS+=		start.S boot.c devopen.c conf.c clock.c bootinfo.c
SRCS+=		prf.c com.c cons.c ns16550.c pciide.c tgets.c wdc.c wd.c
SRCS+=		zs.c
SRCS+=		cache.c pci.c nif_tlp.c tlp.c
SRCS+=		lcd.c

# XXX dev_net.c should really be in libsa, but it doesn't
#     declare ip_convertaddr correctly.
.PATH: ${LIBSADIR}
SRCS+=		dev_net.c

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

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

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

LIBS=		${SALIB} ${ZLIB} ${KERNLIB}

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

${PROG}: ${LDSCRIPT} ${OBJS} ${LIBS}
	${LD} ${LINKFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
	    -T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
	${TOOL_GZIP_N} -c9 ${PROG} > ${PROG}.gz
	@${SIZE} ${PROG}

CLEANFILES+=	${PROG}.map ${PROG}.elf ${PROG}.gz

cleandir distclean: .WAIT cleanlibdir

cleanlibdir:
	-rm -rf lib

.include <bsd.klinks.mk>
.include <bsd.prog.mk>