PERFORCE change 175766 for review

Rafal Jaworowski raj at FreeBSD.org
Wed Mar 17 17:40:41 UTC 2010


http://p4web.freebsd.org/chv.cgi?CH=175766

Change 175766 by raj at raj_fdt on 2010/03/17 17:40:06

	Harden DTS compilation infrastructure against various error scenarios.

Affected files ...

.. //depot/projects/fdt/Makefile.inc1#12 edit
.. //depot/projects/fdt/share/mk/bsd.own.mk#5 edit

Differences ...

==== //depot/projects/fdt/Makefile.inc1#12 (text+ko) ====

@@ -1443,29 +1443,38 @@
 		done
 .endif
 
-.if ${MK_FDT} != "no"
+.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
 
-.if defined(FDT_DTS_OUTPUT)
-DTBOUTPUTPATH= ${FDT_DTS_OUTPUT}
-.else
-DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
 .endif
 
-.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
-FDT_DTS_FILE!=	 grep "makeoptions[[:space:]]\+FDT_DTS_FILE" \
-	${KERNCONFDIR}/${KERNCONF} | cut -d= -f2
+.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
+DTBOUTPUTPATH= ${.CURDIR}
 .endif
 
 #
 # Build 'standalone' Device Tree Blob
 #
 builddtb:
-.if !empty(FDT_DTS_FILE)
-.if !exists(${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE})
-.error ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} not found!
-.endif
+	@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` \
-	    -b 0 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
-.endif
-.endif
+	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}

==== //depot/projects/fdt/share/mk/bsd.own.mk#5 (text+ko) ====

@@ -279,7 +279,8 @@
 .endif
 
 # Enable FDT by default for selected platforms.
-.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc"
+.if defined(TARGET_ARCH) && \
+	(${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "powerpc")
 _fdt=	FDT
 .else
 _no_fdt= FDT


More information about the p4-projects mailing list