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