Re: [OE-core] [PATCH] kernel-devicetree: Introduce KERNEL_DEVICETREE_FLAGS to pass dtc flags

2020-12-23 Thread Ovidiu Panait

Hi Bruce,

On 22.12.2020 15:49, Bruce Ashfield wrote:

On Tue, Dec 22, 2020 at 5:43 AM Ovidiu Panait
 wrote:

Currently DTC_FLAGS kernel makefile parameter can be specified directly on the
command line by adding it to KERNEL_EXTRA_ARGS. However, this prevents
scripts/Makefile.lib logic from appending flags that silence dtc warnings (all
assignments done from within a makefile, to a variable specified on the command
line, are ignored).

Because of this, the do_compile log is cluttered with dtc warnings that should
only be printed when compiling with W="123":
...
/soc: node has a reg or ranges property, but no unit name
/soc/gpu: missing or empty reg/ranges property
/soc/firmware/gpio: missing or empty reg/ranges property
...

To fix this, introduce the dedicated KERNEL_DEVICETREE_FLAGS variable to hold
dtc flags and export DTC_FLAGS in the environment before generating the dtbs
(make allows "+=" operations on variables that come from the environment, so
the warnings are silenced properly).

Signed-off-by: Ovidiu Panait 
---
  meta/classes/kernel-devicetree.bbclass | 7 +++
  1 file changed, 7 insertions(+)

diff --git a/meta/classes/kernel-devicetree.bbclass 
b/meta/classes/kernel-devicetree.bbclass
index 81dda8003f..2066096a9a 100644
--- a/meta/classes/kernel-devicetree.bbclass
+++ b/meta/classes/kernel-devicetree.bbclass
@@ -9,6 +9,9 @@ FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = 
"/${KERNEL_IMAGEDEST}/zImage-
  # Generate kernel+devicetree bundle
  KERNEL_DEVICETREE_BUNDLE ?= "0"

+# dtc flags passed via DTC_FLAGS env variable
+KERNEL_DEVICETREE_FLAGS ?= ""

We should also be updating the docs with the new variable.  I don't
know how well the other parts of this are documented, but the state of
the current docs shouldn't prevent this from being documented.


