TorizonCore-Builder results in error during parse

Hi,

I am trying to build a custom Torizon OS image with my docker container bundled in. I created a python project for my IMX7D and I am using an Aster carrier board.

I ran the task create-production-image in VS code to create the docker image of my project. A docker-compose.prod.yml file was created. I copied that file over to a working directory /tcbdir separate from my project directory. I renamed the file docker-compose.yml

docker-compose.yml (379 Bytes)

I am following the instructions for creating a custom OS here:

and here:

I am getting an error when I run the torizoncore-builder build command.

🐧 SAbrahamian @MU69-PC~/tcbdir: torizoncore-builder buildBuilding image as per configuration file ‘tcbuild.yaml’…
=>> Handling input sectionUnpacking Toradex Easy Installer image.Unpacking TorizonCore Toradex Easy Installer image.Importing OSTree revision 0411a81467b1e333bed5679890b881f4d1ffdb95c274dddb6c9f3e60555015fe from local repository…1224 metadata, 9602 content objects imported; 491.9 MB content written0 metadata, 0 content objects imported; 0 bytes content writtenUnpacked OSTree from Toradex Easy Installer image:Commit checksum: 0411a81467b1e333bed5679890b881f4d1ffdb95c274dddb6c9f3e60555015feTorizonCore Version: 7.4.0+build.28
=>> Handling customization section
=> Handling device-tree subsection
=> Selecting custom device-tree ‘linux/arch/arm/boot/dts/nxp/imx/imx7d-colibri-aster.dts’Compiling Device Tree with DTC 1.6.0…‘imx7d-colibri-aster.dts’ compiles successfully.warning: removing currently applied device tree overlaysDevice tree imx7d-colibri-aster.dtb successfully applied.
=> Adding device-tree overlay ‘device-trees/overlays/colibri-imx7_vga-640x480_overlay.dts’Compiling Device Tree with DTC 1.6.0…device-trees/overlays/colibri-imx7_vga-640x480_overlay.dts:14:10: fatal error: imx7d-pinfunc.h: No such file or directory14 | #include <imx7d-pinfunc.h>|          ^~~~~~~~~~~~~~~~~compilation terminated.Error: device-trees/overlays/colibri-imx7_vga-640x480_overlay.dts:13.68-14.1 syntax errorFATAL ERROR: Unable to parse input treeerror: cannot apply device-trees/overlays/colibri-imx7_vga-640x480_overlay.dts.

Any help is appreciated.

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Fixing the Device Tree Include Directory Error

The error you’re encountering is due to missing include directories for device tree compilation (1). The overlay file colibri-imx7_vga-640x480_overlay.dts is trying to include imx7d-pinfunc.h but TorizonCore Builder cannot find this header file.

Solution

You need to add the include-dirs property to your tcbuild.yaml file to specify where the device tree header files are located (1)(2).

First, checkout the device tree sources using TorizonCore Builder:

torizoncore-builder dt checkout

Then, modify your tcbuild.yaml file to include the include directories (1)(2):

input:
  easy-installer:
    local: your-input-image.tar

customization:
  device-tree:
    include-dirs:
      - device-trees/include/
    custom: linux/arch/arm/boot/dts/nxp/imx/imx7d-colibri-aster.dts
    overlays:
      add:
        - device-trees/overlays/colibri-imx7_vga-640x480_overlay.dts

output:
  easy-installer:
    local: your-custom-image
    bundle:
      compose-file: docker-compose.yml

Key Points

  1. Include Directories: The include-dirs property tells TorizonCore Builder where to find header files like imx7d-pinfunc.h (1)(2)

  2. Device Tree Checkout: Use torizoncore-builder dt checkout to get the complete device tree source files and overlays (1)

  3. Header File Location: For Colibri iMX7, the header file is located at device-trees/dts-arm32/imx7d-pinfunc.h (1)

  4. Bundle Integration: Your Docker Compose file can be integrated directly using the compose-file property, which handles both bundling and combining in one step (3)

Alternative Approach

If you prefer to use the bundle command separately, you can:

  1. Bundle your containers first:
torizoncore-builder bundle --platform=linux/arm docker-compose.yml --bundle-directory bundle
  1. Then reference the bundle directory in your tcbuild.yaml:
output:
  easy-installer:
    local: your-custom-image
    bundle:
      dir: bundle/

This approach downloads container images once during bundling, making subsequent builds faster (3).

Best regards, Toradex AI Assistant.


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

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

@ToradexAI

My tcbuild.yaml file does have the proper directory listed in the include-dirs section.

