1183651Sjhay#  $FreeBSD: releng/11.0/sys/boot/arm/ixp425/boot2/Makefile 272350 2014-10-01 08:26:51Z andrew $
2183651Sjhay
3265420Simp.include <src.opts.mk>
4255939Sandrew
5183651Sjhay# We get a lot of the std lib functions from here.
6183651Sjhay.PATH: ${.CURDIR}/../../at91/libat91
7183651Sjhay
8183651Sjhay# Enable to get debug msgs
9183651Sjhay#DEBUG=yes
10183651Sjhay
11183651Sjhay# Hack to search through the kernel for ufs:ad0s1a and replace it with
12183651Sjhay# the correct one for the active slice/partition.
13183651SjhayFIXUP_BOOT_DRV=yes
14183651Sjhay
15183651SjhayP=boot2
16183651SjhayFILES=${P}
17251250StijlSRCS=arm_init.S boot2.c ${BOOT_FLAVOR:tl}_board.c
18183651SjhaySRCS+=memchr.c memcmp.c memcpy.c memmem.c memset.c printf.c strcmp.c strcpy.c
19183651SjhaySRCS+=strlen.c ashldi3.c divsi3.S muldi3.c
20255939SandrewSRCS+=aeabi_unwind.c
21264400SimpMAN=
22183651Sjhay
23183651SjhayKERNPHYSADDR=0x180000
24183651SjhayKERNVIRTADDR=${KERNPHYSADDR}
25183651SjhayBOOT_STACK=0x200000-4
26211725SimpM=${MACHINE}
27183651SjhayLDFLAGS=-e ${KERNPHYSADDR} -EB -T ldscript.${M}
28183651SjhayOBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
29183651SjhayS=${.CURDIR}/../../../..
30183651Sjhay
31183651SjhayCFLAGS+= \
32183651Sjhay	-DBOOT_STACK=${BOOT_STACK} \
33183651Sjhay	-I${.CURDIR}/../../../common \
34183651Sjhay	-I${.CURDIR}
35183651Sjhay
36183651Sjhay.if defined(FIXUP_BOOT_DRV)
37183651SjhayCFLAGS+=-DFIXUP_BOOT_DRV
38183651Sjhay.endif
39183651Sjhay.if defined(DEBUG)
40183651SjhayCFLAGS+=-DDEBUG
41183651Sjhay.endif
42183651Sjhay
43183651Sjhayldscript.$M:	$S/conf/ldscript.$M
44183651Sjhay	cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \
45183651Sjhay	  sed s/KERNVIRTADDR/${KERNVIRTADDR}/g | \
46183651Sjhay	  sed s/" + SIZEOF_HEADERS"// > ldscript.$M
47183651Sjhay
48183651Sjhay${P}:	ldscript.$M
49183651Sjhay
50183651SjhayCLEANFILES+=ldscript.$M
51183651Sjhay
52183651Sjhaymemchr.c:	$S/../lib/libc/string/memchr.c
53183651Sjhay	sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memchr.c > \
54183651Sjhay	  ${.TARGET}
55183651Sjhay
56183651Sjhaymemmem.c:	$S/../lib/libc/string/memmem.c
57183651Sjhay	sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memmem.c > \
58183651Sjhay	  ${.TARGET}
59183651Sjhay
60183651SjhayCLEANFILES+=memchr.c memmem.c
61183651Sjhay
62183651Sjhayashldi3.o:	$S/libkern/ashldi3.c
63183669Ssam	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
64183651Sjhay
65183651Sjhaydivsi3.o:	$S/libkern/${M}/divsi3.S
66183669Ssam	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
67183651Sjhay
68183651Sjhaymuldi3.o:	$S/libkern/${M}/muldi3.c
69183669Ssam	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
70183651Sjhay
71183651Sjhayinflate.c:	$S/kern/inflate.c
72183651Sjhay	sed -e 's/extern void putstr (char/extern void putstr (const char/' < \
73183651Sjhay	    $S/kern/inflate.c > ${.TARGET}
74183651Sjhay
75183651SjhayCLEANFILES+=inflate.c
76183651Sjhay
77183651Sjhay.include <bsd.prog.mk>
78183651Sjhay
79