+
  normalize_dtb () {
 dtb="$1"
 if echo $dtb | grep -q '/dts/'; then
@@ -50,6 +53,10 @@ do_configure_append() {
  }

  do_compile_append() {
+   if [ ! -z "${KERNEL_DEVICETREE_FLAGS}" ]; then

Does -n work here ? Having a positive test "does this exist ?", is
almost always easier to read / maintain than "does this not exist ?".
But someone can correct me, if there's a compatibility concern with -n
(and if so, I have a lot of scripts to change ;))

Bruce


I sent v2 for this. Also, the documentation patch:

https://lists.yoctoproject.org/g/docs/message/803


+   export DTC_FLAGS="${KERNEL_DEVICETREE_FLAGS}"
+   fi
+
 for dtbf in ${KERNEL_DEVICETREE}; do
 dtb=`normalize_dtb "$dtbf"`
 oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" 
${KERNEL_EXTRA_ARGS}
--
2.17.1







-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#146086): 
https://lists.openembedded.org/g/openembedded-core/message/146086
Mute This Topic: https://lists.openembedded.org/mt/79146426/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH] kernel-devicetree: Introduce KERNEL_DEVICETREE_FLAGS to pass dtc flags

2020-12-22 Thread Bruce Ashfield
On Tue, Dec 22, 2020 at 5:43 AM Ovidiu Panait
 wrote:
>
> Currently DTC_FLAGS kernel makefile parameter can be specified directly on the
> command line by adding it to KERNEL_EXTRA_ARGS. However, this prevents
> scripts/Makefile.lib logic from appending flags that silence dtc warnings (all
> assignments done from within a makefile, to a variable specified on the 
> command
> line, are ignored).
>
> Because of this, the do_compile log is cluttered with dtc warnings that should
> only be printed when compiling with W="123":
> ...
> /soc: node has a reg or ranges property, but no unit name
> /soc/gpu: missing or empty reg/ranges property
> /soc/firmware/gpio: missing or empty reg/ranges property
> ...
>
> To fix this, introduce the dedicated KERNEL_DEVICETREE_FLAGS variable to hold
> dtc flags and export DTC_FLAGS in the environment before generating the dtbs
> (make allows "+=" operations on variables that come from the environment, so
> the warnings are silenced properly).
>
> Signed-off-by: Ovidiu Panait 
> ---
>  meta/classes/kernel-devicetree.bbclass | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/meta/classes/kernel-devicetree.bbclass 
> b/meta/classes/kernel-devicetree.bbclass
> index 81dda8003f..2066096a9a 100644
> --- a/meta/classes/kernel-devicetree.bbclass
> +++ b/meta/classes/kernel-devicetree.bbclass
> @@ -9,6 +9,9 @@ FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = 
> "/${KERNEL_IMAGEDEST}/zImage-
>  # Generate kernel+devicetree bundle
>  KERNEL_DEVICETREE_BUNDLE ?= "0"
>
> +# dtc flags passed via DTC_FLAGS env variable
> +KERNEL_DEVICETREE_FLAGS ?= ""

We should also be updating the docs with the new variable.  I don't
know how well the other parts of this are documented, but the state of
the current docs shouldn't prevent this from being documented.

> +
>  normalize_dtb () {
> dtb="$1"
> if echo $dtb | grep -q '/dts/'; then
> @@ -50,6 +53,10 @@ do_configure_append() {
>  }
>
>  do_compile_append() {
> +   if [ ! -z "${KERNEL_DEVICETREE_FLAGS}" ]; then

Does -n work here ? Having a positive test "does this exist ?", is
almost always easier to read / maintain than "does this not exist ?".
But someone can correct me, if there's a compatibility concern with -n
(and if so, I have a lot of scripts to change ;))

Bruce

> +   export DTC_FLAGS="${KERNEL_DEVICETREE_FLAGS}"
> +   fi
> +
> for dtbf in ${KERNEL_DEVICETREE}; do
> dtb=`normalize_dtb "$dtbf"`
> oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " 
> LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
> --
> 2.17.1
>
>
> 
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#146051): 
https://lists.openembedded.org/g/openembedded-core/message/146051
Mute This Topic: https://lists.openembedded.org/mt/79146426/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH] kernel-devicetree: Introduce KERNEL_DEVICETREE_FLAGS to pass dtc flags

2020-12-22 Thread Paul Barker
On Tue, 22 Dec 2020 at 10:42, Ovidiu Panait  wrote:
>
> Currently DTC_FLAGS kernel makefile parameter can be specified directly on the
> command line by adding it to KERNEL_EXTRA_ARGS. However, this prevents
> scripts/Makefile.lib logic from appending flags that silence dtc warnings (all
> assignments done from within a makefile, to a variable specified on the 
> command
> line, are ignored).
>
> Because of this, the do_compile log is cluttered with dtc warnings that should
> only be printed when compiling with W="123":
> ...
> /soc: node has a reg or ranges property, but no unit name
> /soc/gpu: missing or empty reg/ranges property
> /soc/firmware/gpio: missing or empty reg/ranges property
> ...
>
> To fix this, introduce the dedicated KERNEL_DEVICETREE_FLAGS variable to hold
> dtc flags and export DTC_FLAGS in the environment before generating the dtbs
> (make allows "+=" operations on variables that come from the environment, so
> the warnings are silenced properly).

I'd prefer KERNEL_DTC_FLAGS but maybe that's just arguing over the
colour of the bikeshed.

>
> Signed-off-by: Ovidiu Panait 
> ---
>  meta/classes/kernel-devicetree.bbclass | 7 +++
>  1 file changed, 7 insertions(+)
>
> diff --git a/meta/classes/kernel-devicetree.bbclass 
> b/meta/classes/kernel-devicetree.bbclass
> index 81dda8003f..2066096a9a 100644
> --- a/meta/classes/kernel-devicetree.bbclass
> +++ b/meta/classes/kernel-devicetree.bbclass
> @@ -9,6 +9,9 @@ FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = 
> "/${KERNEL_IMAGEDEST}/zImage-
>  # Generate kernel+devicetree bundle
>  KERNEL_DEVICETREE_BUNDLE ?= "0"
>
> +# dtc flags passed via DTC_FLAGS env variable
> +KERNEL_DEVICETREE_FLAGS ?= ""
> +
>  normalize_dtb () {
> dtb="$1"
> if echo $dtb | grep -q '/dts/'; then
> @@ -50,6 +53,10 @@ do_configure_append() {
>  }
>
>  do_compile_append() {
> +   if [ ! -z "${KERNEL_DEVICETREE_FLAGS}" ]; then
> +   export DTC_FLAGS="${KERNEL_DEVICETREE_FLAGS}"
> +   fi
> +
> for dtbf in ${KERNEL_DEVICETREE}; do
> dtb=`normalize_dtb "$dtbf"`
> oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " 
> LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
> --
> 2.17.1
>
>
> 
>


-- 
Paul Barker
Konsulko Group

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#146050): 
https://lists.openembedded.org/g/openembedded-core/message/146050
Mute This Topic: https://lists.openembedded.org/mt/79146426/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[OE-core] [PATCH] kernel-devicetree: Introduce KERNEL_DEVICETREE_FLAGS to pass dtc flags

2020-12-22 Thread Ovidiu Panait
Currently DTC_FLAGS kernel makefile parameter can be specified directly on the
command line by adding it to KERNEL_EXTRA_ARGS. However, this prevents
scripts/Makefile.lib logic from appending flags that silence dtc warnings (all
assignments done from within a makefile, to a variable specified on the command
line, are ignored).

Because of this, the do_compile log is cluttered with dtc warnings that should
only be printed when compiling with W="123":
...
/soc: node has a reg or ranges property, but no unit name
/soc/gpu: missing or empty reg/ranges property
/soc/firmware/gpio: missing or empty reg/ranges property
...

To fix this, introduce the dedicated KERNEL_DEVICETREE_FLAGS variable to hold
dtc flags and export DTC_FLAGS in the environment before generating the dtbs
(make allows "+=" operations on variables that come from the environment, so
the warnings are silenced properly).

Signed-off-by: Ovidiu Panait 
---
 meta/classes/kernel-devicetree.bbclass | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/meta/classes/kernel-devicetree.bbclass 
b/meta/classes/kernel-devicetree.bbclass
index 81dda8003f..2066096a9a 100644
--- a/meta/classes/kernel-devicetree.bbclass
+++ b/meta/classes/kernel-devicetree.bbclass
@@ -9,6 +9,9 @@ FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = 
"/${KERNEL_IMAGEDEST}/zImage-
 # Generate kernel+devicetree bundle
 KERNEL_DEVICETREE_BUNDLE ?= "0"
 
+# dtc flags passed via DTC_FLAGS env variable
+KERNEL_DEVICETREE_FLAGS ?= ""
+
 normalize_dtb () {
dtb="$1"
if echo $dtb | grep -q '/dts/'; then
@@ -50,6 +53,10 @@ do_configure_append() {
 }
 
 do_compile_append() {
+   if [ ! -z "${KERNEL_DEVICETREE_FLAGS}" ]; then
+   export DTC_FLAGS="${KERNEL_DEVICETREE_FLAGS}"
+   fi
+
for dtbf in ${KERNEL_DEVICETREE}; do
dtb=`normalize_dtb "$dtbf"`
oe_runmake $dtb CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" 
${KERNEL_EXTRA_ARGS}
-- 
2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#146046): 
https://lists.openembedded.org/g/openembedded-core/message/146046
Mute This Topic: https://lists.openembedded.org/mt/79146426/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-