summaryrefslogtreecommitdiffstats
path: root/sys/boot/arm/ixp425/boot2/Makefile
blob: a329b65c0db6f8f5d7ffe183a4bb6b3cc9fcb1a4 (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
#  $FreeBSD$

# We get a lot of the std lib functions from here.
.PATH: ${.CURDIR}/../../at91/libat91

# Enable to get debug msgs
#DEBUG=yes

# Hack to search through the kernel for ufs:ad0s1a and replace it with
# the correct one for the active slice/partition.
FIXUP_BOOT_DRV=yes

P=boot2
FILES=${P}
SRCS=arm_init.S boot2.c ${BOOT_FLAVOR:L}_board.c
SRCS+=memchr.c memcmp.c memcpy.c memmem.c memset.c printf.c strcmp.c strcpy.c
SRCS+=strlen.c ashldi3.c divsi3.S muldi3.c
NO_MAN=

KERNPHYSADDR=0x180000
KERNVIRTADDR=${KERNPHYSADDR}
BOOT_STACK=0x200000-4
M=${MACHINE}
LDFLAGS=-e ${KERNPHYSADDR} -EB -T ldscript.${M}
OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
S=${.CURDIR}/../../../..

CFLAGS+= \
	-DBOOT_STACK=${BOOT_STACK} \
	-I${.CURDIR}/../../../common \
	-I${.CURDIR}

.if defined(FIXUP_BOOT_DRV)
CFLAGS+=-DFIXUP_BOOT_DRV
.endif
.if defined(DEBUG)
CFLAGS+=-DDEBUG
.endif

ldscript.$M:	$S/conf/ldscript.$M
	cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \
	  sed s/KERNVIRTADDR/${KERNVIRTADDR}/g | \
	  sed s/" + SIZEOF_HEADERS"// > ldscript.$M

${P}:	ldscript.$M

CLEANFILES+=ldscript.$M

memchr.c:	$S/../lib/libc/string/memchr.c
	sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memchr.c > \
	  ${.TARGET}

memmem.c:	$S/../lib/libc/string/memmem.c
	sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memmem.c > \
	  ${.TARGET}

CLEANFILES+=memchr.c memmem.c

ashldi3.o:	$S/libkern/ashldi3.c
	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}

divsi3.o:	$S/libkern/${M}/divsi3.S
	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}

muldi3.o:	$S/libkern/${M}/muldi3.c
	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}

inflate.c:	$S/kern/inflate.c
	sed -e 's/extern void putstr (char/extern void putstr (const char/' < \
	    $S/kern/inflate.c > ${.TARGET}

CLEANFILES+=inflate.c

.include <bsd.prog.mk>

OpenPOWER on IntegriCloud