2015-04-13 14:43:10 +00:00
|
|
|
# Makefile.arm64 -- with config changes.
|
|
|
|
# Copyright 1990 W. Jolitz
|
|
|
|
# from: @(#)Makefile.i386 7.1 5/10/91
|
|
|
|
# from FreeBSD: src/sys/conf/Makefile.i386,v 1.255 2002/02/20 23:35:49
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# Makefile for FreeBSD
|
|
|
|
#
|
|
|
|
# This makefile is constructed from a machine description:
|
|
|
|
# config machineid
|
|
|
|
# Most changes should be made in the machine description
|
|
|
|
# /sys/arm64/conf/``machineid''
|
|
|
|
# after which you should do
|
|
|
|
# config machineid
|
|
|
|
# Generic makefile changes should be made in
|
|
|
|
# /sys/conf/Makefile.arm64
|
|
|
|
# after which config should be rerun for all machines.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Which version of config(8) is required.
|
2018-07-17 14:11:30 +00:00
|
|
|
%VERSREQ= 600012
|
2015-04-13 14:43:10 +00:00
|
|
|
|
|
|
|
.if !defined(S)
|
|
|
|
S= ../../..
|
|
|
|
.endif
|
|
|
|
.include "$S/conf/kern.pre.mk"
|
|
|
|
|
2021-01-15 14:28:46 +00:00
|
|
|
INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include
|
2015-04-13 14:43:10 +00:00
|
|
|
|
2021-03-23 14:24:14 +00:00
|
|
|
LINUX_DTS_VERSION!= awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts
|
|
|
|
CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\"
|
|
|
|
|
2021-11-22 15:20:51 +00:00
|
|
|
PERTHREAD_SSP_ENABLED!= grep PERTHREAD_SSP opt_global.h || true ; echo
|
|
|
|
.if !empty(PERTHREAD_SSP_ENABLED)
|
|
|
|
. if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 130000
|
|
|
|
ARM64_SSP_CFLAGS = -mstack-protector-guard=sysreg
|
|
|
|
ARM64_SSP_CFLAGS += -mstack-protector-guard-reg=sp_el0
|
|
|
|
ARM64_SSP_CFLAGS += -mstack-protector-guard-offset=0
|
|
|
|
. else
|
|
|
|
ARM64_SSP_CFLAGS += -DPERTHREAD_SSP_WARNING
|
|
|
|
. warning "Compiler is too old to support PERTHREAD_SSP"
|
|
|
|
. endif
|
|
|
|
CFLAGS += ${ARM64_SSP_CFLAGS}
|
|
|
|
ARCH_FLAGS += ${ARM64_SSP_CFLAGS}
|
|
|
|
.endif
|
|
|
|
|
Eliminate the generated ldscript for arm and arm64, and strip $a/$d marker
symbols from the linked kernel.
The main thrust of this change is to generate a kernel that has the arm
"marker" symbols stripped. Marker symbols start with $a, $d, $t or $x, and
are emitted by the compiler to tell other toolchain components about the
locations of data embedded in the instruction stream (literal-pool
stuff). They are used for generating mixed-endian binaries (which we don't
support). The linked kernel has approximately 21,000 such symbols in it,
wasting space (500K in kernel.full, 190K in the final linked kernel), and
sometimes obscuring function names in stack tracebacks.
This change also simplifies the way the kernel is linked. Instead of using
sed to generate two different ldscript files to generate both an elf kernel
and a binary (elf headers stripped) kernel, we now use a single ldscript
that refers to a "text_start" symbol, and we provide the value for that
symbol using --defsym on the linker command line.
2019-12-29 18:17:12 +00:00
|
|
|
# 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='$$[adtx]*' \
|
|
|
|
${.TARGET}
|
|
|
|
|
2020-12-25 18:48:33 +00:00
|
|
|
# Generate the .bin (booti images) kernel as an extra build output.
|
|
|
|
# The targets and rules to generate these appear near the end of the file.
|
Eliminate the generated ldscript for arm and arm64, and strip $a/$d marker
symbols from the linked kernel.
The main thrust of this change is to generate a kernel that has the arm
"marker" symbols stripped. Marker symbols start with $a, $d, $t or $x, and
are emitted by the compiler to tell other toolchain components about the
locations of data embedded in the instruction stream (literal-pool
stuff). They are used for generating mixed-endian binaries (which we don't
support). The linked kernel has approximately 21,000 such symbols in it,
wasting space (500K in kernel.full, 190K in the final linked kernel), and
sometimes obscuring function names in stack tracebacks.
This change also simplifies the way the kernel is linked. Instead of using
sed to generate two different ldscript files to generate both an elf kernel
and a binary (elf headers stripped) kernel, we now use a single ldscript
that refers to a "text_start" symbol, and we provide the value for that
symbol using --defsym on the linker command line.
2019-12-29 18:17:12 +00:00
|
|
|
KERNEL_EXTRA+= ${KERNEL_KO}.bin
|
|
|
|
KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
|
|
|
|
|
2023-01-03 17:54:15 +00:00
|
|
|
.if !empty(DDB_ENABLED) || !empty(DTRACE_ENABLED) || !empty(HWPMC_ENABLED)
|
2015-04-13 14:43:10 +00:00
|
|
|
CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
|
|
|
|
.endif
|
|
|
|
|
|
|
|
%BEFORE_DEPEND
|
|
|
|
|
|
|
|
%OBJS
|
|
|
|
|
|
|
|
%FILES.c
|
|
|
|
|
|
|
|
%FILES.s
|
|
|
|
|
|
|
|
%FILES.m
|
|
|
|
|
|
|
|
%CLEAN
|
Eliminate the generated ldscript for arm and arm64, and strip $a/$d marker
symbols from the linked kernel.
The main thrust of this change is to generate a kernel that has the arm
"marker" symbols stripped. Marker symbols start with $a, $d, $t or $x, and
are emitted by the compiler to tell other toolchain components about the
locations of data embedded in the instruction stream (literal-pool
stuff). They are used for generating mixed-endian binaries (which we don't
support). The linked kernel has approximately 21,000 such symbols in it,
wasting space (500K in kernel.full, 190K in the final linked kernel), and
sometimes obscuring function names in stack tracebacks.
This change also simplifies the way the kernel is linked. Instead of using
sed to generate two different ldscript files to generate both an elf kernel
and a binary (elf headers stripped) kernel, we now use a single ldscript
that refers to a "text_start" symbol, and we provide the value for that
symbol using --defsym on the linker command line.
2019-12-29 18:17:12 +00:00
|
|
|
CLEAN+= ${KERNEL_KO}.bin
|
2015-04-13 14:43:10 +00:00
|
|
|
|
|
|
|
%RULES
|
|
|
|
|
|
|
|
.include "$S/conf/kern.post.mk"
|
2020-12-25 18:48:33 +00:00
|
|
|
|
|
|
|
# Create a kernel.bin file...
|
|
|
|
# Copy the kernel to u-boot's booti image format (the elf headers are
|
|
|
|
# stripped and a custom binary head blob is prepended), saving the
|
|
|
|
# output in a temp file. We also strip arm "marker" symbols which are
|
|
|
|
# used only by elf toolchains. Read the symbols from kernel.full and pass
|
|
|
|
# them to arm_kernel_boothdr.awk, which generates a binary header blob
|
|
|
|
# that goes on the front of the stripped kernel. Cat the header blob
|
|
|
|
# and the temp file together to make the kernel.bin file.
|
|
|
|
${KERNEL_KO}.bin: ${FULLKERNEL}
|
|
|
|
@${OBJCOPY} --wildcard --strip-symbol='$$[adtx]*' \
|
2023-01-20 02:07:38 +00:00
|
|
|
--output-target=binary ${FULLKERNEL} ${.TARGET}.temp
|
|
|
|
@{ ${NM} ${FULLKERNEL} | \
|
2020-12-25 18:48:33 +00:00
|
|
|
${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v8booti && \
|
|
|
|
cat ${.TARGET}.temp; \
|
|
|
|
} > ${.TARGET}
|
|
|
|
@rm ${.TARGET}.temp
|
|
|
|
@echo "created ${.TARGET} from ${.ALLSRC}"
|