]> code.ossystems Code Review - openembedded-core.git/commitdiff
linux-dtb.inc: refactor common code to function normalize_dtb
authorStefan Christ <s.christ@phytec.de>
Mon, 26 Oct 2015 08:20:36 +0000 (09:20 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 16 Nov 2015 11:28:37 +0000 (11:28 +0000)
Signed-off-by: Stefan Christ <s.christ@phytec.de>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-kernel/linux/linux-dtb.inc

index 2b8b11f084fe790e842f6828e2645d9d33b326c7..22801b72b8674094126d6fba685f50fad352c73e 100644 (file)
@@ -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"`