1 # Makefile.arm64 -- with config changes.
2 # Copyright 1990 W. Jolitz
3 # from: @(#)Makefile.i386 7.1 5/10/91
4 # from FreeBSD: src/sys/conf/Makefile.i386,v 1.255 2002/02/20 23:35:49
9 # This makefile is constructed from a machine description:
11 # Most changes should be made in the machine description
12 # /sys/arm64/conf/``machineid''
13 # after which you should do
15 # Generic makefile changes should be made in
16 # /sys/conf/Makefile.arm64
17 # after which config should be rerun for all machines.
20 # Which version of config(8) is required.
26 .include "$S/conf/kern.pre.mk"
28 INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include
30 LINUX_DTS_VERSION!= awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts
31 CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\"
33 # Use a custom SYSTEM_LD command to generate the elf kernel, so we can
34 # set the text segment start address, and also strip the "arm mapping
35 # symbols" which have names like $a.0 and $d.2; see the document
36 # "ELF for the ARM architecture" for more info on the mapping symbols.
38 ${SYSTEM_LD_BASECMD} \
39 --defsym='text_start=kernbase + SIZEOF_HEADERS' \
40 -o ${.TARGET} ${SYSTEM_OBJS} vers.o; \
43 --strip-symbol='$$[adtx]*' \
46 # Generate the .bin (booti images) kernel as an extra build output.
47 # The targets and rules to generate these appear near the end of the file.
48 KERNEL_EXTRA+= ${KERNEL_KO}.bin
49 KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
51 .if !empty(DDB_ENABLED) || !empty(DTR_ENABLED) || !empty(HWPMC_ENABLED)
52 CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
66 CLEAN+= ${KERNEL_KO}.bin
70 .include "$S/conf/kern.post.mk"
72 # Create a kernel.bin file...
73 # Copy the kernel to u-boot's booti image format (the elf headers are
74 # stripped and a custom binary head blob is prepended), saving the
75 # output in a temp file. We also strip arm "marker" symbols which are
76 # used only by elf toolchains. Read the symbols from kernel.full and pass
77 # them to arm_kernel_boothdr.awk, which generates a binary header blob
78 # that goes on the front of the stripped kernel. Cat the header blob
79 # and the temp file together to make the kernel.bin file.
80 ${KERNEL_KO}.bin: ${FULLKERNEL}
81 @${OBJCOPY} --wildcard --strip-symbol='$$[adtx]*' \
82 --output-target=binary ${.ALLSRC} ${.TARGET}.temp
83 @{ readelf -s ${.ALLSRC} | \
84 ${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v8booti && \
85 cat ${.TARGET}.temp; \
88 @echo "created ${.TARGET} from ${.ALLSRC}"