kernel-devicetree.bbclass: DTB make targets may contain path components

Message ID b89ab2b5128e4d5da985606e1b81213b1531133101-27576-1-git-send-email-jonathan.haigh@arm.com
State New
Headers show
Series
  • kernel-devicetree.bbclass: DTB make targets may contain path components
Related show

Commit Message

Jonathan Haigh July 9, 2018, 10:46 a.m.
normalize_dtb() turns DTS and DTB paths into values that can be used as
make targets. These make targets sometimes contain some directory
components so 'basename' is not suitable for turning the paths into make
targets - we should only strip off leading directory components of the
path up to and including the 'dts' directory (if it exists). For
example:
* 'overlays/at86rf233.dtbo' should not be changed.
* 'some/directory/path/dts/overlays/at86rf233.dtbo' should be changed to
  'overlays/at86rf233.dtbo' rather than just 'at86rf233.dtbo'

Signed-off-by: Jonathan Haigh <jonathan.haigh@arm.com>

---
 meta/classes/kernel-devicetree.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--
2.7.4

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Martin Jansa July 10, 2018, 7:28 a.m. | #1
Please rebase on top of current master-next.

On Mon, Jul 9, 2018 at 6:20 PM Jonathan Haigh <Jonathan.Haigh@arm.com>
wrote:

> normalize_dtb() turns DTS and DTB paths into values that can be used as

> make targets. These make targets sometimes contain some directory

> components so 'basename' is not suitable for turning the paths into make

> targets - we should only strip off leading directory components of the

> path up to and including the 'dts' directory (if it exists). For

> example:

> * 'overlays/at86rf233.dtbo' should not be changed.

> * 'some/directory/path/dts/overlays/at86rf233.dtbo' should be changed to

>   'overlays/at86rf233.dtbo' rather than just 'at86rf233.dtbo'

>

> Signed-off-by: Jonathan Haigh <jonathan.haigh@arm.com>

> ---

>  meta/classes/kernel-devicetree.bbclass | 6 +++---

>  1 file changed, 3 insertions(+), 3 deletions(-)

>

> diff --git a/meta/classes/kernel-devicetree.bbclass

> b/meta/classes/kernel-devicetree.bbclass

> index 4f80cc6..e42b664 100644

> --- a/meta/classes/kernel-devicetree.bbclass

> +++ b/meta/classes/kernel-devicetree.bbclass

> @@ -12,10 +12,10 @@ KERNEL_DEVICETREE_BUNDLE ?= "0"

>  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'`

> +bbwarn "${DTB} contains the full path to the the dts file, but the path

> should be relative to the dts directory."

> +DTB=`echo "${DTB}" | sed 's,^.*/dts/,,'`

>  fi

> -echo "${DTB}"

> +echo "${DTB}" | sed 's,\.dts$,.dtb,g'

>  }

>

>  get_real_dtb_path_in_kernel () {

> --

> 2.7.4

>

> IMPORTANT NOTICE: The contents of this email and any attachments are

> confidential and may also be privileged. If you are not the intended

> recipient, please notify the sender immediately and do not disclose the

> contents to any other person, use it for any purpose, or store or copy the

> information in any medium. Thank you.

> --

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.openembedded.org/mailman/listinfo/openembedded-core

>
<div dir="ltr">Please rebase on top of current master-next.</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 9, 2018 at 6:20 PM Jonathan Haigh &lt;<a href="mailto:Jonathan.Haigh@arm.com">Jonathan.Haigh@arm.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">normalize_dtb() turns DTS and DTB paths into values that can be used as<br>
make targets. These make targets sometimes contain some directory<br>
components so &#39;basename&#39; is not suitable for turning the paths into make<br>
targets - we should only strip off leading directory components of the<br>
path up to and including the &#39;dts&#39; directory (if it exists). For<br>
example:<br>
* &#39;overlays/at86rf233.dtbo&#39; should not be changed.<br>
* &#39;some/directory/path/dts/overlays/at86rf233.dtbo&#39; should be changed to<br>
  &#39;overlays/at86rf233.dtbo&#39; rather than just &#39;at86rf233.dtbo&#39;<br>
<br>
Signed-off-by: Jonathan Haigh &lt;<a href="mailto:jonathan.haigh@arm.com" target="_blank">jonathan.haigh@arm.com</a>&gt;<br>

---<br>
 meta/classes/kernel-devicetree.bbclass | 6 +++---<br>
 1 file changed, 3 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass<br>
index 4f80cc6..e42b664 100644<br>
--- a/meta/classes/kernel-devicetree.bbclass<br>
+++ b/meta/classes/kernel-devicetree.bbclass<br>
@@ -12,10 +12,10 @@ KERNEL_DEVICETREE_BUNDLE ?= &quot;0&quot;<br>
 normalize_dtb () {<br>
 DTB=&quot;$1&quot;<br>
 if echo ${DTB} | grep -q &#39;/dts/&#39;; then<br>
-bbwarn &quot;${DTB} contains the full path to the the dts file, but only the dtb name should be used.&quot;<br>
-DTB=`basename ${DTB} | sed &#39;s,\.dts$,.dtb,g&#39;`<br>
+bbwarn &quot;${DTB} contains the full path to the the dts file, but the path should be relative to the dts directory.&quot;<br>
+DTB=`echo &quot;${DTB}&quot; | sed &#39;s,^.*/dts/,,&#39;`<br>
 fi<br>
-echo &quot;${DTB}&quot;<br>
+echo &quot;${DTB}&quot; | sed &#39;s,\.dts$,.dtb,g&#39;<br>
 }<br>
<br>
 get_real_dtb_path_in_kernel () {<br>
--<br>
2.7.4<br>
<br>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.<br>
-- <br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/kernel-devicetree.bbclass b/meta/classes/kernel-devicetree.bbclass
index 4f80cc6..e42b664 100644
--- a/meta/classes/kernel-devicetree.bbclass
+++ b/meta/classes/kernel-devicetree.bbclass
@@ -12,10 +12,10 @@  KERNEL_DEVICETREE_BUNDLE ?= "0"
 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'`
+bbwarn "${DTB} contains the full path to the the dts file, but the path should be relative to the dts directory."
+DTB=`echo "${DTB}" | sed 's,^.*/dts/,,'`
 fi
-echo "${DTB}"
+echo "${DTB}" | sed 's,\.dts$,.dtb,g'
 }

 get_real_dtb_path_in_kernel () {