Connect FDT infrastructure to the build system.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Rafal Jaworowski 2010-06-13 13:02:43 +00:00
parent 10e8667600
commit 3c5326bf4a
4 changed files with 72 additions and 1 deletions

View File

@ -89,7 +89,8 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
obj objlink regress rerelease showconfig tags toolchain update \ obj objlink regress rerelease showconfig tags toolchain update \
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \
_build-tools _cross-tools _includes _libraries _depend \ _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} TGTS+= ${SUBDIR_TARGETS}
BITGTS= files includes BITGTS= files includes

View File

@ -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 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
.endif .endif
.if ${MK_FDT} != "no"
_dtc= gnu/usr.bin/dtc
.endif
bootstrap-tools: bootstrap-tools:
.for _tool in \ .for _tool in \
${_clang_tblgen} \ ${_clang_tblgen} \
@ -976,6 +980,7 @@ bootstrap-tools:
${_gperf} \ ${_gperf} \
${_groff} \ ${_groff} \
${_ar} \ ${_ar} \
${_dtc} \
usr.bin/lorder \ usr.bin/lorder \
usr.bin/makewhatis \ usr.bin/makewhatis \
${_mklocale} \ ${_mklocale} \
@ -1448,3 +1453,39 @@ _xi-links:
../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
done done
.endif .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}

View File

@ -8,6 +8,7 @@ SUBDIR= ${_binutils} \
dialog \ dialog \
diff \ diff \
diff3 \ diff3 \
${_dtc} \
${_gdb} \ ${_gdb} \
${_gperf} \ ${_gperf} \
${_grep} \ ${_grep} \
@ -31,6 +32,10 @@ _groff= groff
_cvs= cvs _cvs= cvs
.endif .endif
.if ${MK_FDT} != "no"
_dtc= dtc
.endif
.if ${MK_GNU_GREP} != "no" .if ${MK_GNU_GREP} != "no"
_grep= grep _grep= grep
.endif .endif

View File

@ -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" \ 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 \ no-obj no-implicit-rule before-depend \
clean "emu10k1-alsa%diked.h" 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 \ p16v-alsa%diked.h optional snd_emu10kx pci \
dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/p16v-alsa.h" \ 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" \ 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" compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
contrib/ipfilter/netinet/mlfk_ipl.c optional ipfilter inet \ contrib/ipfilter/netinet/mlfk_ipl.c optional ipfilter inet \
compile-with "${NORMAL_C} -I$S/contrib/ipfilter" 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 \ contrib/ngatm/netnatm/api/cc_conn.c optional ngatm_ccatm \
compile-with "${NORMAL_C_NOWERROR} -I$S/contrib/ngatm" compile-with "${NORMAL_C_NOWERROR} -I$S/contrib/ngatm"
contrib/ngatm/netnatm/api/cc_data.c optional ngatm_ccatm \ 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/exca/exca.c optional cbb
dev/fatm/if_fatm.c optional fatm pci dev/fatm/if_fatm.c optional fatm pci
dev/fb/splash.c optional splash 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.c optional fe
dev/fe/if_fe_pccard.c optional fe pccard dev/fe/if_fe_pccard.c optional fe pccard
dev/firewire/firewire.c optional firewire 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_acpi.c optional uart acpi
#dev/uart/uart_bus_cbus.c optional uart cbus #dev/uart/uart_bus_cbus.c optional uart cbus
dev/uart/uart_bus_ebus.c optional uart ebus 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_isa.c optional uart isa
dev/uart/uart_bus_pccard.c optional uart pccard dev/uart/uart_bus_pccard.c optional uart pccard
dev/uart/uart_bus_pci.c optional uart pci dev/uart/uart_bus_pci.c optional uart pci