xref: /freebsd/sys/conf/Makefile.arm (revision edf8578117e8844e02c0121147f45e4609b30680)
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.
72KERNEL_EXTRA+= ${KERNEL_KO}.bin
73KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
74
75${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o
76	@echo "linking ${.TARGET}"
77	@${SYSTEM_LD_BASECMD} \
78	    --defsym='text_start=kernbase' \
79	    -o ${.TARGET} ${SYSTEM_OBJS} vers.o
80	${SIZE} ${.TARGET}
81	@${OBJCOPY} \
82	    --wildcard \
83	    --strip-symbol='$$[adt]*' \
84	    --output-target=binary \
85	    ${.TARGET}
86	@chmod 755 ${.TARGET}
87
88# hack because genassym.c includes sys/bus.h which includes these.
89genassym.o: bus_if.h device_if.h
90
91%BEFORE_DEPEND
92
93%OBJS
94
95%FILES.c
96
97%FILES.s
98
99%FILES.m
100
101%CLEAN
102
103CLEAN+=	${KERNEL_KO}.bin
104
105%RULES
106
107.include "$S/conf/kern.post.mk"
108