diff mbox series

[scarthgap/master] ti-sgx-ddk-km: work around incorrect target name selection

Message ID 20250306141217.346689-1-matthias.schiffer@ew.tq-group.com
State Rejected
Delegated to: Ryan Eatmon
Headers show
Series [scarthgap/master] ti-sgx-ddk-km: work around incorrect target name selection | expand

Commit Message

Matthias Schiffer March 6, 2025, 2:12 p.m. UTC
The omap5-sgx-ddk-linux Makefiles contain a list of target triple
patterns that are detected as "Yocto" to deal with arm vs. armhf target
selection. This breaks for Yocto distros that override TARGET_VENDOR,
requiring patches like [1]; similar patches can also be found in other
vendors' machine layers.

Work around the incorrect target selection by passing TARGET_PRIMARY_ARCH
via EXTRA_OEMAKE.

[1] https://github.com/tq-systems/meta-tq/blob/scarthgap.TQ.ARM.BSP.0003/meta-tq/dynamic-layers/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km/linux-5.10/0001-ti-sgx-ddk-km-properly-handle-more-OE-YP-compiler-pr.patch

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
---

Tested with meta-tq + meta-ti scarthgap for am335x.

 .../powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb     | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Denys Dmytriyenko March 14, 2025, 9:41 p.m. UTC | #1
+ Randolph Sapp as a domain expert here


On Thu, Mar 06, 2025 at 03:12:17PM +0100, Matthias Schiffer via lists.yoctoproject.org wrote:
> The omap5-sgx-ddk-linux Makefiles contain a list of target triple
> patterns that are detected as "Yocto" to deal with arm vs. armhf target
> selection. This breaks for Yocto distros that override TARGET_VENDOR,
> requiring patches like [1]; similar patches can also be found in other
> vendors' machine layers.
> 
> Work around the incorrect target selection by passing TARGET_PRIMARY_ARCH
> via EXTRA_OEMAKE.
> 
> [1] https://github.com/tq-systems/meta-tq/blob/scarthgap.TQ.ARM.BSP.0003/meta-tq/dynamic-layers/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km/linux-5.10/0001-ti-sgx-ddk-km-properly-handle-more-OE-YP-compiler-pr.patch
> 
> Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
> ---
> 
> Tested with meta-tq + meta-ti scarthgap for am335x.
> 
>  .../powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb     | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb b/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
> index 49376221..aaeee1d2 100644
> --- a/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
> +++ b/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
> @@ -28,8 +28,11 @@ TARGET_PRODUCT:am65xx = "ti654x_linux"
>  PVR_BUILD = "release"
>  PVR_WS = "lws-generic"
>  
> +TARGET_PRIMARY_ARCH = "target_armhf"
> +TARGET_PRIMARY_ARCH:aarch64 = "target_aarch64"
> +
>  EXTRA_OEMAKE += 'KERNELDIR="${STAGING_KERNEL_DIR}" BUILD=${PVR_BUILD} \
> -WINDOW_SYSTEM=${PVR_WS} PVR_BUILD_DIR=${TARGET_PRODUCT}'
> +WINDOW_SYSTEM=${PVR_WS} PVR_BUILD_DIR=${TARGET_PRODUCT} TARGET_PRIMARY_ARCH=${TARGET_PRIMARY_ARCH}'
>  
>  # There are useful flags here that are interpreted by the final kbuild pass
>  # These variables are not necessary when compiling outside of Yocto
> @@ -40,11 +43,7 @@ export KERNEL_OBJCOPY
>  export KERNEL_STRIP
>  
>  do_install() {
> -    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/target_armhf/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
> -}
> -
> -do_install:am65xx() {
> -    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/target_aarch64/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
> +    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/${TARGET_PRIMARY_ARCH}/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
>  }
>  
>  RRECOMMENDS:${PN} += "ti-sgx-ddk-um"
Randolph Sapp March 18, 2025, 7:49 p.m. UTC | #2
On Fri Mar 14, 2025 at 4:41 PM CDT, Denys Dmytriyenko wrote:
> + Randolph Sapp as a domain expert here
>
>
> On Thu, Mar 06, 2025 at 03:12:17PM +0100, Matthias Schiffer via lists.yoctoproject.org wrote:
>> The omap5-sgx-ddk-linux Makefiles contain a list of target triple
>> patterns that are detected as "Yocto" to deal with arm vs. armhf target
>> selection. This breaks for Yocto distros that override TARGET_VENDOR,
>> requiring patches like [1]; similar patches can also be found in other
>> vendors' machine layers.
>> 
>> Work around the incorrect target selection by passing TARGET_PRIMARY_ARCH
>> via EXTRA_OEMAKE.
>> 
>> [1] https://github.com/tq-systems/meta-tq/blob/scarthgap.TQ.ARM.BSP.0003/meta-tq/dynamic-layers/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km/linux-5.10/0001-ti-sgx-ddk-km-properly-handle-more-OE-YP-compiler-pr.patch
>> 
>> Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
>> ---
>> 
>> Tested with meta-tq + meta-ti scarthgap for am335x.
>> 
>>  .../powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb     | 11 +++++------
>>  1 file changed, 5 insertions(+), 6 deletions(-)
>> 
>> diff --git a/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb b/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
>> index 49376221..aaeee1d2 100644
>> --- a/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
>> +++ b/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
>> @@ -28,8 +28,11 @@ TARGET_PRODUCT:am65xx = "ti654x_linux"
>>  PVR_BUILD = "release"
>>  PVR_WS = "lws-generic"
>>  
>> +TARGET_PRIMARY_ARCH = "target_armhf"
>> +TARGET_PRIMARY_ARCH:aarch64 = "target_aarch64"
>> +
>>  EXTRA_OEMAKE += 'KERNELDIR="${STAGING_KERNEL_DIR}" BUILD=${PVR_BUILD} \
>> -WINDOW_SYSTEM=${PVR_WS} PVR_BUILD_DIR=${TARGET_PRODUCT}'
>> +WINDOW_SYSTEM=${PVR_WS} PVR_BUILD_DIR=${TARGET_PRODUCT} TARGET_PRIMARY_ARCH=${TARGET_PRIMARY_ARCH}'
>>  
>>  # There are useful flags here that are interpreted by the final kbuild pass
>>  # These variables are not necessary when compiling outside of Yocto
>> @@ -40,11 +43,7 @@ export KERNEL_OBJCOPY
>>  export KERNEL_STRIP
>>  
>>  do_install() {
>> -    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/target_armhf/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
>> -}
>> -
>> -do_install:am65xx() {
>> -    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/target_aarch64/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
>> +    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/${TARGET_PRIMARY_ARCH}/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
>>  }
>>  
>>  RRECOMMENDS:${PN} += "ti-sgx-ddk-um"

