Connect FDT infrastructure to the build system.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
raj 2010-06-13 13:02:43 +00:00
parent d3177b8e82
commit ce1aea1edb
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 \
_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

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
.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}

View File

@ -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

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" \
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