| Message ID | 20250725204908.2549495-3-denis@denix.org |
|---|---|
| State | Accepted |
| Delegated to: | Ryan Eatmon |
| Headers | show |
| Series | [scarthgap,1/3] meta-ti-bsp: move KERNEL_DTBVENDORED settings | expand |
On 7/25/25 3:49 PM, Denys Dmytriyenko wrote: > From: Denys Dmytriyenko <denys@konsulko.com> > > Convert devicetree prefix matching functionality into a generic > class that can be used by the kernel and wic images. That way > dynamically generated KERNEL_DEVICETREE list will be the same > when populating /boot dir of rootfs and/or FAT boot partition > of a wic image. > > Signed-off-by: Denys Dmytriyenko <denys@konsulko.com> > --- > .../ti-devicetree-prefix.bbclass} | 7 +++++-- > meta-ti-bsp/conf/machine/include/ti-soc.inc | 8 ++++++++ > meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb | 2 -- > meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb | 1 - > meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.6.bb | 1 - > 5 files changed, 13 insertions(+), 6 deletions(-) > rename meta-ti-bsp/{recipes-kernel/linux/ti-kernel-devicetree-prefix.inc => classes/ti-devicetree-prefix.bbclass} (87%) > > diff --git a/meta-ti-bsp/recipes-kernel/linux/ti-kernel-devicetree-prefix.inc b/meta-ti-bsp/classes/ti-devicetree-prefix.bbclass > similarity index 87% > rename from meta-ti-bsp/recipes-kernel/linux/ti-kernel-devicetree-prefix.inc > rename to meta-ti-bsp/classes/ti-devicetree-prefix.bbclass > index 2d7be280..5858cc65 100644 > --- a/meta-ti-bsp/recipes-kernel/linux/ti-kernel-devicetree-prefix.inc > +++ b/meta-ti-bsp/classes/ti-devicetree-prefix.bbclass > @@ -1,3 +1,4 @@ > +# Generate list of DTBs from the kernel source > def get_dtbs_from_kernel(dts_dir, dts_prefix): > import os > import glob > @@ -17,6 +18,8 @@ def get_dtbs_from_kernel(dts_dir, dts_prefix): > matches.append(filename) > return ' '.join(matches) > > +# Generate list of "merged" DTBs from the kernel source > +# It is TI custom feature to merge DTB overlays into a single DTB > def get_merge_dtbs_from_kernel(dts_dir, dts_pattern): > import os > matches = [] > @@ -32,9 +35,9 @@ def get_merge_dtbs_from_kernel(dts_dir, dts_pattern): > matches.append(pattern) > return ' '.join(matches) > > -KERNEL_DEVICETREE_DTBMERGE ?= "" > - > KERNEL_DEVICETREE = " \ > ${@get_dtbs_from_kernel('${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/', '${KERNEL_DEVICETREE_PREFIX}')} \ > ${@get_merge_dtbs_from_kernel('${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/', '${KERNEL_DEVICETREE_DTBMERGE}')} \ > " > + > +do_image_wic[depends] += "virtual/kernel:do_shared_workdir" > diff --git a/meta-ti-bsp/conf/machine/include/ti-soc.inc b/meta-ti-bsp/conf/machine/include/ti-soc.inc > index 85f6f338..018e9bfb 100644 > --- a/meta-ti-bsp/conf/machine/include/ti-soc.inc > +++ b/meta-ti-bsp/conf/machine/include/ti-soc.inc With this now part of ti-soc.inc, it seems we should get this feature with any kernel when building for a TI based board, not just when building with TI kernels. Does that mean we can drop all the KERNEL_DEVICETREE lines from the Beagle .conf files? I just tried it and it seems to work correctly. Andrew > @@ -19,3 +19,11 @@ KERNEL_DTBVENDORED = "1" > > # Also build a non-vendored list w/o dir structure > DEVICETREE_FILES = "${@' '.join([os.path.basename(f) for f in d.getVar("KERNEL_DEVICETREE").split()])}" > + > +KERNEL_DEVICETREE_DTBMERGE ?= "" > + > +# Dynamically build DTBs list based on prefix matching > +CLASS_DEVICETREE_PREFIX = "${@ 'ti-devicetree-prefix' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''}" > + > +KERNEL_CLASSES += "${CLASS_DEVICETREE_PREFIX}" > +IMAGE_CLASSES += "${CLASS_DEVICETREE_PREFIX}" > diff --git a/meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb b/meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb > index 1feb7564..60b647f1 100644 > --- a/meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb > +++ b/meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb > @@ -2,8 +2,6 @@ require linux-ti-mainline_git.bb > > SUMMARY = "Linux-next kernel for TI devices" > > -include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''} > - > # 6.6.0-rc3+ version > SRCREV = "6465e260f48790807eef06b583b38ca9789b6072" > PV = "6.6.0-rc3+git" > diff --git a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb > index 9235cbc5..aa677cb2 100644 > --- a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb > +++ b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb > @@ -8,7 +8,6 @@ inherit kernel > > require recipes-kernel/linux/setup-defconfig.inc > require recipes-kernel/linux/ti-kernel.inc > -include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''} > include ${@ 'recipes-kernel/linux/ti-extras.inc' if d.getVar('TI_EXTRAS') else ''} > > DEPENDS += "gmp-native libmpc-native" > diff --git a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.6.bb b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.6.bb > index 17bcd300..d6985b27 100644 > --- a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.6.bb > +++ b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.6.bb > @@ -8,7 +8,6 @@ inherit kernel > > require recipes-kernel/linux/setup-defconfig.inc > require recipes-kernel/linux/ti-kernel.inc > -include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''} > include ${@ 'recipes-kernel/linux/ti-extras.inc' if d.getVar('TI_EXTRAS') else ''} > > DEPENDS += "gmp-native libmpc-native" > > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#18834): https://lists.yoctoproject.org/g/meta-ti/message/18834 > Mute This Topic: https://lists.yoctoproject.org/mt/114344340/3619733 > Group Owner: meta-ti+owner@lists.yoctoproject.org > Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub [afd@ti.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta-ti-bsp/recipes-kernel/linux/ti-kernel-devicetree-prefix.inc b/meta-ti-bsp/classes/ti-devicetree-prefix.bbclass similarity index 87% rename from meta-ti-bsp/recipes-kernel/linux/ti-kernel-devicetree-prefix.inc rename to meta-ti-bsp/classes/ti-devicetree-prefix.bbclass index 2d7be280..5858cc65 100644 --- a/meta-ti-bsp/recipes-kernel/linux/ti-kernel-devicetree-prefix.inc +++ b/meta-ti-bsp/classes/ti-devicetree-prefix.bbclass @@ -1,3 +1,4 @@ +# Generate list of DTBs from the kernel source def get_dtbs_from_kernel(dts_dir, dts_prefix): import os import glob @@ -17,6 +18,8 @@ def get_dtbs_from_kernel(dts_dir, dts_prefix): matches.append(filename) return ' '.join(matches) +# Generate list of "merged" DTBs from the kernel source +# It is TI custom feature to merge DTB overlays into a single DTB def get_merge_dtbs_from_kernel(dts_dir, dts_pattern): import os matches = [] @@ -32,9 +35,9 @@ def get_merge_dtbs_from_kernel(dts_dir, dts_pattern): matches.append(pattern) return ' '.join(matches) -KERNEL_DEVICETREE_DTBMERGE ?= "" - KERNEL_DEVICETREE = " \ ${@get_dtbs_from_kernel('${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/', '${KERNEL_DEVICETREE_PREFIX}')} \ ${@get_merge_dtbs_from_kernel('${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/', '${KERNEL_DEVICETREE_DTBMERGE}')} \ " + +do_image_wic[depends] += "virtual/kernel:do_shared_workdir" diff --git a/meta-ti-bsp/conf/machine/include/ti-soc.inc b/meta-ti-bsp/conf/machine/include/ti-soc.inc index 85f6f338..018e9bfb 100644 --- a/meta-ti-bsp/conf/machine/include/ti-soc.inc +++ b/meta-ti-bsp/conf/machine/include/ti-soc.inc @@ -19,3 +19,11 @@ KERNEL_DTBVENDORED = "1" # Also build a non-vendored list w/o dir structure DEVICETREE_FILES = "${@' '.join([os.path.basename(f) for f in d.getVar("KERNEL_DEVICETREE").split()])}" + +KERNEL_DEVICETREE_DTBMERGE ?= "" + +# Dynamically build DTBs list based on prefix matching +CLASS_DEVICETREE_PREFIX = "${@ 'ti-devicetree-prefix' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''}" + +KERNEL_CLASSES += "${CLASS_DEVICETREE_PREFIX}" +IMAGE_CLASSES += "${CLASS_DEVICETREE_PREFIX}" diff --git a/meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb b/meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb index 1feb7564..60b647f1 100644 --- a/meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb +++ b/meta-ti-bsp/recipes-kernel/linux/linux-ti-next_git.bb @@ -2,8 +2,6 @@ require linux-ti-mainline_git.bb SUMMARY = "Linux-next kernel for TI devices" -include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''} - # 6.6.0-rc3+ version SRCREV = "6465e260f48790807eef06b583b38ca9789b6072" PV = "6.6.0-rc3+git" diff --git a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb index 9235cbc5..aa677cb2 100644 --- a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb +++ b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.12.bb @@ -8,7 +8,6 @@ inherit kernel require recipes-kernel/linux/setup-defconfig.inc require recipes-kernel/linux/ti-kernel.inc -include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''} include ${@ 'recipes-kernel/linux/ti-extras.inc' if d.getVar('TI_EXTRAS') else ''} DEPENDS += "gmp-native libmpc-native" diff --git a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.6.bb b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.6.bb index 17bcd300..d6985b27 100644 --- a/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.6.bb +++ b/meta-ti-bsp/recipes-kernel/linux/linux-ti-staging_6.6.bb @@ -8,7 +8,6 @@ inherit kernel require recipes-kernel/linux/setup-defconfig.inc require recipes-kernel/linux/ti-kernel.inc -include ${@ 'recipes-kernel/linux/ti-kernel-devicetree-prefix.inc' if d.getVar('KERNEL_DEVICETREE_PREFIX') else ''} include ${@ 'recipes-kernel/linux/ti-extras.inc' if d.getVar('TI_EXTRAS') else ''} DEPENDS += "gmp-native libmpc-native"