summaryrefslogtreecommitdiffstats
path: root/Makefile.inc1
diff options
context:
space:
mode:
authorraj <raj@FreeBSD.org>2010-06-13 13:02:43 +0000
committerraj <raj@FreeBSD.org>2010-06-13 13:02:43 +0000
commitce1aea1edb43c51950b23e1cb369ad9367257781 (patch)
tree42ffebef2b23ca1dfafeee77b5d25bbb362407de /Makefile.inc1
parentd3177b8e82b0c47d89a166ebf47bae694c103b3e (diff)
downloadFreeBSD-src-ce1aea1edb43c51950b23e1cb369ad9367257781.zip
FreeBSD-src-ce1aea1edb43c51950b23e1cb369ad9367257781.tar.gz
Connect FDT infrastructure to the build system.
Reviewed by: imp Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'Makefile.inc1')
-rw-r--r--Makefile.inc141
1 files changed, 41 insertions, 0 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 2cbedd8..59b6629 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -968,6 +968,10 @@ _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
.endif
+.if ${MK_FDT} != "no"
+_dtc= gnu/usr.bin/dtc
+.endif
+
bootstrap-tools:
.for _tool in \
${_clang_tblgen} \
@@ -976,6 +980,7 @@ bootstrap-tools:
${_gperf} \
${_groff} \
${_ar} \
+ ${_dtc} \
usr.bin/lorder \
usr.bin/makewhatis \
${_mklocale} \
@@ -1448,3 +1453,39 @@ _xi-links:
../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
done
.endif
+
+.if !empty(KRNLOBJDIR) && !empty(KERNCONF)
+DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
+
+.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
+FDT_DTS_FILE!= grep "^makeoptions[[:space:]]\+FDT_DTS_FILE" \
+ ${KERNCONFDIR}/${KERNCONF} 2> /dev/null | cut -d= -f2
+.endif
+
+.endif
+
+.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
+DTBOUTPUTPATH= ${.CURDIR}
+.endif
+
+#
+# Build 'standalone' Device Tree Blob
+#
+builddtb:
+ @if [ "${FDT_DTS_FILE}" = "" ]; then \
+ echo "ERROR: FDT_DTS_FILE must be specified!"; \
+ exit 1; \
+ fi; \
+ if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
+ echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
+ exist!"; \
+ exit 1; \
+ fi; \
+ if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
+ echo "WARNING: DTB will be placed in the current working \
+ 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}
OpenPOWER on IntegriCloud