Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Oct 2014 00:47:56 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r273715 - in stable/10: . sys/conf sys/tools/fdt
Message-ID:  <201410270047.s9R0lu9F028157@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Mon Oct 27 00:47:55 2014
New Revision: 273715
URL: https://svnweb.freebsd.org/changeset/base/273715

Log:
  MFC r262626, r262626, r264979, r265154, r265162, r265163, r267319, r270863,
      r270991, r271045:
  
    Enhancements related to compiling FDT data...
  
   - Use proper include path for dtc as well as cpp.
   - Call cpp with -P to avoid printing line markings.
   - Allow FDT_DTS_FILE to be a list, either in the makedtb target, or in a
     kernel config file.
   - Add the dts include directory to the -I list when doing arm builds.
   - Invoke make_dtb with MACHINE defined for cross building friendliness.
   - Allow the make_dtb script to work outside of a "make buildkernel"
     context by setting MACHINE from uname -m if it's not set already.
   - Use sh -c '...' to launch the dtb build scripts with env prepended,
     otherwise it tries to treat the env var stuff as a script file name.

Modified:
  stable/10/Makefile.inc1
  stable/10/sys/conf/files
  stable/10/sys/tools/fdt/make_dtb.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/Makefile.inc1
==============================================================================
--- stable/10/Makefile.inc1	Sun Oct 26 23:45:33 2014	(r273714)
+++ stable/10/Makefile.inc1	Mon Oct 27 00:47:55 2014	(r273715)
@@ -1871,23 +1871,9 @@ DTBOUTPUTPATH= ${.CURDIR}
 # 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/${MACHINE}/${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} \
+	@PATH=${TMPPATH} MACHINE=${TARGET} \
 	${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
-	    ${FDT_DTS_FILE} \
-	    ${DTBOUTPUTPATH}/`basename ${FDT_DTS_FILE} .dts`
+	    "${FDT_DTS_FILE}" ${DTBOUTPUTPATH}
 
 ###############
 

Modified: stable/10/sys/conf/files
==============================================================================
--- stable/10/sys/conf/files	Sun Oct 26 23:45:33 2014	(r273714)
+++ stable/10/sys/conf/files	Mon Oct 27 00:47:55 2014	(r273715)
@@ -14,11 +14,11 @@ acpi_quirks.h			optional acpi				   \
 # from the specified source (DTS) file: <platform>.dts -> <platform>.dtb
 #
 fdt_dtb_file			optional fdt fdt_dtb_static \
-	compile-with "sh $S/tools/fdt/make_dtb.sh $S ${FDT_DTS_FILE} ${.CURDIR}/${FDT_DTS_FILE:R}.dtb" \
+	compile-with "sh -c 'MACHINE=${MACHINE} $S/tools/fdt/make_dtb.sh $S ${FDT_DTS_FILE} ${.CURDIR}'" \
 	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} ${.CURDIR}" \
+	compile-with "sh -c 'MACHINE=${MACHINE} $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"

Modified: stable/10/sys/tools/fdt/make_dtb.sh
==============================================================================
--- stable/10/sys/tools/fdt/make_dtb.sh	Sun Oct 26 23:45:33 2014	(r273714)
+++ stable/10/sys/tools/fdt/make_dtb.sh	Mon Oct 27 00:47:55 2014	(r273715)
@@ -4,8 +4,21 @@
 
 # Script generates dtb file ($3) from dts source ($2) in build tree S ($1)
 S=$1
-dts=$2
-dtb=$3
+dts="$2"
+dtb_path=$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 | 
+if [ -z "$dts" ]; then
+    echo "No DTS specified"
+    exit 1
+fi
+
+if [ -z "${MACHINE}" ]; then
+    MACHINE=$(uname -m)
+fi
+
+for d in ${dts}; do
+    dtb=${dtb_path}/`basename $d .dts`.dtb
+    echo "converting $d -> $dtb"
+    cpp -P -x assembler-with-cpp -I $S/gnu/dts/include -I $S/boot/fdt/dts/${MACHINE} -I $S/gnu/dts/${MACHINE} -include $d /dev/null | 
 	dtc -O dtb -o $dtb -b 0 -p 1024 -i $S/boot/fdt/dts/${MACHINE} -i $S/gnu/dts/${MACHINE}
+done



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410270047.s9R0lu9F028157>