tcbuild.yaml (1.7 KB)

I still get the error when running the torizoncore-builder build command.

Missing Header File Location

The error indicates that the imx7d-pinfunc.h file cannot be found during device tree overlay compilation (1). For i.MX 6/6ULL/7 modules, you need to ensure you have the correct Linux kernel source and include directories (2).

Solution Steps

1. Clone the Correct Linux Kernel Source

For your Colibri iMX7D module, you need to clone the specific kernel branch (2):

git clone -b toradex_6.6-2.2.x-imx git://git.toradex.com/linux-toradex.git linux

(2)

2. Update Your Include Directories

Your tcbuild.yaml should include both the device-trees include directory and the Linux kernel include directory (3), (4):

customization:
  device-tree:
    include-dirs:
      # Folder containing overlays included by your overlay
      - device-trees/overlays
      # Folder that contains common kernel header files
      - linux/include
      # Folder that contains NXP-specific header files for i.MX
      - linux/arch/arm/boot/dts/nxp/imx/
    custom: linux/arch/arm/boot/dts/nxp/imx/imx7d-colibri-aster.dts
    overlays:
      add:
        - device-trees/overlays/colibri-imx7_vga-640x480_overlay.dts

(3), (4)

3. Verify Directory Structure

Ensure your project directory structure looks like this (2):

.
├── linux
├── device-trees
│  └── overlays
│       └── colibri-imx7_vga-640x480_overlay.dts
├── tcbuild.yaml
└── your-torizon-image.tar

(2)

4. Check Header File Location

For NXP-based SoMs like your iMX7D, the SoC-specific headers are located in linux/arch/arm/boot/dts/nxp/imx/ (4). Make sure the imx7d-pinfunc.h file exists in this location after cloning the kernel source.

The key issue is likely that you need the Linux kernel source with the correct header files, not just the device-trees directory. The imx7d-pinfunc.h file is part of the kernel source tree (2).

Best regards, Toradex AI Assistant.


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

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

@ToradexAI Adding the NXP specific header file directory helped. I now get a different error. The error I am seeing is error trying to bundle docker containers.

🐧 SAbrahamian @MU69-PC~/tcbdir: torizoncore-builder buildBuilding image as per configuration file ‘tcbuild.yaml’…
=>> Handling input sectionUnpacking Toradex Easy Installer image.Unpacking TorizonCore Toradex Easy Installer image.Importing OSTree revision 0411a81467b1e333bed5679890b881f4d1ffdb95c274dddb6c9f3e60555015fe from local repository…1224 metadata, 9602 content objects imported; 491.9 MB content written0 metadata, 0 content objects imported; 0 bytes content writtenUnpacked OSTree from Toradex Easy Installer image:Commit checksum: 0411a81467b1e333bed5679890b881f4d1ffdb95c274dddb6c9f3e60555015feTorizonCore Version: 7.4.0+build.28
=>> Handling customization section
=> Handling device-tree subsection
=> Selecting custom device-tree ‘linux/arch/arm/boot/dts/nxp/imx/imx7d-colibri-aster.dts’Compiling Device Tree with DTC 1.6.0…‘imx7d-colibri-aster.dts’ compiles successfully.warning: removing currently applied device tree overlaysDevice tree imx7d-colibri-aster.dtb successfully applied.
=> Adding device-tree overlay ‘device-trees/overlays/colibri-imx7_vga-640x480_overlay.dts’Compiling Device Tree with DTC 1.6.0…‘colibri-imx7_vga-640x480_overlay.dts’ compiles successfully./tmp/tmph66bm923: Device Tree Blob version 17, size=57484, boot CPU=0, string block size=4860, DT structure block size=52568‘colibri-imx7_vga-640x480_overlay.dtbo’ can successfully modify the device tree ‘imx7d-colibri-aster.dtb’.Overlay colibri-imx7_vga-640x480_overlay.dtbo successfully applied.
=>> Handling output sectionApplying changes from STORAGE/dt.Commit 08a1f11c8a58a8846ce1b79f9afefe1949b0e2fc1cb3da7142c31b6d797b039e has been generated for changes and is ready to be deployed.Deploying commit ref: tcbuilder-20251117170737Pulling OSTree with ref tcbuilder-20251117170737 from local archive repository…Commit checksum: 08a1f11c8a58a8846ce1b79f9afefe1949b0e2fc1cb3da7142c31b6d797b039eTorizonCore Version: 7.4.0+build.28-tcbuilder.20251117170737Default kernel arguments: quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3
1224 metadata, 9603 content objects imported; 491.9 MB content writtenPulling done.Deploying OSTree with checksum 08a1f11c8a58a8846ce1b79f9afefe1949b0e2fc1cb3da7142c31b6d797b039eBootloader found in unpacked image: U-BootDeploying done.Copy files not under OSTree control from original deployment.Packing rootfs…Packing rootfs done.Bundling images to directory bundle_20251117170740_452258.tmpNOTE: TCB no longer expands environment variables present in the compose file.
Starting DIND containerConnecting to Docker Daemon at “tcp://172.17.0.4:22376”Fetching container image sabrahamian/snmptoserial-container:v0.0.0 in service snmptoserial-containerStopping DIND containerRemoving output directory ‘custom-torizon-docker-colibri-imx7-snmptoserial’ due to build errorsError: Error trying to bundle Docker containers