NAK, in my opinion this should not be handled by the Yocto recipe and instead
the compiler patterns need to be updated to properly match the given compiler.
I'll update the source repo and this recipe to resolve the issue outlined above.
Matthias Schiffer March 19, 2025, 8:15 a.m. UTC | #3
On Tue, 2025-03-18 at 14:49 -0500, Randolph Sapp wrote:
> ********************
> Achtung externe E-Mail: Öffnen Sie Anhänge und Links nur, wenn Sie wissen, dass diese aus einer sicheren Quelle stammen und sicher sind. Leiten Sie die E-Mail im Zweifelsfall zur Prüfung an den IT-Helpdesk weiter.
> Attention external email: Open attachments and links only if you know that they are from a secure source and are safe. In doubt forward the email to the IT-Helpdesk to check it.
> ********************
> 
> On Fri Mar 14, 2025 at 4:41 PM CDT, Denys Dmytriyenko wrote:
> > + Randolph Sapp as a domain expert here
> > 
> > 
> > On Thu, Mar 06, 2025 at 03:12:17PM +0100, Matthias Schiffer via lists.yoctoproject.org wrote:
> > > The omap5-sgx-ddk-linux Makefiles contain a list of target triple
> > > patterns that are detected as "Yocto" to deal with arm vs. armhf target
> > > selection. This breaks for Yocto distros that override TARGET_VENDOR,
> > > requiring patches like [1]; similar patches can also be found in other
> > > vendors' machine layers.
> > > 
> > > Work around the incorrect target selection by passing TARGET_PRIMARY_ARCH
> > > via EXTRA_OEMAKE.
> > > 
> > > [1] https://github.com/tq-systems/meta-tq/blob/scarthgap.TQ.ARM.BSP.0003/meta-tq/dynamic-layers/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km/linux-5.10/0001-ti-sgx-ddk-km-properly-handle-more-OE-YP-compiler-pr.patch
> > > 
> > > Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
> > > ---
> > > 
> > > Tested with meta-tq + meta-ti scarthgap for am335x.
> > > 
> > >  .../powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb     | 11 +++++------
> > >  1 file changed, 5 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb b/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
> > > index 49376221..aaeee1d2 100644
> > > --- a/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
> > > +++ b/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
> > > @@ -28,8 +28,11 @@ TARGET_PRODUCT:am65xx = "ti654x_linux"
> > >  PVR_BUILD = "release"
> > >  PVR_WS = "lws-generic"
> > >  
> > > +TARGET_PRIMARY_ARCH = "target_armhf"
> > > +TARGET_PRIMARY_ARCH:aarch64 = "target_aarch64"
> > > +
> > >  EXTRA_OEMAKE += 'KERNELDIR="${STAGING_KERNEL_DIR}" BUILD=${PVR_BUILD} \
> > > -WINDOW_SYSTEM=${PVR_WS} PVR_BUILD_DIR=${TARGET_PRODUCT}'
> > > +WINDOW_SYSTEM=${PVR_WS} PVR_BUILD_DIR=${TARGET_PRODUCT} TARGET_PRIMARY_ARCH=${TARGET_PRIMARY_ARCH}'
> > >  
> > >  # There are useful flags here that are interpreted by the final kbuild pass
> > >  # These variables are not necessary when compiling outside of Yocto
> > > @@ -40,11 +43,7 @@ export KERNEL_OBJCOPY
> > >  export KERNEL_STRIP
> > >  
> > >  do_install() {
> > > -    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/target_armhf/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
> > > -}
> > > -
> > > -do_install:am65xx() {
> > > -    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/target_aarch64/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
> > > +    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/${TARGET_PRIMARY_ARCH}/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
> > >  }
> > >  
> > >  RRECOMMENDS:${PN} += "ti-sgx-ddk-um"
> 
> NAK, in my opinion this should not be handled by the Yocto recipe and instead
> the compiler patterns need to be updated to properly match the given compiler.
> I'll update the source repo and this recipe to resolve the issue outlined above.

