[OE-core] [PATCH 6/7] linux-dtb.inc: refactor common code to function normalize_dtb

Stefan Christ s.christ at phytec.de
Mon Oct 19 08:15:40 UTC 2015


Signed-off-by: Stefan Christ <s.christ at phytec.de>
---
 meta/recipes-kernel/linux/linux-dtb.inc | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 5bfd33b..658a32f 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -5,22 +5,25 @@ python __anonymous () {
     d.appendVar("PACKAGES", " kernel-devicetree")
 }
 
+normalize_dtb () {
+	DTB="$1"
+	if echo ${DTB} | grep -q '\.dts$'; then
+		bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
+		DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
+	fi
+	echo "${DTB}"
+}
+
 do_compile_append() {
 	for DTB in ${KERNEL_DEVICETREE}; do
-		if echo ${DTB} | grep -q '\.dts$'; then
-			bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
-			DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
-		fi
+		DTB=`normalize_dtb "${DTB}"`
 		oe_runmake ${DTB}
 	done
 }
 
 do_install_append() {
 	for DTB in ${KERNEL_DEVICETREE}; do
-		if echo ${DTB} | grep -q '\.dts$'; then
-			bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
-			DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
-		fi
+		DTB=`normalize_dtb "${DTB}"`
 		DTB_BASE_NAME=`basename ${DTB} .dtb`
 		DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
 		DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
@@ -33,10 +36,7 @@ do_install_append() {
 
 do_deploy_append() {
 	for DTB in ${KERNEL_DEVICETREE}; do
-		if echo ${DTB} | grep -q '\.dts$'; then
-			bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
-			DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
-		fi
+		DTB=`normalize_dtb "${DTB}"`
 		DTB_BASE_NAME=`basename ${DTB} .dtb`
 		DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
 		DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
-- 
1.9.1




More information about the Openembedded-core mailing list