kernel-devicetree: Introduce KERNEL_DEVICETREE_FLAGS to pass dtc flags
PATCH 1/1 kernel-devicetree: Introduce KERNEL_DEVICETREE_FLAGS to pass dtc flags
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).
--- meta/classes/kernel-devicetree.bbclass | 7 +++++++ 1 file changed, 7 insertions(+)
meta/classes/kernel-devicetree.bbclass +7 -0
@@ -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}
Signature · 1 line
2.17.1
Quoted 15 lines · Ovidiu Panait
Currently
DTC_FLAGSkernel makefile parameter can be specified directly on the command line by adding it toKERNEL_EXTRA_ARGS. However, this preventsscripts/Makefile.liblogic 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_compilelog 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
...
Quoted 4 lines
To fix this, introduce the dedicated
KERNEL_DEVICETREE_FLAGSvariable to hold dtc flags and exportDTC_FLAGSin 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.
Quoted 37 lines
Signed-off-by Ovidiu Panait <[email protected]>--- meta/classes/kernel-devicetree.bbclass | 7 +++++++ 1 file changed, 7 insertions(+)meta/classes/kernel-devicetree.bbclass +7
-1@@ -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
Signature · 2 lines
Paul Barker Konsulko Group
Quoted 30 lines · Ovidiu Panait
Currently
DTC_FLAGSkernel makefile parameter can be specified directly on the command line by adding it toKERNEL_EXTRA_ARGS. However, this preventsscripts/Makefile.liblogic 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_compilelog 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_FLAGSvariable to hold dtc flags and exportDTC_FLAGSin 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 <[email protected]>--- meta/classes/kernel-devicetree.bbclass | 7 +++++++ 1 file changed, 7 insertions(+)meta/classes/kernel-devicetree.bbclass +0
-0
meta/classes/kernel-devicetree.bbclass FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage- · line 13
Quoted 5 lines
meta/classes/kernel-devicetree.bbclass +2
-0@@ -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.
meta/classes/kernel-devicetree.bbclass do_configure_append() { · line 56
Quoted 9 lines
meta/classes/kernel-devicetree.bbclass +2
-0+ 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
Quoted 12 lines
meta/classes/kernel-devicetree.bbclass +3
-1+ 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
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
Hi Bruce,
Quoted 47 lines · Bruce Ashfield
Quoted 29 lines · Ovidiu Panait
Currently
DTC_FLAGSkernel makefile parameter can be specified directly on the command line by adding it toKERNEL_EXTRA_ARGS. However, this preventsscripts/Makefile.liblogic 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_compilelog 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_FLAGSvariable to hold dtc flags and exportDTC_FLAGSin 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 <[email protected]>--- meta/classes/kernel-devicetree.bbclass | 7 +++++++ 1 file changed, 7 insertions(+)meta/classes/kernel-devicetree.bbclass +0
-0meta/classes/kernel-devicetree.bbclass FILES_${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage- · line 13
Quoted 5 lines
meta/classes/kernel-devicetree.bbclass +2
-0@@ -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.
Quoted 7 lines
meta/classes/kernel-devicetree.bbclass +1
-0+ normalize_dtb () { dtb="$1" if echo $dtb | grep -q '/dts/'; then@@ -50,6 +53,10 @@ do_configure_append() { }
Quoted 8 lines
meta/classes/kernel-devicetree.bbclass do_configure_append() { · line 56
Quoted 2 lines
meta/classes/kernel-devicetree.bbclass +1
-0do_compile_append() { + if [ ! -z "${KERNEL_DEVICETREE_FLAGS}" ]; thenDoes -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
Quoted 13 lines
Quoted 12 lines
meta/classes/kernel-devicetree.bbclass +3
-1+ 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