Creating usb.img from tezi

Hi Folks,

I am migrating my firmware from rocko to Scarthgap. In rocko we used to generate a usb.img from adding image_type=tar.bz2 and after extracting it has a script named update.sh, which we used to create a usb.img (for firmware updating directly using gpg keys). But now after migration, i can only tezi files, even after adding image_type=tar.bz2 to my yocto image, it doesnot generate the tar.bz2 with update.sh. Thank you

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:


Migration from Rocko to Scarthgap: Changes to Image Deployment Process

The change you’re experiencing is due to significant updates in Toradex’s image deployment process between the older Rocko release and the current Scarthgap BSP.

What Changed

In the current BSP 7.x.y (Scarthgap), Toradex has moved to using Toradex Easy Installer (Tezi) as the primary deployment method(1). The traditional update.sh script and tar.bz2 deployment packages are no longer generated by default.

Current Deployment Method

After building your image with bitbake, the output will be located at build/deploy/images/${MACHINE}/(1). The recommended deployment method is now using the Tezi image generated in the build process (e.g., Verdin-iMX8MP_Reference-Minimal-Image-Tezi_6.0.0-devel-20221021202153+build.0.tar)(1).

You can deploy the image to your board using Toradex Easy Installer (Tezi)(1).

Legacy Support Considerations

The documentation indicates that the meta-toradex layer previously contained a custom image deployment process where “a custom step combines our flashing utilities and scripts (e.g. update.sh) and creates a single distributable tar.bz2 package”(2). However, this customization is not applied to current image builds(2).

Recommended Migration Path

For your migration from Rocko to Scarthgap:

  1. Update your deployment process to use Toradex Easy Installer instead of the legacy update.sh script
  2. Build your images using the current Yocto build process as documented(1)
  3. Deploy using Tezi - the generated Tezi images provide a more robust and secure deployment method

Build Artifacts Location

