All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-core] [PATCH] kernel-fitimage.bbclass: support both KERNEL_DEVICETREE/EXTERNAL_KERNEL_DEVICETREE
@ 2021-03-18 12:47 Ming Liu
  2021-03-18 21:18 ` Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Liu @ 2021-03-18 12:47 UTC (permalink / raw)
  To: openembedded-core; +Cc: max.krummenacher, sergio.prado, Ming Liu

From: Ming Liu <liu.ming50@gmail.com>

There are user cases that a developer wants to add both in-tree and
out-of-tree devicetrees to fitimage, and this is quite normal, for
instance, a developer might need the devicetrees from kernel source
meanwhile maintaining his/her own devicetree overlays to be applied
on top of them.

To support that, we now allow KERNEL_DEVICETREE and
EXTERNAL_KERNEL_DEVICETREE to be both set in configuration files, and
the devicetrees in EXTERNAL_KERNEL_DEVICETREE have higher priority to
override the same names in KERNEL_DEVICETREE.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 meta/classes/kernel-fitimage.bbclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass
index f5082c93df..b9d8270027 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -535,13 +535,19 @@ fitimage_assemble() {
 	# Step 2: Prepare a DTB image section
 	#
 
-	if [ -z "${EXTERNAL_KERNEL_DEVICETREE}" ] && [ -n "${KERNEL_DEVICETREE}" ]; then
+	if [ -n "${KERNEL_DEVICETREE}" ]; then
 		dtbcount=1
 		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
+
+			# Skip ${DTB} if it's also provided in ${EXTERNAL_KERNEL_DEVICETREE}
+			if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ] && [ -s ${EXTERNAL_KERNEL_DEVICETREE}/${DTB} ]; then
+				continue
+			fi
+
 			DTB_PATH="arch/${ARCH}/boot/dts/${DTB}"
 			if [ ! -e "${DTB_PATH}" ]; then
 				DTB_PATH="arch/${ARCH}/boot/${DTB}"
@@ -769,4 +775,4 @@ python () {
         bb.build.deltask('do_assemble_fitimage', d)
         bb.build.deltask('generate_rsa_keys', d)
         bb.build.addtask('generate_rsa_keys', 'do_assemble_fitimage_initramfs', 'do_bundle_initramfs', d)
-}
\ No newline at end of file
+}
-- 
2.29.0


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

* Re: [OE-core] [PATCH] kernel-fitimage.bbclass: support both KERNEL_DEVICETREE/EXTERNAL_KERNEL_DEVICETREE
  2021-03-18 12:47 [OE-core] [PATCH] kernel-fitimage.bbclass: support both KERNEL_DEVICETREE/EXTERNAL_KERNEL_DEVICETREE Ming Liu
@ 2021-03-18 21:18 ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2021-03-18 21:18 UTC (permalink / raw)
  To: Ming Liu, openembedded-core; +Cc: max.krummenacher, sergio.prado

On Thu, 2021-03-18 at 13:47 +0100, Ming Liu wrote:
> From: Ming Liu <liu.ming50@gmail.com>
> 
> There are user cases that a developer wants to add both in-tree and
> out-of-tree devicetrees to fitimage, and this is quite normal, for
> instance, a developer might need the devicetrees from kernel source
> meanwhile maintaining his/her own devicetree overlays to be applied
> on top of them.
> 
> To support that, we now allow KERNEL_DEVICETREE and
> EXTERNAL_KERNEL_DEVICETREE to be both set in configuration files, and
> the devicetrees in EXTERNAL_KERNEL_DEVICETREE have higher priority to
> override the same names in KERNEL_DEVICETREE.
> 
> Signed-off-by: Ming Liu <liu.ming50@gmail.com>
> ---
>  meta/classes/kernel-fitimage.bbclass | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Can we please get some tests added for these code paths?

Until we do people are going to continue breaking each other's 
use cases :(

Cheers,

Richard


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

end of thread, other threads:[~2021-03-18 21:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 12:47 [OE-core] [PATCH] kernel-fitimage.bbclass: support both KERNEL_DEVICETREE/EXTERNAL_KERNEL_DEVICETREE Ming Liu
2021-03-18 21:18 ` Richard Purdie

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.