178b36e3cSOlivier Houchard# Makefile.arm -- with config changes. 278b36e3cSOlivier Houchard# Copyright 1990 W. Jolitz 378b36e3cSOlivier Houchard# Makefile for FreeBSD 478b36e3cSOlivier Houchard# 578b36e3cSOlivier Houchard# This makefile is constructed from a machine description: 678b36e3cSOlivier Houchard# config machineid 778b36e3cSOlivier Houchard# Most changes should be made in the machine description 8332d16a1SOlivier Houchard# /sys/arm/conf/``machineid'' 978b36e3cSOlivier Houchard# after which you should do 1078b36e3cSOlivier Houchard# config machineid 1178b36e3cSOlivier Houchard# Generic makefile changes should be made in 12332d16a1SOlivier Houchard# /sys/conf/Makefile.arm 1378b36e3cSOlivier Houchard# after which config should be rerun for all machines. 1478b36e3cSOlivier Houchard# 1578b36e3cSOlivier Houchard 1678b36e3cSOlivier Houchard# Which version of config(8) is required. 17e47edf50SKyle Evans%VERSREQ= 600013 1878b36e3cSOlivier Houchard 1978b36e3cSOlivier HouchardSTD8X16FONT?= iso 2078b36e3cSOlivier Houchard 2178b36e3cSOlivier Houchard.if !defined(S) 2278b36e3cSOlivier Houchard.if exists(./@/.) 2378b36e3cSOlivier HouchardS= ./@ 2478b36e3cSOlivier Houchard.else 2578b36e3cSOlivier HouchardS= ../../.. 2678b36e3cSOlivier Houchard.endif 2778b36e3cSOlivier Houchard.endif 2878b36e3cSOlivier Houchard.include "$S/conf/kern.pre.mk" 2978b36e3cSOlivier Houchard 308ce3e489SDimitry AndricINCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include -I$S/dts/include 31db5ef4fcSRafal Jaworowski 32efdf8079SEmmanuel VadotLINUX_DTS_VERSION!= awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts 334a63c1c1SEmmanuel VadotCFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\" 344a63c1c1SEmmanuel Vadot 35aa3ea612SKonstantin Belousov.if !defined(DEBUG) 36d0cd9702SOlivier HouchardSTRIP_FLAGS = -S 3763825b2fSOlivier Houchard.endif 387141c0d3SOlivier Houchard 3922ba0b2fSWarner Losh# We don't support gcc's thump interwork stuff, so disable it 4022ba0b2fSWarner LoshCFLAGS.gcc += -mno-thumb-interwork 418f197f15SAndrew Turner 429677c48eSAndrew Turner# We generally don't want fpu instructions in the kernel. 439677c48eSAndrew TurnerCFLAGS.clang += -mfpu=none 449677c48eSAndrew Turner 456d4766c1SAndrew Turner.if !empty(DDB_ENABLED) 46b56c0c67SAndrew TurnerCFLAGS += -funwind-tables 472371afbfSOlivier Houchard.endif 482371afbfSOlivier Houchard 492d09b072SIan Lepore# "makeoptions KERNVIRTADDR=" is now optional, supply the default value. 502d09b072SIan Lepore.if empty(KERNVIRTADDR) 512d09b072SIan LeporeKERNVIRTADDR= 0xc0000000 522d09b072SIan Lepore.endif 532d09b072SIan Lepore 5431333ebbSIan Lepore# Use a custom SYSTEM_LD command to generate the elf kernel, so we can 5531333ebbSIan Lepore# set the text segment start address, and also strip the "arm mapping 5631333ebbSIan Lepore# symbols" which have names like $a.0 and $d.2; see the document 5731333ebbSIan Lepore# "ELF for the ARM architecture" for more info on the mapping symbols. 5831333ebbSIan LeporeSYSTEM_LD= \ 5931333ebbSIan Lepore ${SYSTEM_LD_BASECMD} \ 60140da6f8SIan Lepore --defsym='text_start=kernbase + SIZEOF_HEADERS' \ 6131333ebbSIan Lepore -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \ 6231333ebbSIan Lepore $(OBJCOPY) \ 6331333ebbSIan Lepore --wildcard \ 6431333ebbSIan Lepore --strip-symbol='$$[adt]*' \ 6531333ebbSIan Lepore ${.TARGET} 6631333ebbSIan Lepore 6778b36e3cSOlivier Houchard%BEFORE_DEPEND 6878b36e3cSOlivier Houchard 6978b36e3cSOlivier Houchard%OBJS 7078b36e3cSOlivier Houchard 7178b36e3cSOlivier Houchard%FILES.c 7278b36e3cSOlivier Houchard 7378b36e3cSOlivier Houchard%FILES.s 7478b36e3cSOlivier Houchard 7578b36e3cSOlivier Houchard%FILES.m 7678b36e3cSOlivier Houchard 7778b36e3cSOlivier Houchard%CLEAN 7878b36e3cSOlivier Houchard 7978b36e3cSOlivier Houchard%RULES 8078b36e3cSOlivier Houchard 8178b36e3cSOlivier Houchard.include "$S/conf/kern.post.mk" 82*ba045ba4SMichal Meloun 83*ba045ba4SMichal Meloun# Generate the .bin (no elf headers) kernel 84*ba045ba4SMichal Meloun# Copy the kernel to directly executable format (the elf headers are 85*ba045ba4SMichal Meloun# stripped and a binary head blob with jump to kernel start address is 86*ba045ba4SMichal Meloun# prepended), saving the output in a temp file. 87*ba045ba4SMichal Meloun# We also strip arm "marker" symbols which are used only by elf toolchains. Read 88*ba045ba4SMichal Meloun# the symbols from kernel.full and pass them to arm_kernel_boothdr.awk, which 89*ba045ba4SMichal Meloun# generates a binary header blob that goes on the front of the stripped kernel. 90*ba045ba4SMichal Meloun# Cat the header blob and the temp file together to make the kernel.bin file. 91*ba045ba4SMichal Meloun${KERNEL_KO}.bin: ${FULLKERNEL} 92*ba045ba4SMichal Meloun @${OBJCOPY} --wildcard --strip-symbol='$$[adtx]*' \ 93*ba045ba4SMichal Meloun --output-target=binary ${FULLKERNEL} ${.TARGET}.temp 94*ba045ba4SMichal Meloun @{ ${NM} ${FULLKERNEL} | \ 95*ba045ba4SMichal Meloun LC_ALL=C \ 96*ba045ba4SMichal Meloun ${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v7jump && \ 97*ba045ba4SMichal Meloun cat ${.TARGET}.temp; \ 98*ba045ba4SMichal Meloun } > ${.TARGET} 99*ba045ba4SMichal Meloun @rm ${.TARGET}.temp 100*ba045ba4SMichal Meloun @echo "created ${.TARGET} from ${.ALLSRC}" 101