Integrate device-tree upstream files into the build process:

(1) Invoke cpp to bring in files via #include (although the old
    /include/ stuff is supported still).
(2) bring in files from either vendor tree or freebsd-custom files
    when building.
(3) move all dts* files from sys/boot/fdt/dts to
    sys/boot/fdt/dts/${MACHINE} as appropriate.
(4) encode all the magic to do the build in sys/tools/fdt/make_dtb.sh
    so that the different places in the tree use the exact same logic.
(5) switch back to gpl dtc by default. the bsdl one in the tree has
    significant issues not easily addressed by those unfamiliar with
    the code.
This commit is contained in:
imp 2014-02-28 18:29:09 +00:00
parent 65a6006c96
commit 7c37cf4f64
60 changed files with 21 additions and 9 deletions

View File

@ -1262,7 +1262,7 @@ _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
.endif
# Default to building the BSDL DTC, but build the GPL one if users explicitly
# Default to building the GPL DTC, but build the BSDL one if users explicitly
# request it.
_dtc= usr.bin/dtc
.if ${MK_GPL_DTC} != "no"
@ -1853,7 +1853,7 @@ builddtb:
echo "ERROR: FDT_DTS_FILE must be specified!"; \
exit 1; \
fi; \
if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${MACHINE}/${FDT_DTS_FILE} ]; then \
echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
exist!"; \
exit 1; \
@ -1863,9 +1863,9 @@ builddtb:
directory"; \
fi
@PATH=${TMPPATH} \
dtc -O dtb -o \
${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
-p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
${FDT_DTS_FILE} \
${DTBOUTPUTPATH}/`basename ${FDT_DTS_FILE} .dts`
###############

View File

@ -287,6 +287,7 @@ __DEFAULT_YES_OPTIONS = \
GNU \
GPIB \
GPIO \
GPL_DTC \
GROFF \
HTML \
ICONV \
@ -368,7 +369,6 @@ __DEFAULT_NO_OPTIONS = \
CLANG_EXTRAS \
CTF \
DEBUG_FILES \
GPL_DTC \
HESIOD \
INSTALL_AS_USER \
LLDB \

View File

@ -14,11 +14,12 @@ acpi_quirks.h optional acpi \
# from the specified source (DTS) file: <platform>.dts -> <platform>.dtb
#
fdt_dtb_file optional fdt \
compile-with "if [ -f $S/boot/fdt/dts/${FDT_DTS_FILE} ]; then dtc -O dtb -o ${FDT_DTS_FILE:R}.dtb -b 0 -p 1024 $S/boot/fdt/dts/${FDT_DTS_FILE}; fi" \
compile-with "sh $S/tools/fdt/make_dtb.sh $S ${FDT_DTS_FILE} ${.CURDIR}/${FDT_DTS_FILE:R}.dtb" \
no-obj no-implicit-rule before-depend \
clean "${FDT_DTS_FILE:R}.dtb"
fdt_static_dtb.h optional fdt fdt_dtb_static \
compile-with "sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ." \
compile-with "sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ${.CURDIR}" \
dependency "fdt_dtb_file" \
no-obj no-implicit-rule before-depend \
clean "fdt_static_dtb.h"
feeder_eq_gen.h optional sound \
@ -1370,7 +1371,7 @@ dev/fb/splash.c optional sc splash
dev/fdt/fdt_common.c optional fdt
dev/fdt/fdt_slicer.c optional fdt cfi | fdt nand
dev/fdt/fdt_static_dtb.S optional fdt fdt_dtb_static \
dependency "$S/boot/fdt/dts/${FDT_DTS_FILE}"
dependency "$S/boot/fdt/dts/${MACHINE}/${FDT_DTS_FILE}"
dev/fdt/simplebus.c optional fdt
dev/fe/if_fe.c optional fe
dev/fe/if_fe_pccard.c optional fe pccard

11
sys/tools/fdt/make_dtb.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
#
# $FreeBSD$
# Script generates dtb file ($3) from dts source ($2) in build tree S ($1)
S=$1
dts=$2
dtb=$3
cpp -x assembler-with-cpp -I $S/gnu/dts/include -I $S/boot/fdt/dts/${MACHINE} -I $S/gnu/dts/${MACHINE} -include $dts /dev/null |
dtc -O dtb -o $dtb -b 0 -p 1024 -i $S/boot/fdt/dts -i $S/gnu/dts/${MACHINE}