summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafal Jaworowski <raj@FreeBSD.org>2010-06-13 13:02:43 +0000
committerRafal Jaworowski <raj@FreeBSD.org>2010-06-13 13:02:43 +0000
commit3c5326bf4a1b17ffca34bc0d2c0f290beab092a2 (patch)
tree42ffebef2b23ca1dfafeee77b5d25bbb362407de
parent10e866760039d8807309999b53b0132f10fd73ea (diff)
downloadsrc-test2-3c5326bf4a1b17ffca34bc0d2c0f290beab092a2.tar.gz
src-test2-3c5326bf4a1b17ffca34bc0d2c0f290beab092a2.zip
Connect FDT infrastructure to the build system.
Reviewed by: imp Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=209128
-rw-r--r--Makefile3
-rw-r--r--Makefile.inc141
-rw-r--r--gnu/usr.bin/Makefile5
-rw-r--r--sys/conf/files24
4 files changed, 72 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index ce531244e5a3..5edb4dabda69 100644
--- a/Makefile
+++ b/Makefile
@@ -89,7 +89,8 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
obj objlink regress rerelease showconfig tags toolchain update \
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
_build-tools _cross-tools _includes _libraries _depend \
- build32 distribute32 install32 xdev xdev-build xdev-install
+ build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
+
TGTS+= ${SUBDIR_TARGETS}
BITGTS= files includes
diff --git a/Makefile.inc1 b/Makefile.inc1
index 2cbedd8aaf20..59b6629910f6 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}
diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile
index 17ee26ffd2fd..0a6d51fdcdf7 100644
--- a/gnu/usr.bin/Makefile
+++ b/gnu/usr.bin/Makefile
@@ -8,6 +8,7 @@ SUBDIR= ${_binutils} \
dialog \
diff \
diff3 \
+ ${_dtc} \
${_gdb} \
${_gperf} \
${_grep} \
@@ -31,6 +32,10 @@ _groff= groff
_cvs= cvs
.endif
+.if ${MK_FDT} != "no"
+_dtc= dtc
+.endif
+
.if ${MK_GNU_GREP} != "no"
_grep= grep
.endif
diff --git a/sys/conf/files b/sys/conf/files
index 0808e7f24e06..a749e110dbfd 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -55,6 +55,18 @@ emu10k1-alsa%diked.h optional snd_emu10k1 | snd_emu10kx \
compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \
no-obj no-implicit-rule before-depend \
clean "emu10k1-alsa%diked.h"
+#
+# The 'fdt_dtb_file' target covers an actual DTB file name, which is derived
+# 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 `echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 -p 1024 $S/boot/fdt/dts/${FDT_DTS_FILE}; fi" \
+ no-obj no-implicit-rule before-depend \
+ clean "`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb"
+fdt_static_dtb.h optional fdt fdt_dtb_static \
+ compile-with "sh $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ." \
+ no-obj no-implicit-rule before-depend \
+ clean "fdt_static_dtb.h"
p16v-alsa%diked.h optional snd_emu10kx pci \
dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h" \
compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h p16v-alsa%diked.h" \
@@ -302,6 +314,12 @@ contrib/ipfilter/netinet/ip_sync.c optional ipfilter inet \
compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
contrib/ipfilter/netinet/mlfk_ipl.c optional ipfilter inet \
compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
+contrib/libfdt/fdt.c optional fdt
+contrib/libfdt/fdt_ro.c optional fdt
+contrib/libfdt/fdt_rw.c optional fdt
+contrib/libfdt/fdt_strerror.c optional fdt
+contrib/libfdt/fdt_sw.c optional fdt
+contrib/libfdt/fdt_wip.c optional fdt
contrib/ngatm/netnatm/api/cc_conn.c optional ngatm_ccatm \
compile-with "${NORMAL_C_NOWERROR} -I$S/contrib/ngatm"
contrib/ngatm/netnatm/api/cc_data.c optional ngatm_ccatm \
@@ -961,6 +979,11 @@ dev/ex/if_ex_pccard.c optional ex pccard
dev/exca/exca.c optional cbb
dev/fatm/if_fatm.c optional fatm pci
dev/fb/splash.c optional splash
+dev/fdt/fdt_common.c optional fdt
+dev/fdt/fdt_pci.c optional fdt pci
+dev/fdt/fdt_static_dtb.S optional fdt fdt_dtb_static
+dev/fdt/fdtbus.c optional fdt
+dev/fdt/simplebus.c optional fdt
dev/fe/if_fe.c optional fe
dev/fe/if_fe_pccard.c optional fe pccard
dev/firewire/firewire.c optional firewire
@@ -1659,6 +1682,7 @@ dev/txp/if_txp.c optional txp inet
dev/uart/uart_bus_acpi.c optional uart acpi
#dev/uart/uart_bus_cbus.c optional uart cbus
dev/uart/uart_bus_ebus.c optional uart ebus
+dev/uart/uart_bus_fdt.c optional uart fdt
dev/uart/uart_bus_isa.c optional uart isa
dev/uart/uart_bus_pccard.c optional uart pccard
dev/uart/uart_bus_pci.c optional uart pci