All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Two fixes and some changes for linux-dtb.inc
@ 2015-10-19  8:15 Stefan Christ
  2015-10-19  8:15 ` [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts' Stefan Christ
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  8:15 UTC (permalink / raw)
  To: openembedded-core

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 806 bytes --]

Hi,

here are two small fixes for linux-dtb.inc and five refactoring patches.  The
fixes come first so they can be applied seperatly.

Mit freundlichen Grüßen / Kind regards,
	 Stefan Christ


Stefan Christ (7):
  linux-dtb.inc: fix detection of ending '.dts'
  linux-dtb.inc: fix file ending detection
  linux-dtb.inc: remove unneeded 'cd'
  linux-dtb.inc: use same variable name DTB for all elements of
    KERNEL_DEVICETREE
  linux-dtb.inc: explicit test for empty string not needed
  linux-dtb.inc: refactor common code to function normalize_dtb
  linux-dtb.inc: refactor common code to function
    get_real_dtb_path_in_kernel

 meta/recipes-kernel/linux/linux-dtb.inc | 91 ++++++++++++++++-----------------
 1 file changed, 43 insertions(+), 48 deletions(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts'
  2015-10-19  8:15 [PATCH 0/7] Two fixes and some changes for linux-dtb.inc Stefan Christ
@ 2015-10-19  8:15 ` Stefan Christ
  2015-10-19  8:27   ` Nicolas Dechesne
  2015-10-19  8:15 ` [PATCH 2/7] linux-dtb.inc: fix file ending detection Stefan Christ
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  8:15 UTC (permalink / raw)
  To: openembedded-core

Device tree files ending with ".dts" are not recognized correctly
because of unnecessary front slashes.

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

diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index ee3a5e1..db2afb8 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -8,7 +8,7 @@ python __anonymous () {
 do_compile_append() {
 	if test -n "${KERNEL_DEVICETREE}"; then
 		for DTB in ${KERNEL_DEVICETREE}; do
-			if echo ${DTB} | grep -q '/dts/'; then
+			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
@@ -20,7 +20,7 @@ do_compile_append() {
 do_install_append() {
 	if test -n "${KERNEL_DEVICETREE}"; then
 		for DTB in ${KERNEL_DEVICETREE}; do
-			if echo ${DTB} | grep -q '/dts/'; then
+			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
@@ -38,7 +38,7 @@ do_install_append() {
 do_deploy_append() {
 	if test -n "${KERNEL_DEVICETREE}"; then
 		for DTB in ${KERNEL_DEVICETREE}; do
-			if echo ${DTB} | grep -q '/dts/'; then
+			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
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/7] linux-dtb.inc: fix file ending detection
  2015-10-19  8:15 [PATCH 0/7] Two fixes and some changes for linux-dtb.inc Stefan Christ
  2015-10-19  8:15 ` [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts' Stefan Christ
@ 2015-10-19  8:15 ` Stefan Christ
  2015-10-19  8:15 ` [PATCH 3/7] linux-dtb.inc: remove unneeded 'cd' Stefan Christ
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  8:15 UTC (permalink / raw)
  To: openembedded-core

Only search for 'dts' at the end of the filename. Don't trigger the
warning when the device tree name only contains 'dts'. The sed command
already replaces the string 'dts' only at the end.

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

diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index db2afb8..d73792a 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -8,7 +8,7 @@ python __anonymous () {
 do_compile_append() {
 	if test -n "${KERNEL_DEVICETREE}"; then
 		for DTB in ${KERNEL_DEVICETREE}; do
-			if echo ${DTB} | grep -q 'dts'; then
+			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
@@ -20,7 +20,7 @@ do_compile_append() {
 do_install_append() {
 	if test -n "${KERNEL_DEVICETREE}"; then
 		for DTB in ${KERNEL_DEVICETREE}; do
-			if echo ${DTB} | grep -q 'dts'; then
+			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
@@ -38,7 +38,7 @@ do_install_append() {
 do_deploy_append() {
 	if test -n "${KERNEL_DEVICETREE}"; then
 		for DTB in ${KERNEL_DEVICETREE}; do
-			if echo ${DTB} | grep -q 'dts'; then
+			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
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/7] linux-dtb.inc: remove unneeded 'cd'
  2015-10-19  8:15 [PATCH 0/7] Two fixes and some changes for linux-dtb.inc Stefan Christ
  2015-10-19  8:15 ` [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts' Stefan Christ
  2015-10-19  8:15 ` [PATCH 2/7] linux-dtb.inc: fix file ending detection Stefan Christ
@ 2015-10-19  8:15 ` Stefan Christ
  2015-10-19  8:15 ` [PATCH 4/7] linux-dtb.inc: use same variable name DTB for all elements of KERNEL_DEVICETREE Stefan Christ
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  8:15 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Stefan Christ <s.christ@phytec.de>
---
 meta/recipes-kernel/linux/linux-dtb.inc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index d73792a..0095155 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -51,9 +51,7 @@ do_deploy_append() {
 			fi
 			install -d ${DEPLOYDIR}
 			install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
-			cd ${DEPLOYDIR}
-			ln -sf ${DTB_NAME}.dtb ${DTB_SYMLINK_NAME}.dtb
-			cd -
+			ln -sf ${DTB_NAME}.dtb ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb
 		done
 	fi
 }
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/7] linux-dtb.inc: use same variable name DTB for all elements of KERNEL_DEVICETREE
  2015-10-19  8:15 [PATCH 0/7] Two fixes and some changes for linux-dtb.inc Stefan Christ
                   ` (2 preceding siblings ...)
  2015-10-19  8:15 ` [PATCH 3/7] linux-dtb.inc: remove unneeded 'cd' Stefan Christ
@ 2015-10-19  8:15 ` Stefan Christ
  2015-10-19  8:15 ` [PATCH 5/7] linux-dtb.inc: explicit test for empty string not needed Stefan Christ
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  8:15 UTC (permalink / raw)
  To: openembedded-core

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

diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 0095155..f44851a 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -58,9 +58,9 @@ do_deploy_append() {
 
 pkg_postinst_kernel-devicetree () {
 	cd /${KERNEL_IMAGEDEST}
-	for DTB_FILE in ${KERNEL_DEVICETREE}
+	for DTB in ${KERNEL_DEVICETREE}
 	do
-		DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
+		DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print $1}'`
 		DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
 		update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
 	done
@@ -68,9 +68,9 @@ pkg_postinst_kernel-devicetree () {
 
 pkg_postrm_kernel-devicetree () {
 	cd /${KERNEL_IMAGEDEST}
-	for DTB_FILE in ${KERNEL_DEVICETREE}
+	for DTB in ${KERNEL_DEVICETREE}
 	do
-		DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
+		DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print $1}'`
 		DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
 		update-alternatives --remove ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
 	done
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 5/7] linux-dtb.inc: explicit test for empty string not needed
  2015-10-19  8:15 [PATCH 0/7] Two fixes and some changes for linux-dtb.inc Stefan Christ
                   ` (3 preceding siblings ...)
  2015-10-19  8:15 ` [PATCH 4/7] linux-dtb.inc: use same variable name DTB for all elements of KERNEL_DEVICETREE Stefan Christ
@ 2015-10-19  8:15 ` Stefan Christ
  2015-10-19  8:15 ` [PATCH 6/7] linux-dtb.inc: refactor common code to function normalize_dtb Stefan Christ
  2015-10-19  8:15 ` [PATCH 7/7] linux-dtb.inc: refactor common code to function get_real_dtb_path_in_kernel Stefan Christ
  6 siblings, 0 replies; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  8:15 UTC (permalink / raw)
  To: openembedded-core

The for loop already handles the case when KERNEL_DEVICETREE is empty.

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

diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index f44851a..5bfd33b 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -6,54 +6,48 @@ python __anonymous () {
 }
 
 do_compile_append() {
-	if test -n "${KERNEL_DEVICETREE}"; then
-		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
-			oe_runmake ${DTB}
-		done
-	fi
+	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
+		oe_runmake ${DTB}
+	done
 }
 
 do_install_append() {
-	if test -n "${KERNEL_DEVICETREE}"; then
-		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_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}"
-			if [ ! -e "${DTB_PATH}" ]; then
-				DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
-			fi
-			install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
-		done
-	fi
+	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_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}"
+		if [ ! -e "${DTB_PATH}" ]; then
+			DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
+		fi
+		install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
+	done
 }
 
 do_deploy_append() {
-	if test -n "${KERNEL_DEVICETREE}"; then
-		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_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"`
-			DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
-			if [ ! -e "${DTB_PATH}" ]; then
-				DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
-			fi
-			install -d ${DEPLOYDIR}
-			install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
-			ln -sf ${DTB_NAME}.dtb ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb
-		done
-	fi
+	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_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"`
+		DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
+		if [ ! -e "${DTB_PATH}" ]; then
+			DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
+		fi
+		install -d ${DEPLOYDIR}
+		install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
+		ln -sf ${DTB_NAME}.dtb ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb
+	done
 }
 
 pkg_postinst_kernel-devicetree () {
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 6/7] linux-dtb.inc: refactor common code to function normalize_dtb
  2015-10-19  8:15 [PATCH 0/7] Two fixes and some changes for linux-dtb.inc Stefan Christ
                   ` (4 preceding siblings ...)
  2015-10-19  8:15 ` [PATCH 5/7] linux-dtb.inc: explicit test for empty string not needed Stefan Christ
@ 2015-10-19  8:15 ` Stefan Christ
  2015-10-19  8:15 ` [PATCH 7/7] linux-dtb.inc: refactor common code to function get_real_dtb_path_in_kernel Stefan Christ
  6 siblings, 0 replies; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  8:15 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Stefan Christ <s.christ@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



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 7/7] linux-dtb.inc: refactor common code to function get_real_dtb_path_in_kernel
  2015-10-19  8:15 [PATCH 0/7] Two fixes and some changes for linux-dtb.inc Stefan Christ
                   ` (5 preceding siblings ...)
  2015-10-19  8:15 ` [PATCH 6/7] linux-dtb.inc: refactor common code to function normalize_dtb Stefan Christ
@ 2015-10-19  8:15 ` Stefan Christ
  6 siblings, 0 replies; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  8:15 UTC (permalink / raw)
  To: openembedded-core

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

diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 658a32f..beacdff 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -14,6 +14,15 @@ normalize_dtb () {
 	echo "${DTB}"
 }
 
+get_real_dtb_path_in_kernel () {
+	DTB="$1"
+	DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
+	if [ ! -e "${DTB_PATH}" ]; then
+		DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
+	fi
+	echo "${DTB_PATH}"
+}
+
 do_compile_append() {
 	for DTB in ${KERNEL_DEVICETREE}; do
 		DTB=`normalize_dtb "${DTB}"`
@@ -26,10 +35,7 @@ do_install_append() {
 		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}"
-		if [ ! -e "${DTB_PATH}" ]; then
-			DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
-		fi
+		DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
 		install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
 	done
 }
@@ -40,10 +46,7 @@ do_deploy_append() {
 		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"`
-		DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
-		if [ ! -e "${DTB_PATH}" ]; then
-			DTB_PATH="${B}/arch/${ARCH}/boot/${DTB}"
-		fi
+		DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"`
 		install -d ${DEPLOYDIR}
 		install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
 		ln -sf ${DTB_NAME}.dtb ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts'
  2015-10-19  8:15 ` [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts' Stefan Christ
@ 2015-10-19  8:27   ` Nicolas Dechesne
  2015-10-19  9:03     ` Stefan Christ
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Dechesne @ 2015-10-19  8:27 UTC (permalink / raw)
  To: Stefan Christ; +Cc: Patches and discussions about the oe-core layer

On Mon, Oct 19, 2015 at 10:15 AM, Stefan Christ <s.christ@phytec.de> wrote:
>
> Device tree files ending with ".dts" are not recognized correctly
> because of unnecessary front slashes.
>
> Signed-off-by: Stefan Christ <s.christ@phytec.de>
> ---
>  meta/recipes-kernel/linux/linux-dtb.inc | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
> index ee3a5e1..db2afb8 100644
> --- a/meta/recipes-kernel/linux/linux-dtb.inc
> +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> @@ -8,7 +8,7 @@ python __anonymous () {
>  do_compile_append() {
>         if test -n "${KERNEL_DEVICETREE}"; then
>                 for DTB in ${KERNEL_DEVICETREE}; do
> -                       if echo ${DTB} | grep -q '/dts/'; then
> +                       if echo ${DTB} | grep -q 'dts'; then



My understanding is that the '/dts/' was here to catch 'boot/dts/' in
order to detect the absolute path name, not the trailing '.dts'. In
which case this patch might not be appropriate.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts'
  2015-10-19  8:27   ` Nicolas Dechesne
@ 2015-10-19  9:03     ` Stefan Christ
  2015-10-19  9:05       ` Nicolas Dechesne
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  9:03 UTC (permalink / raw)
  To: Nicolas Dechesne; +Cc: Patches and discussions about the oe-core layer

Hi,

On Mon, Oct 19, 2015 at 10:27:52AM +0200, Nicolas Dechesne wrote:
> On Mon, Oct 19, 2015 at 10:15 AM, Stefan Christ <s.christ@phytec.de> wrote:
> >
> > Device tree files ending with ".dts" are not recognized correctly
> > because of unnecessary front slashes.
> >
> > Signed-off-by: Stefan Christ <s.christ@phytec.de>
> > ---
> >  meta/recipes-kernel/linux/linux-dtb.inc | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
> > index ee3a5e1..db2afb8 100644
> > --- a/meta/recipes-kernel/linux/linux-dtb.inc
> > +++ b/meta/recipes-kernel/linux/linux-dtb.inc
> > @@ -8,7 +8,7 @@ python __anonymous () {
> >  do_compile_append() {
> >         if test -n "${KERNEL_DEVICETREE}"; then
> >                 for DTB in ${KERNEL_DEVICETREE}; do
> > -                       if echo ${DTB} | grep -q '/dts/'; then
> > +                       if echo ${DTB} | grep -q 'dts'; then
> 
> 
> 
> My understanding is that the '/dts/' was here to catch 'boot/dts/' in
> order to detect the absolute path name, not the trailing '.dts'. In
> which case this patch might not be appropriate.

Hmm, the meaning of the code seems to be non obvious. I just looked at sed
replacement and concluded that it's about the file name ending.

Using the full path to the dtb file is not supported by the code anyway, e.g.

   DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"

would be wrong.

So the correct solution would check both cases

   - full path or only filename and
   - ending is dts or dtb

Correct?

Mit freundlichen Grüßen / Kind regards,
	Stefan Christ



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts'
  2015-10-19  9:03     ` Stefan Christ
@ 2015-10-19  9:05       ` Nicolas Dechesne
  2015-10-19  9:21         ` Stefan Christ
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Dechesne @ 2015-10-19  9:05 UTC (permalink / raw)
  To: Stefan Christ; +Cc: Patches and discussions about the oe-core layer

On Mon, Oct 19, 2015 at 11:03 AM, Stefan Christ <s.christ@phytec.de> wrote:
> Hmm, the meaning of the code seems to be non obvious. I just looked at sed
> replacement and concluded that it's about the file name ending.
>
> Using the full path to the dtb file is not supported by the code anyway, e.g.
>
>    DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
>
> would be wrong.
>
> So the correct solution would check both cases
>
>    - full path or only filename and
>    - ending is dts or dtb
>
> Correct?


If you look at the commit that introduced this code, e.g. 72980d5b,
you can see that this code was added to support the 'legacy' case
which was the absolute path of the .dts file, or the new case which is
the .dtb file name. e.g.:

==
    ,----[ Original definition ]
    | KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/imx6q-sabresd.dts"
    `----

    Becomes:

    ,----[ New definition ]
    | KERNEL_DEVICETREE = "imx6q-sabresd.dtb"
    `----
==

so the '/dts/' was used to detect the legacy case, and print a warning
in that condition.

cheers
nicolas


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts'
  2015-10-19  9:05       ` Nicolas Dechesne
@ 2015-10-19  9:21         ` Stefan Christ
  2015-10-19  9:46           ` Nicolas Dechesne
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan Christ @ 2015-10-19  9:21 UTC (permalink / raw)
  To: Nicolas Dechesne; +Cc: Patches and discussions about the oe-core layer

Hi,

On Mon, Oct 19, 2015 at 11:05:58AM +0200, Nicolas Dechesne wrote:
> On Mon, Oct 19, 2015 at 11:03 AM, Stefan Christ <s.christ@phytec.de> wrote:
> > Hmm, the meaning of the code seems to be non obvious. I just looked at sed
> > replacement and concluded that it's about the file name ending.
> >
> > Using the full path to the dtb file is not supported by the code anyway, e.g.
> >
> >    DTB_PATH="${B}/arch/${ARCH}/boot/dts/${DTB}"
> >
> > would be wrong.
> >
> > So the correct solution would check both cases
> >
> >    - full path or only filename and
> >    - ending is dts or dtb
> >
> > Correct?
> 
> 
> If you look at the commit that introduced this code, e.g. 72980d5b,
> you can see that this code was added to support the 'legacy' case
> which was the absolute path of the .dts file, or the new case which is
> the .dtb file name. e.g.:
> 
> ==
>     ,----[ Original definition ]
>     | KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/imx6q-sabresd.dts"
>     `----
> 
>     Becomes:
> 
>     ,----[ New definition ]
>     | KERNEL_DEVICETREE = "imx6q-sabresd.dtb"
>     `----
> ==
> 
> so the '/dts/' was used to detect the legacy case, and print a warning
> in that condition.
> 

Yeah. Your right. The code is correct. The line

    DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`

will strip off the directories and replaces the ending. I overlooked that
somehow.  So drop my 'fixes', please.

What about my rework patches? I will resend them if they are ok.

Mit freundlichen Grüßen / Kind regards,
	Stefan Christ


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts'
  2015-10-19  9:21         ` Stefan Christ
@ 2015-10-19  9:46           ` Nicolas Dechesne
  2015-10-23 21:17             ` Burton, Ross
  0 siblings, 1 reply; 15+ messages in thread
From: Nicolas Dechesne @ 2015-10-19  9:46 UTC (permalink / raw)
  To: Stefan Christ; +Cc: Patches and discussions about the oe-core layer

On Mon, Oct 19, 2015 at 11:21 AM, Stefan Christ <s.christ@phytec.de> wrote:
>
> What about my rework patches? I will resend them if they are ok.

i (very) quickly looked at them..
#3, #4, #5 look sane.
#6, #7, i am not sure if this is worth doing this change.. we'll see
what others think about them..


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts'
  2015-10-19  9:46           ` Nicolas Dechesne
@ 2015-10-23 21:17             ` Burton, Ross
  2015-10-26  8:18               ` Stefan Christ
  0 siblings, 1 reply; 15+ messages in thread
From: Burton, Ross @ 2015-10-23 21:17 UTC (permalink / raw)
  To: Stefan Christ; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

Hi Stefan,

On 19 October 2015 at 10:46, Nicolas Dechesne <nicolas.dechesne@linaro.org>
wrote:

> i (very) quickly looked at them..
> #3, #4, #5 look sane.
> #6, #7, i am not sure if this is worth doing this change.. we'll see
> what others think about them..
>

Can you drop 1 and 2 and rebase the remaining patches?  The rest of the
series doesn't apply if 1 and 2 are dropped.

Ross

[-- Attachment #2: Type: text/html, Size: 851 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts'
  2015-10-23 21:17             ` Burton, Ross
@ 2015-10-26  8:18               ` Stefan Christ
  0 siblings, 0 replies; 15+ messages in thread
From: Stefan Christ @ 2015-10-26  8:18 UTC (permalink / raw)
  To: Burton, Ross; +Cc: Patches and discussions about the oe-core layer

Hi, 

On Fri, Oct 23, 2015 at 10:17:00PM +0100, Burton, Ross wrote:
> Hi Stefan,
> 
> On 19 October 2015 at 10:46, Nicolas Dechesne <nicolas.dechesne@linaro.org>
> wrote:
> 
> > i (very) quickly looked at them..
> > #3, #4, #5 look sane.
> > #6, #7, i am not sure if this is worth doing this change.. we'll see
> > what others think about them..
> >
> 
> Can you drop 1 and 2 and rebase the remaining patches?  The rest of the
> series doesn't apply if 1 and 2 are dropped.

Sure. I will send a v2.

Mit freundlichen Grüßen / Kind regards,
	Stefan Christ



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-10-26  8:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-19  8:15 [PATCH 0/7] Two fixes and some changes for linux-dtb.inc Stefan Christ
2015-10-19  8:15 ` [PATCH 1/7] linux-dtb.inc: fix detection of ending '.dts' Stefan Christ
2015-10-19  8:27   ` Nicolas Dechesne
2015-10-19  9:03     ` Stefan Christ
2015-10-19  9:05       ` Nicolas Dechesne
2015-10-19  9:21         ` Stefan Christ
2015-10-19  9:46           ` Nicolas Dechesne
2015-10-23 21:17             ` Burton, Ross
2015-10-26  8:18               ` Stefan Christ
2015-10-19  8:15 ` [PATCH 2/7] linux-dtb.inc: fix file ending detection Stefan Christ
2015-10-19  8:15 ` [PATCH 3/7] linux-dtb.inc: remove unneeded 'cd' Stefan Christ
2015-10-19  8:15 ` [PATCH 4/7] linux-dtb.inc: use same variable name DTB for all elements of KERNEL_DEVICETREE Stefan Christ
2015-10-19  8:15 ` [PATCH 5/7] linux-dtb.inc: explicit test for empty string not needed Stefan Christ
2015-10-19  8:15 ` [PATCH 6/7] linux-dtb.inc: refactor common code to function normalize_dtb Stefan Christ
2015-10-19  8:15 ` [PATCH 7/7] linux-dtb.inc: refactor common code to function get_real_dtb_path_in_kernel Stefan Christ

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.