Do I need to specify my docker hub login and password in my tcbuild.yaml file?

Docker Registry Authentication Required

The error “Error trying to bundle Docker containers” occurs when TorizonCore Builder cannot pull your container image from the registry (1). Since you’re using a custom image sabrahamian/snmptoserial-container:v0.0.0, you likely need to provide authentication credentials.

Solution Options

Option 1: Add Credentials to tcbuild.yaml

You can add your Docker Hub credentials directly in the tcbuild.yaml file (1), (2):

output:
  easy-installer:
    local: custom-torizon-docker-colibri-imx7-snmptoserial
    bundle:
      compose-file: docker-compose.yml
      username: your-dockerhub-username
      password: your-dockerhub-password

(1), (2)

Option 2: Use Variable Substitution (Recommended)

For better security, use variable substitution to keep credentials out of your configuration file (3):

output:
  easy-installer:
    local: custom-torizon-docker-colibri-imx7-snmptoserial
    bundle:
      compose-file: docker-compose.yml
      username: "${DOCKER_USERNAME}"
      password: "${DOCKER_PASSWORD}"

(3)

Then run the build command with environment variables:

DOCKER_USERNAME=your-username DOCKER_PASSWORD=your-password torizoncore-builder build

(3)

Option 3: Use Bundle Command with Login Parameters

Alternatively, you can use the separate bundle command with login parameters (4):

torizoncore-builder bundle --platform=linux/arm docker-compose.yml --bundle-directory bundle --login your-username your-password

(4)

Then modify your tcbuild.yaml to use the pre-bundled directory (1):

output:
  easy-installer:
    local: custom-torizon-docker-colibri-imx7-snmptoserial
    bundle:
      dir: bundle/

(1)

Key Points

  • Private Registry Access: If your image is private on Docker Hub, authentication is required (1)
  • Security: Use variable substitution to avoid storing credentials in configuration files (3)
  • Platform Specification: For i.MX7D (32-bit ARM), use --platform=linux/arm/v7 (1)

The variable substitution approach is recommended as it keeps sensitive credentials out of your version-controlled configuration files (3).

Best regards, Toradex AI Assistant.


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

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

@ToradexAI I have modified my tcbuild.yaml to include variable for my docker hub username and password. I am still getting an error.

tcbuild.yaml (2.0 KB)

