]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/conf/Makefile.arm64
Allow the extres regulator code to build without FDT
[FreeBSD/FreeBSD.git] / sys / conf / Makefile.arm64
1 # Makefile.arm64 -- with config changes.
2 # Copyright 1990 W. Jolitz
3 #       from: @(#)Makefile.i386 7.1 5/10/91
4 #       from FreeBSD: src/sys/conf/Makefile.i386,v 1.255 2002/02/20 23:35:49
5 # $FreeBSD$
6 #
7 # Makefile for FreeBSD
8 #
9 # This makefile is constructed from a machine description:
10 #       config machineid
11 # Most changes should be made in the machine description
12 #       /sys/arm64/conf/``machineid''
13 # after which you should do
14 #        config machineid
15 # Generic makefile changes should be made in
16 #       /sys/conf/Makefile.arm64
17 # after which config should be rerun for all machines.
18 #
19
20 # Which version of config(8) is required.
21 %VERSREQ=       600012
22
23 .if !defined(S)
24 S=      ../../..
25 .endif
26 .include "$S/conf/kern.pre.mk"
27
28 INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include
29
30 LINUX_DTS_VERSION!=     awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts
31 CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\"
32
33 PERTHREAD_SSP_ENABLED!= grep PERTHREAD_SSP opt_global.h || true ; echo
34 .if !empty(PERTHREAD_SSP_ENABLED)
35 . if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 130000
36 ARM64_SSP_CFLAGS = -mstack-protector-guard=sysreg
37 ARM64_SSP_CFLAGS += -mstack-protector-guard-reg=sp_el0
38 ARM64_SSP_CFLAGS += -mstack-protector-guard-offset=0
39 . else
40 ARM64_SSP_CFLAGS += -DPERTHREAD_SSP_WARNING
41 .  warning "Compiler is too old to support PERTHREAD_SSP"
42 . endif
43 CFLAGS += ${ARM64_SSP_CFLAGS}
44 ARCH_FLAGS += ${ARM64_SSP_CFLAGS}
45 .endif
46
47 # Use a custom SYSTEM_LD command to generate the elf kernel, so we can
48 # set the text segment start address, and also strip the "arm mapping
49 # symbols" which have names like $a.0 and $d.2; see the document
50 # "ELF for the ARM architecture" for more info on the mapping symbols.
51 SYSTEM_LD= \
52         ${SYSTEM_LD_BASECMD} \
53             --defsym='text_start=kernbase + SIZEOF_HEADERS' \
54             -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \
55         $(OBJCOPY) \
56             --wildcard \
57             --strip-symbol='$$[adtx]*' \
58             ${.TARGET}
59
60 # Generate the .bin (booti images) kernel as an extra build output.
61 # The targets and rules to generate these appear near the end of the file.
62 KERNEL_EXTRA+= ${KERNEL_KO}.bin
63 KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
64
65 .if !empty(DDB_ENABLED) || !empty(DTR_ENABLED) || !empty(HWPMC_ENABLED)
66 CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
67 .endif
68
69 %BEFORE_DEPEND
70
71 %OBJS
72
73 %FILES.c
74
75 %FILES.s
76
77 %FILES.m
78
79 %CLEAN
80 CLEAN+= ${KERNEL_KO}.bin
81
82 %RULES
83
84 .include "$S/conf/kern.post.mk"
85
86 # Create a kernel.bin file...
87 # Copy the kernel to u-boot's booti image format (the elf headers are
88 # stripped and a custom binary head blob is prepended), saving the
89 # output in a temp file.  We also strip arm "marker" symbols which are
90 # used only by elf toolchains.  Read the symbols from kernel.full and pass
91 # them to arm_kernel_boothdr.awk, which generates a binary header blob
92 # that goes on the front of the stripped kernel.  Cat the header blob
93 # and the temp file together to make the kernel.bin file.
94 ${KERNEL_KO}.bin: ${FULLKERNEL}
95         @${OBJCOPY} --wildcard --strip-symbol='$$[adtx]*' \
96             --output-target=binary ${.ALLSRC} ${.TARGET}.temp
97         @{ ${NM} ${.ALLSRC} | \
98             ${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v8booti && \
99             cat ${.TARGET}.temp; \
100          } > ${.TARGET}
101         @rm ${.TARGET}.temp
102         @echo "created ${.TARGET} from ${.ALLSRC}"