xref: /titanic_52/usr/src/boot/sys/boot/arm/ixp425/boot2/Makefile (revision 4a5d661a82b942b6538acd26209d959ce98b593a)
1#  $FreeBSD$
2
3.include <src.opts.mk>
4
5# We get a lot of the std lib functions from here.
6.PATH: ${.CURDIR}/../../at91/libat91
7
8# Enable to get debug msgs
9#DEBUG=yes
10
11# Hack to search through the kernel for ufs:ad0s1a and replace it with
12# the correct one for the active slice/partition.
13FIXUP_BOOT_DRV=yes
14
15P=boot2
16FILES=${P}
17SRCS=arm_init.S boot2.c ${BOOT_FLAVOR:tl}_board.c
18SRCS+=memchr.c memcmp.c memcpy.c memmem.c memset.c printf.c strcmp.c strcpy.c
19SRCS+=strlen.c ashldi3.c divsi3.S muldi3.c
20SRCS+=aeabi_unwind.c
21MAN=
22
23KERNPHYSADDR=0x180000
24KERNVIRTADDR=${KERNPHYSADDR}
25BOOT_STACK=0x200000-4
26M=${MACHINE}
27LDFLAGS=-e ${KERNPHYSADDR} -EB -T ldscript.${M}
28OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
29S=${.CURDIR}/../../../..
30
31CFLAGS+= \
32	-DBOOT_STACK=${BOOT_STACK} \
33	-I${.CURDIR}/../../../common \
34	-I${.CURDIR}
35
36.if defined(FIXUP_BOOT_DRV)
37CFLAGS+=-DFIXUP_BOOT_DRV
38.endif
39.if defined(DEBUG)
40CFLAGS+=-DDEBUG
41.endif
42
43ldscript.$M:	$S/conf/ldscript.$M
44	cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \
45	  sed s/KERNVIRTADDR/${KERNVIRTADDR}/g | \
46	  sed s/" + SIZEOF_HEADERS"// > ldscript.$M
47
48${P}:	ldscript.$M
49
50CLEANFILES+=ldscript.$M
51
52memchr.c:	$S/../lib/libc/string/memchr.c
53	sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memchr.c > \
54	  ${.TARGET}
55
56memmem.c:	$S/../lib/libc/string/memmem.c
57	sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memmem.c > \
58	  ${.TARGET}
59
60CLEANFILES+=memchr.c memmem.c
61
62ashldi3.o:	$S/libkern/ashldi3.c
63	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
64
65divsi3.o:	$S/libkern/${M}/divsi3.S
66	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
67
68muldi3.o:	$S/libkern/${M}/muldi3.c
69	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
70
71inflate.c:	$S/kern/inflate.c
72	sed -e 's/extern void putstr (char/extern void putstr (const char/' < \
73	    $S/kern/inflate.c > ${.TARGET}
74
75CLEANFILES+=inflate.c
76
77.include <bsd.prog.mk>
78
79