HardenedBSD/sys/conf/Makefile.arm
2024-11-09 08:31:14 +01:00

104 lines
2.8 KiB
Makefile

# Makefile.arm -- with config changes.
# Copyright 1990 W. Jolitz
# 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 -I$S/dts/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)
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}
# 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
%RULES
.include "$S/conf/kern.post.mk"
# Generate the .bin (no elf headers) kernel
# Copy the kernel to directly executable format (the elf headers are
# stripped and a binary head blob with jump to kernel start address 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]*' \
--output-target=binary ${FULLKERNEL} ${.TARGET}.temp
@{ ${NM} ${FULLKERNEL} | \
LC_ALL=C \
${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v7jump && \
cat ${.TARGET}.temp; \
} > ${.TARGET}
@rm ${.TARGET}.temp
@echo "created ${.TARGET} from ${.ALLSRC}"