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