Toomas Soome | 199767f | 2015-10-25 00:06:51 +0300 | [diff] [blame^] | 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. |
| 13 | FIXUP_BOOT_DRV=yes |
| 14 | |
| 15 | P=boot2 |
| 16 | FILES=${P} |
| 17 | SRCS=arm_init.S boot2.c ${BOOT_FLAVOR:tl}_board.c |
| 18 | SRCS+=memchr.c memcmp.c memcpy.c memmem.c memset.c printf.c strcmp.c strcpy.c |
| 19 | SRCS+=strlen.c ashldi3.c divsi3.S muldi3.c |
| 20 | SRCS+=aeabi_unwind.c |
| 21 | MAN= |
| 22 | |
| 23 | KERNPHYSADDR=0x180000 |
| 24 | KERNVIRTADDR=${KERNPHYSADDR} |
| 25 | BOOT_STACK=0x200000-4 |
| 26 | M=${MACHINE} |
| 27 | LDFLAGS=-e ${KERNPHYSADDR} -EB -T ldscript.${M} |
| 28 | OBJS+= ${SRCS:N*.h:R:S/$/.o/g} |
| 29 | S=${.CURDIR}/../../../.. |
| 30 | |
| 31 | CFLAGS+= \ |
| 32 | -DBOOT_STACK=${BOOT_STACK} \ |
| 33 | -I${.CURDIR}/../../../common \ |
| 34 | -I${.CURDIR} |
| 35 | |
| 36 | .if defined(FIXUP_BOOT_DRV) |
| 37 | CFLAGS+=-DFIXUP_BOOT_DRV |
| 38 | .endif |
| 39 | .if defined(DEBUG) |
| 40 | CFLAGS+=-DDEBUG |
| 41 | .endif |
| 42 | |
| 43 | ldscript.$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 | |
| 50 | CLEANFILES+=ldscript.$M |
| 51 | |
| 52 | memchr.c: $S/../lib/libc/string/memchr.c |
| 53 | sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memchr.c > \ |
| 54 | ${.TARGET} |
| 55 | |
| 56 | memmem.c: $S/../lib/libc/string/memmem.c |
| 57 | sed -e 's/string\.h/lib.h/' < $S/../lib/libc/string/memmem.c > \ |
| 58 | ${.TARGET} |
| 59 | |
| 60 | CLEANFILES+=memchr.c memmem.c |
| 61 | |
| 62 | ashldi3.o: $S/libkern/ashldi3.c |
| 63 | ${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC} |
| 64 | |
| 65 | divsi3.o: $S/libkern/${M}/divsi3.S |
| 66 | ${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC} |
| 67 | |
| 68 | muldi3.o: $S/libkern/${M}/muldi3.c |
| 69 | ${CC} -c ${CFLAGS} -D_KERNEL -o ${.TARGET} ${.IMPSRC} |
| 70 | |
| 71 | inflate.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 | |
| 75 | CLEANFILES+=inflate.c |
| 76 | |
| 77 | .include <bsd.prog.mk> |
| 78 | |