1183651Sjhay#  $FreeBSD: releng/10.3/sys/boot/arm/ixp425/boot2/Makefile 276486 2014-12-31 23:25:37Z ngie $
2183651Sjhay
3255939Sandrew.include <bsd.own.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
20255939Sandrew.if ${MK_ARM_EABI} != "no"
21255939SandrewSRCS+=aeabi_unwind.c
22255939Sandrew.endif
23276486SngieMAN=
24183651Sjhay
25183651SjhayKERNPHYSADDR=0x180000
26183651SjhayKERNVIRTADDR=${KERNPHYSADDR}
27183651SjhayBOOT_STACK=0x200000-4
28211725SimpM=${MACHINE}
29183651SjhayLDFLAGS=-e ${KERNPHYSADDR} -EB -T ldscript.${M}
30183651SjhayOBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
31183651SjhayS=${.CURDIR}/../../../..
32183651Sjhay
33183651SjhayCFLAGS+= \
34183651Sjhay	-DBOOT_STACK=${BOOT_STACK} \
35183651Sjhay	-I${.CURDIR}/../../../common \
36183651Sjhay	-I${.CURDIR}
37183651Sjhay
38183651Sjhay.if defined(FIXUP_BOOT_DRV)
39183651SjhayCFLAGS+=-DFIXUP_BOOT_DRV
40183651Sjhay.endif
41183651Sjhay.if defined(DEBUG)
42183651SjhayCFLAGS+=-DDEBUG
43183651Sjhay.endif
44183651Sjhay
45183651Sjhayldscript.$M:	$S/conf/ldscript.$M
46183651Sjhay	cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \
47183651Sjhay	  sed s/KERNVIRTADDR/${KERNVIRTADDR}/g | \
48183651Sjhay	  sed s/" + SIZEOF_HEADERS"// > ldscript.$M
49183651Sjhay
50183651Sjhay${P}:	ldscript.$M
51183651Sjhay
52183651SjhayCLEANFILES+=ldscript.$M
53183651Sjhay
54183651Sjhaymemchr.c:	$S/../lib/libc/string/memchr.c
55183651Sjhay	sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memchr.c > \
56183651Sjhay	  ${.TARGET}
57183651Sjhay
58183651Sjhaymemmem.c:	$S/../lib/libc/string/memmem.c
59183651Sjhay	sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memmem.c > \
60183651Sjhay	  ${.TARGET}
61183651Sjhay
62183651SjhayCLEANFILES+=memchr.c memmem.c
63183651Sjhay
64183651Sjhayashldi3.o:	$S/libkern/ashldi3.c
65183669Ssam	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
66183651Sjhay
67183651Sjhaydivsi3.o:	$S/libkern/${M}/divsi3.S
68183669Ssam	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
69183651Sjhay
70183651Sjhaymuldi3.o:	$S/libkern/${M}/muldi3.c
71183669Ssam	${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC}
72183651Sjhay
73183651Sjhayinflate.c:	$S/kern/inflate.c
74183651Sjhay	sed -e 's/extern void putstr (char/extern void putstr (const char/' < \
75183651Sjhay	    $S/kern/inflate.c > ${.TARGET}
76183651Sjhay
77183651SjhayCLEANFILES+=inflate.c
78183651Sjhay
79183651Sjhay.include <bsd.prog.mk>
80183651Sjhay
81