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