Thanks, that makes sense.

The whole point of matching these patterns appears to be to detect Yocto
compilers, which do not add the "hf" suffix in their target names. The problem
is that there is no single pattern that matches all (and only) Yocto compilers
because many BSP vendors include their own name in the toolchain tuple.

However, I'm not sure why that even matters - there don't seem to be any flags
set specifically for hard or soft float. Maybe the whole detection should just
be removed, using whatever CROSS_COMPILER is set and not caring about the target
name at all?

Best,
Matthias
diff mbox series

Patch

diff --git a/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb b/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
index 49376221..aaeee1d2 100644
--- a/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
+++ b/meta-ti-bsp/recipes-bsp/powervr-drivers/ti-sgx-ddk-km_1.17.4948957.bb
@@ -28,8 +28,11 @@  TARGET_PRODUCT:am65xx = "ti654x_linux"
 PVR_BUILD = "release"
 PVR_WS = "lws-generic"
 
+TARGET_PRIMARY_ARCH = "target_armhf"
+TARGET_PRIMARY_ARCH:aarch64 = "target_aarch64"
+
 EXTRA_OEMAKE += 'KERNELDIR="${STAGING_KERNEL_DIR}" BUILD=${PVR_BUILD} \
-WINDOW_SYSTEM=${PVR_WS} PVR_BUILD_DIR=${TARGET_PRODUCT}'
+WINDOW_SYSTEM=${PVR_WS} PVR_BUILD_DIR=${TARGET_PRODUCT} TARGET_PRIMARY_ARCH=${TARGET_PRIMARY_ARCH}'
 
 # There are useful flags here that are interpreted by the final kbuild pass
 # These variables are not necessary when compiling outside of Yocto
@@ -40,11 +43,7 @@  export KERNEL_OBJCOPY
 export KERNEL_STRIP
 
 do_install() {
-    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/target_armhf/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
-}
-
-do_install:am65xx() {
-    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/target_aarch64/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
+    make -C ${STAGING_KERNEL_DIR} M=${B}/eurasiacon/binary_${TARGET_PRODUCT}_${PVR_WS}_${PVR_BUILD}/${TARGET_PRIMARY_ARCH}/kbuild INSTALL_MOD_PATH=${D}${root_prefix} PREFIX=${STAGING_DIR_HOST} modules_install
 }
 
 RRECOMMENDS:${PN} += "ti-sgx-ddk-um"