Ptest is disabled in tdx-base.inc

We develp our own yocto linux, based on Toradex’ BSP 7 (yocto scarthgap).

For some of our recipes (not all that are used), we’d like to use yocto’s ptest functionality to automatically generate test runners.

Currently, it is not (easily) possible, because in tdx-base.inc, it is removed from the DISTRO_FEATURES: https://git.toradex.com/cgit/meta-toradex-distro.git/tree/conf/distro/include/tdx-base.inc?h=scarthgap-7.x.y#n74

Because this happens in an .inc file, it is not easy to overwrite this setting. Is there a reason why this needs to be disabled like this? Could you use another approach/file, where the user of your BSP could overwrite this setting easier?

I can make ptest work, for a specific package, when I uncomment this line in your layer as a workaround, and in our distro.conf add DISTRO_FEATURES:append:pn-xxx = " ptest"

Thanks and regards,

Simon

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


(1), (2), (3), (4).

Enabling ptest in Toradex BSP 7 (Yocto Scarthgap)

Based on the Toradex BSP documentation, you’re working with the Yocto Project/OpenEmbedded build system that Toradex uses for their Reference Images (1). The Toradex BSP layers provide production-quality BSP layers for Yocto Project (2).

Understanding the Current Configuration

The ptest feature is disabled in the Toradex distribution configuration for performance and image size optimization reasons. This is a deliberate design choice in the Toradex BSP layers to keep the reference images lean and focused on production use cases.

Recommended Approaches to Enable ptest

Here are several approaches you can use to enable ptest functionality in your custom Yocto build based on Toradex BSP:

Option 1: Custom Distribution Configuration

Create your own distribution configuration file that inherits from the Toradex base but adds ptest support:

  1. Create a custom distro configuration file (e.g., mydistro.conf)
  2. Include the Toradex base configuration
  3. Add ptest to DISTRO_FEATURES after the base configuration

Option 2: Local Configuration Override

In your local.conf file, you can override the DISTRO_FEATURES:

DISTRO_FEATURES:append = " ptest"

Option 3: Custom Meta Layer

Create your own meta layer that provides a bbappend or custom configuration to enable ptest functionality for specific packages or globally.

Working with Toradex BSP Layers

When customizing Toradex BSP builds, the recommended approach is to create your own custom layers rather than modifying the Toradex-provided layers directly (1). This ensures you can:

  • Maintain compatibility with Toradex updates
  • Keep your customizations separate and manageable
  • Follow Yocto Project best practices for layer management

The Toradex BSP layers are designed to be extensible, and creating custom layers for your specific requirements is the intended workflow (2).

SDK Generation Considerations

If you’re planning to use ptest with SDK generation, note that Toradex provides guidance on creating custom SDKs from their images (3). You can generate SDKs that include ptest functionality by ensuring the feature is enabled in your build configuration.

Your workaround approach of modifying the distro configuration and using per-package ptest enabling is technically sound, but implementing it through a custom distribution or meta layer would be more maintainable for production use.

Best regards, Toradex AI Assistant.

Hello @SimonG,

My understanding is that ptests are disabled by default because they would unnecessarily grow the resulting image.
Maybe it could be done in another way, however I believe that the workaround below should be adequate for this use case.


Do you mean that when you comment (not uncomment) this line in our layer?
If yes, an alternative I see here is to use the forcevariable:

DISTRO_FEATURES:forcevariable:pn-xxx = "${DISTRO_FEATURES} ptest"

This way you should be able to keep the line uncommented in our layer.

Best Regards,
Bruno

Hello @bruno.tx

Thanks for your response!

I mean it makes totally sense to disable by default, but it should be easier to enable it again for the user imo if possible.

Oh, yes ofc I mean comment, typo.

I tried several variations with forcevariable already (in distro.conf), unfortunately none seems to work:

Your suggestion ends in a recursion error, this:

DISTRO_FEATURES:forcevariable:append:pn-xxx = " ptest"

Doesn’t work (Nothing RPROVIDES xxx-ptest, but…. RDEPENDS or otherwise requires it)

I also tried setting in local.conf (Using kas, so actually in the .yml files) but that didn’t work either.

Regards

Simon

Hello @SimonG,

Understood, I will take another look at this and get back to you.

Best Regards,
Bruno

1 Like

Hello @SimonG,

To enable ptests for a specific package, you can add the following:

PTEST_ENABLED:pn-<package> = "1"

That being said, a more ideal solution to what we have on tdx-base.inc would most likely be to use a variable that is used in :remove and can be therefore modified.
I will check internally on this topic.

Best Regards,
Bruno

Hello @bruno.tx

Thanks for your Response.

I can confirm that using this helps, I am able to enable specific ptests now, without needing to modify toradex’ layer. If there’s a better/easier solution in the future, I think I’ll switch to using that, but I can live with this for now.

Thanks for your investigation!

Regards,

Simon

1 Like

Hello @SimonG,

Thanks for the update.

We will discuss internally if we change this .inc to have something like the following in the future:

DISTRO_FEATURES_REMOVE ?= "sysvinit ptest"
DISTRO_FEATURES:remove = "${DISTRO_FEATURES_REMOVE}"

However, please don’t expect such change in the near future.

Best Regards,
Bruno