1# Makefile.arm -- with config changes.
2# Copyright 1990 W. Jolitz
3# Makefile for FreeBSD
4#
5# This makefile is constructed from a machine description:
6#	config machineid
7# Most changes should be made in the machine description
8#	/sys/arm/conf/``machineid''
9# after which you should do
10#	 config machineid
11# Generic makefile changes should be made in
12#	/sys/conf/Makefile.arm
13# after which config should be rerun for all machines.
14#
15
16# Which version of config(8) is required.
17%VERSREQ=	600013
18
19STD8X16FONT?=	iso
20
21.if !defined(S)
22.if exists(./@/.)
23S=	./@
24.else
25S=	../../..
26.endif
27.endif
28.include "$S/conf/kern.pre.mk"
29
30INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include -I$$/dts/include
31
32LINUX_DTS_VERSION!=	awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts
33CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\"
34
35.if !defined(DEBUG)
36STRIP_FLAGS = -S
37.endif
38
39# We don't support gcc's thump interwork stuff, so disable it
40CFLAGS.gcc += -mno-thumb-interwork
41
42# We generally don't want fpu instructions in the kernel.
43CFLAGS.clang += -mfpu=none
44
45.if !empty(DDB_ENABLED)
46CFLAGS += -funwind-tables
47.endif
48
49# "makeoptions KERNVIRTADDR=" is now optional, supply the default value.
50.if empty(KERNVIRTADDR)
51KERNVIRTADDR= 0xc0000000
52.endif
53
54# Use a custom SYSTEM_LD command to generate the elf kernel, so we can
55# set the text segment start address, and also strip the "arm mapping
56# symbols" which have names like $a.0 and $d.2; see the document
57# "ELF for the ARM architecture" for more info on the mapping symbols.
58SYSTEM_LD= \
59	${SYSTEM_LD_BASECMD} \
60	    --defsym='text_start=kernbase + SIZEOF_HEADERS' \
61	    -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \
62	$(OBJCOPY) \
63	    --wildcard \
64	    --strip-symbol='$$[adt]*' \
65	    ${.TARGET}
66
67# Generate the .bin (no elf headers) kernel as an extra build output.
68# We must relink to generate the .bin kernel, because without headers the
69# location of everything changes.  We also strip the ARM marker symbols.
70${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o
71	@echo "linking ${.TARGET}"
72	@${SYSTEM_LD_BASECMD} \
73	    --defsym='text_start=kernbase' \
74	    -o ${.TARGET} ${SYSTEM_OBJS} vers.o
75	${SIZE} ${.TARGET}
76	@${OBJCOPY} \
77	    --wildcard \
78	    --strip-symbol='$$[adt]*' \
79	    --output-target=binary \
80	    ${.TARGET}
81	@chmod 755 ${.TARGET}
82
83# hack because genassym.c includes sys/bus.h which includes these.
84genassym.o: bus_if.h device_if.h
85
86%BEFORE_DEPEND
87
88%OBJS
89
90%FILES.c
91
92%FILES.s
93
94%FILES.m
95
96%CLEAN
97
98%RULES
99	
100.include "$S/conf/kern.post.mk"
101