🐧 SAbrahamian @MU69-PC~/tcbdir: DOCKER_USERNAME=my-username DOCKER_PASSWORD=my-password torizoncore-builder buildBuilding image as per configuration file ‘tcbuild.yaml’…Variable DOCKER_USERNAME is not set: assuming an empty stringVariable DOCKER_PASSWORD is not set: assuming an empty string
=>> Handling input sectionUnpacking Toradex Easy Installer image.Unpacking TorizonCore Toradex Easy Installer image.Importing OSTree revision 0411a81467b1e333bed5679890b881f4d1ffdb95c274dddb6c9f3e60555015fe from local repository…1224 metadata, 9602 content objects imported; 491.9 MB content written0 metadata, 0 content objects imported; 0 bytes content writtenUnpacked OSTree from Toradex Easy Installer image:Commit checksum: 0411a81467b1e333bed5679890b881f4d1ffdb95c274dddb6c9f3e60555015feTorizonCore Version: 7.4.0+build.28
=>> Handling customization section
=> Handling device-tree subsection
=> Selecting custom device-tree ‘linux/arch/arm/boot/dts/nxp/imx/imx7d-colibri-aster.dts’Compiling Device Tree with DTC 1.6.0…‘imx7d-colibri-aster.dts’ compiles successfully.warning: removing currently applied device tree overlaysDevice tree imx7d-colibri-aster.dtb successfully applied.
=> Adding device-tree overlay ‘device-trees/overlays/colibri-imx7_vga-640x480_overlay.dts’Compiling Device Tree with DTC 1.6.0…‘colibri-imx7_vga-640x480_overlay.dts’ compiles successfully./tmp/tmpp325uxho: Device Tree Blob version 17, size=57484, boot CPU=0, string block size=4860, DT structure block size=52568‘colibri-imx7_vga-640x480_overlay.dtbo’ can successfully modify the device tree ‘imx7d-colibri-aster.dtb’.Overlay colibri-imx7_vga-640x480_overlay.dtbo successfully applied.
=>> Handling output sectionApplying changes from STORAGE/dt.Commit 9510d51be10fa5a988e65a6b2784e20924929c576975d6b7d80041f6578b3129 has been generated for changes and is ready to be deployed.Deploying commit ref: tcbuilder-20251117173131Pulling OSTree with ref tcbuilder-20251117173131 from local archive repository…Commit checksum: 9510d51be10fa5a988e65a6b2784e20924929c576975d6b7d80041f6578b3129TorizonCore Version: 7.4.0+build.28-tcbuilder.20251117173131Default kernel arguments: quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3
1224 metadata, 9603 content objects imported; 491.9 MB content writtenPulling done.Deploying OSTree with checksum 9510d51be10fa5a988e65a6b2784e20924929c576975d6b7d80041f6578b3129Bootloader found in unpacked image: U-BootDeploying done.Copy files not under OSTree control from original deployment.Packing rootfs…Packing rootfs done.Bundling images to directory bundle_20251117173134_382932.tmpNOTE: TCB no longer expands environment variables present in the compose file.
Starting DIND containerConnecting to Docker Daemon at “tcp://172.17.0.4:22376”Fetching container image sabrahamian/snmptoserial-container:v0.0.0 in service snmptoserial-containerStopping DIND containerRemoving output directory ‘custom-torizon-docker-colibri-imx7-snmptoserial’ due to build errorsError: Error trying to bundle Docker containers

Variable Substitution Issue

The error shows that TorizonCore Builder is not recognizing your environment variables. The message “Variable DOCKER_USERNAME is not set: assuming an empty string” indicates the variable substitution isn’t working properly (1).

Solutions

Option 1: Use --set Command Line Parameters

Instead of environment variables, use the --set parameter to pass variables (1):

torizoncore-builder build --set DOCKER_USERNAME=my-username --set DOCKER_PASSWORD=my-password

(1)

Option 2: Fix Variable Substitution Format

Ensure your tcbuild.yaml uses the correct variable substitution format (1):

output:
  easy-installer:
    local: custom-torizon-docker-colibri-imx7-snmptoserial
    bundle:
      compose-file: docker-compose.yml
      username: "${DOCKER_USERNAME}"
      password: "${DOCKER_PASSWORD}"

(1)

Option 3: Use the Bundle Command Separately

Based on the community discussion, you can use the separate bundle command with authentication (2):

torizoncore-builder bundle --platform=linux/arm/v7 docker-compose.yml --bundle-directory bundle --login my-username my-password

(3)

Then modify your tcbuild.yaml to reference the pre-bundled directory (3):

output:
  easy-installer:
    local: custom-torizon-docker-colibri-imx7-snmptoserial
    bundle:
      dir: bundle/

(3)

Key Points

  • Platform Specification: For i.MX7D modules, use --platform=linux/arm/v7 (3)
  • Authentication: Private Docker images require proper authentication credentials (3)
  • Variable Format: Use ${VAR} format for variable substitution (1)
  • Command Line Variables: The --set parameter is more reliable than environment variables (1)

The separate bundle approach (Option 3) is often more reliable when dealing with authentication issues, as it handles the Docker registry login separately from the image building process (3).

Best regards, Toradex AI Assistant.


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

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

@ToradexAI

The command torizoncore-builder build --set DOCKER_USERNAME=my-username --set DOCKER_PASSWORD=my-password worked.

I also commented out the line registry: hub.docker.com in the output: easy-installer: bundle: section of my tcbuild.yaml file.

Hey @SAbrahamian ,

Looks like you have some solutions with the AI system. Would you say this issue is fully solved now?

-Eric

Hi @eric.tx,

Yes, I was able to create a custom OS image with my container bundled. My next step is to use the Easy Installer to flash the image to a new IMX7 and do a bench test to ensure proper functionality.

Thanks,

-Simon