2004-05-14 11:49:40 +00:00
|
|
|
# Makefile.arm -- with config changes.
|
|
|
|
# Copyright 1990 W. Jolitz
|
|
|
|
# from: @(#)Makefile.i386 7.1 5/10/91
|
|
|
|
#
|
|
|
|
# Makefile for FreeBSD
|
|
|
|
#
|
|
|
|
# This makefile is constructed from a machine description:
|
|
|
|
# config machineid
|
|
|
|
# Most changes should be made in the machine description
|
2004-09-23 22:47:57 +00:00
|
|
|
# /sys/arm/conf/``machineid''
|
2004-05-14 11:49:40 +00:00
|
|
|
# after which you should do
|
|
|
|
# config machineid
|
|
|
|
# Generic makefile changes should be made in
|
2004-09-23 22:47:57 +00:00
|
|
|
# /sys/conf/Makefile.arm
|
2004-05-14 11:49:40 +00:00
|
|
|
# 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= 600013
|
2004-05-14 11:49:40 +00:00
|
|
|
|
|
|
|
STD8X16FONT?= iso
|
|
|
|
|
|
|
|
.if !defined(S)
|
|
|
|
.if exists(./@/.)
|
|
|
|
S= ./@
|
|
|
|
.else
|
|
|
|
S= ../../..
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.include "$S/conf/kern.pre.mk"
|
|
|
|
|
2021-10-16 03:11:46 +00:00
|
|
|
INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include -I$$/dts/include
|
2010-06-13 13:28:53 +00:00
|
|
|
|
2021-01-15 14:28:46 +00:00
|
|
|
LINUX_DTS_VERSION!= awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts
|
2020-10-10 07:18:51 +00:00
|
|
|
CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\"
|
|
|
|
|
2021-03-31 21:04:55 +00:00
|
|
|
.if !defined(DEBUG)
|
2005-12-05 12:55:46 +00:00
|
|
|
STRIP_FLAGS = -S
|
2005-06-27 14:33:32 +00:00
|
|
|
.endif
|
2005-10-03 14:09:58 +00:00
|
|
|
|
2014-05-10 16:38:09 +00:00
|
|
|
# We don't support gcc's thump interwork stuff, so disable it
|
|
|
|
CFLAGS.gcc += -mno-thumb-interwork
|
2013-01-23 07:27:38 +00:00
|
|
|
|
2014-10-06 09:52:28 +00:00
|
|
|
# We generally don't want fpu instructions in the kernel.
|
|
|
|
CFLAGS.clang += -mfpu=none
|
|
|
|
|
2014-10-01 08:26:51 +00:00
|
|
|
.if !empty(DDB_ENABLED)
|
2013-01-19 22:08:16 +00:00
|
|
|
CFLAGS += -funwind-tables
|
2006-07-24 22:09:47 +00:00
|
|
|
.endif
|
|
|
|
|
2017-12-30 00:20:49 +00:00
|
|
|
# "makeoptions KERNVIRTADDR=" is now optional, supply the default value.
|
|
|
|
.if empty(KERNVIRTADDR)
|
|
|
|
KERNVIRTADDR= 0xc0000000
|
|
|
|
.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} \
|
2019-12-30 23:20:46 +00:00
|
|
|
--defsym='text_start=kernbase + SIZEOF_HEADERS' \
|
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
|
|
|
-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} \
|
2019-12-30 23:20:46 +00:00
|
|
|
--defsym='text_start=kernbase' \
|
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
|
|
|
-o ${.TARGET} ${SYSTEM_OBJS} vers.o
|
|
|
|
${SIZE} ${.TARGET}
|
|
|
|
@${OBJCOPY} \
|
|
|
|
--wildcard \
|
|
|
|
--strip-symbol='$$[adt]*' \
|
|
|
|
--output-target=binary \
|
|
|
|
${.TARGET}
|
|
|
|
@chmod 755 ${.TARGET}
|
|
|
|
|
2014-01-31 01:34:55 +00:00
|
|
|
# hack because genassym.c includes sys/bus.h which includes these.
|
|
|
|
genassym.o: bus_if.h device_if.h
|
|
|
|
|
2004-05-14 11:49:40 +00:00
|
|
|
%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
|
2019-07-27 17:24:19 +00:00
|
|
|
|
2004-05-14 11:49:40 +00:00
|
|
|
%RULES
|
|
|
|
|
|
|
|
.include "$S/conf/kern.post.mk"
|