The current build artifacts can be found at(1):

  • For images, u-boot, uImage, rootfs, deployable tarball: build/deploy/images/${MACHINE}/
  • For SDKs: build/deploy/sdk/
  • For ipk packages: build/deploy/ipk/<package-arch>/*.ipk

The Tezi deployment method provides better integration with Toradex’s current ecosystem and offers improved security and reliability compared to the legacy update.sh approach.

**

Is there any way to create a usb.img from tezi files as tezi needs recovery, which doesnot work in field?

Hello @farooq,

The legacy flashing method you describe on your post is no longer supported on newer BSPs.
The Toradex Easy Installed should be used instead.

It is possible to load the Toradex Easy Installer to the device without recovery mode under some circumstances.
Can you clarify the following?

  • Are you trying to flash new devices or existing devices?
  • If flashing existing devices, what are they running?
    • If using u-boot, what is the value of the bootcmd variable?
  • What do you have access on the devices you are trying to flash?
    • USB Host?
    • USB OTG?
    • Serial Console?
    • SD/MicroSD Card Slot?
    • Recovery mode button/switch?

By understanding the above I can propose a solution for flashing your devices.

Best Regards,
Bruno

Hi @bruno.tx ,

Thanks for your reply.

  1. Are you trying to flash new devices or existing devices:

I am trying to flash existing devices in the field over usb stick (with gpg keys as done earlier)

  1. If flashing existing devices, what are they running?

Our device is currently running a yocto custom image with application in it.

  1. If using u-boot, what is the value of the bootcmd variable?

Currently we not using u-boot to update our existing firmware.

our bootcmd is :

printenv bootcmd
bootcmd=run distro_bootcmd; usb start; setenv stdout serial,vidconsole; setenv stdin serial,usbkbd

  1. What do you have access on the devices you are trying to flash?

USB Host: yes

USB OTG: yes

Serial Consol: yes but only accesible to developer only

SD/MicroSD Card Slot: Yes but accessible not from outside

Recovery mode button/switch: No

Current Method (Custom Python A/B Updater) from Application layer

  • Dual-partition (A/B) system: One partition is running, the other is inactive.

  • Update flow:

    1. Detect USB/SD stick with GPG-signed firmware.

    2. Decrypt and flash new rootfs to inactive partition.

    3. Copy kernel and DTB to boot partition.

    4. Flip U-Boot emmcargs to boot the new partition.

    5. Reboot into the updated system

Thank you.

Hello @farooq,

Thanks for the detailed explanation.

There are a few considerations that are important here.


When it comes to what the devices final state will be and how you plan to update it in the future:

  • If you want to keep the current mechanism: Creating a custom image type that puts the rootfs in a format which your custom updater can deal with is the way to go.
    • This has some considerations on the bootloader side:
      • While not always required, it is advisable to use the same bootloader as the respective Toradex BSP as a base.
      • A bootloader upgrade would be especially advisable in this case where you are moving from BSP 2.8, which used downstream-NXP components, to BSP 7, with upstream components.
  • If you are open to another update mechanism: We now have the Torizon Update system, which handles update security in a more secure way than just a simple check of GPG keys of the update itself.
    • As you already have a Yocto build for your project, Torizon Minimal is likely a good starting point, as it is a very basic Yocto image with the update client integrated.
    • In Torizon, if the device is connected there are many useful cloud features beyond the OTA updates.
    • If the device is offline, you can use offline updates.

Either for updating the bootloader, using another process to flash the image, or moving to Torizon, if you need to load the Toradex Easy Installer, I see two main ways to do so:

Use the SD Card

By default on BSP 2.8, the boot is done with distro_bootcmd, which if you dig a bit deeper tries to boot Linux from the SD Card first (mmc1 or mmc2):

Apalis iMX6 # printenv distro_bootcmd
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
Apalis iMX6 # printenv boot_targets  
boot_targets=mmc1 mmc2 mmc0 usb0 dhcp 
Apalis iMX6 # mmc list
FSL_SDHC: 0 (eMMC)
FSL_SDHC: 1
FSL_SDHC: 2

This allows you to craft an sd-card with the Toradex Easy Installer and an image to be installed on the device.
Such SD-Card will be booted by default and automatically install the new image to the SoM’s flash memory without the need for human interaction.
Please see an example of this here: Verdin-imx8mm - easy installer and custom image in a single place - #7 by bruno.tx

Load the Toradex Easy Installer via USB OTG

Normally, this would require the use of the recovery button and following the full procedure described here: Loading Toradex Easy Installer | Toradex Developer Center
However, on the version of u-boot present in BSP 2.8, you can run a command that will bring the module to recovery mode: bmode usb
After running this command, the module will be effectively in recovery mode, allowing you to load the Toradex Easy Installer via the USB OTG port.


How to proceed further ends up being a design decision.
If you want to discuss more the possibilities here, please let me know.

Best Regards,
Bruno

Hi Bruno,

Thank you for the detailed guidance.

I wanted to update you on our current status:

  • We have successfully upgraded our custom image to Yocto Scarthgap 7.3.0 with the upstream U-Boot.

  • We thoroughly evaluated Torizon and even had a detailed call with your team.
    Unfortunately, due to current financial and time constraints we cannot move to Torizon at this time.

  • We will therefore continue with our custom dual-partition, GPG-based update mechanism, as discussed.
    We are creating a custom Yocto image type so the rootfs output matches our existing updater.

Your notes on SD-card/USB loading of the Toradex Easy Installer and the need to keep the bootloader in sync were very helpful.
We’ll keep those recovery options available and follow best practices when flashing U-Boot in the field.

Thank you again for your support.

Best Regards,

Farooq Ahmad

Hello @farooq,

Thanks for the update.
If you need support with this or other topics in the future, please feel free to reach out.

Best Regards,
Bruno

Hi @bruno.tx ,

I need further support with this method. Can you share me script that i can run and install the rootfs etc into my second partition directly from my application layer ? Thank you

Hello farooq,

From what I understand, you have a custom update mechanism based on an A/B partition strategy, and you’d like to trigger updates via a script at the application layer. Correct?

With Torizon, we use an OSTree-based system update model (via Torizon Cloud). An A/B partition strategy isn’t part of what we support with OSTree and it runs counter to our recommended approach, so unfortunately we don’t have reference examples for that workflow that we could share with you.

If you still prefer to proceed with A/B updates, we can connect you with a Engineering Partner who can help design and support your custom solution.

Alternatively, we’d be happy to set up a call with the Torizon Cloud team to review how our Cloud solution might meet your requirements and whether it makes sense for you from a technical and cost perspective.

Best regards

Maximiliano Zapata
Toradex

Hi @Maximiliano.tx ,

Thanks for your response. Yes using rocko bsp A/B partition approach to update our current firmware from usb directly. There is a ./update script in .tar.bz2 artificat and using that we used to create a usb image and then using our update script on application layer to update the firmware on the device in the field. That would be nice if you can connect me with the Engineering Partner who can help design and support our custom solution. Thank you.

Best Regards

Farooq Ahmad

Hi Farooq,

Any on this list may be able to help Toradex - Partner Network Services
Let us know if you have additional questions

Thank you
Best regards

Maximiliano Zapata
Toradex