aboutsummaryrefslogtreecommitdiff
path: root/sys/conf/Makefile.arm
blob: 31dc542e8e6ce06fb0d31290be071901a765b94b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Makefile.arm -- with config changes.
# Copyright 1990 W. Jolitz
#	from: @(#)Makefile.i386	7.1 5/10/91
# $FreeBSD$
#
# Makefile for FreeBSD
#
# This makefile is constructed from a machine description:
#	config machineid
# Most changes should be made in the machine description
#	/sys/arm/conf/``machineid''
# after which you should do
#	 config machineid
# Generic makefile changes should be made in
#	/sys/conf/Makefile.arm
# after which config should be rerun for all machines.
#

# Which version of config(8) is required.
%VERSREQ=	600013

STD8X16FONT?=	iso

.if !defined(S)
.if exists(./@/.)
S=	./@
.else
S=	../../..
.endif
.endif
.include "$S/conf/kern.pre.mk"

INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include

LINUX_DTS_VERSION!=	awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts
CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\"

.if !defined(DEBUG) && !defined(PROFLEVEL)
STRIP_FLAGS = -S
.endif

# We don't support gcc's thump interwork stuff, so disable it
CFLAGS.gcc += -mno-thumb-interwork

# We generally don't want fpu instructions in the kernel.
CFLAGS.clang += -mfpu=none

.if !empty(DDB_ENABLED)
CFLAGS += -funwind-tables
.endif

# "makeoptions KERNVIRTADDR=" is now optional, supply the default value.
.if empty(KERNVIRTADDR)
KERNVIRTADDR= 0xc0000000
.endif

# Use a custom SYSTEM_LD command to generate the elf kernel, so we can
# set the text segment start address, and also strip the "arm mapping
# symbols" which have names like $a.0 and $d.2; see the document
# "ELF for the ARM architecture" for more info on the mapping symbols.
SYSTEM_LD= \
	${SYSTEM_LD_BASECMD} \
	    --defsym='text_start=kernbase + SIZEOF_HEADERS' \
	    -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \
	$(OBJCOPY) \
	    --wildcard \
	    --strip-symbol='$$[adt]*' \
	    ${.TARGET}

# Generate the .bin (no elf headers) kernel as an extra build output.
# We must relink to generate the .bin kernel, because without headers the
# location of everything changes.  We also strip the ARM marker symbols.
KERNEL_EXTRA+= ${KERNEL_KO}.bin
KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin

${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o
	@echo "linking ${.TARGET}"
	@${SYSTEM_LD_BASECMD} \
	    --defsym='text_start=kernbase' \
	    -o ${.TARGET} ${SYSTEM_OBJS} vers.o
	${SIZE} ${.TARGET}
	@${OBJCOPY} \
	    --wildcard \
	    --strip-symbol='$$[adt]*' \
	    --output-target=binary \
	    ${.TARGET}
	@chmod 755 ${.TARGET}

# hack because genassym.c includes sys/bus.h which includes these.
genassym.o: bus_if.h device_if.h

%BEFORE_DEPEND

%OBJS

%FILES.c

%FILES.s

%FILES.m

%CLEAN

CLEAN+=	${KERNEL_KO}.bin

%RULES
	
.include "$S/conf/kern.post.mk"