Add my custom image to TEZI feeds list

Hello, community!

I am working with a Colibri IMX6ULL-512MB and Yocto-Project BSP 6.

I would like to add my custom image hosted on an Apache server (where both image_list.json and image.json are located) to the feed list of Toradex Easy Installer. I have been following the procedure described here, but it’s not working for me. I am using a Linux virtual machine (VM) hosted on Windows. In this VM, I installed dnsmasq, and my dnsmasq.conf looks like this:

interface=eth0  
dhcp-range=172.10.10.50,172.10.10.150,12h  
address=/tezi.toradex.com/[IP of my Apache server]

The IP of the Apache server is outside the DHCP range, and when I try to access the Apache server from either the VM or the Windows CMD (via HTTP), I can successfully reach the image_list.json. However, after running recovery-windows.bat, the feed for this URL does not appear in the Toradex Easy Installer feed list.

Additional questions:

  1. Should I set autoinstall to true or false in the image.json?
  2. Is using a VM on Windows a potential issue here? Would it be better to run everything directly on a Linux machine?
  3. Is there a preferred method for testing the connection between the board and the custom image server to ensure the URL is being correctly resolved by the board?

Any help would be appreciated!

Thank you!

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


:handshake:

To add your custom image to the Toradex Easy Installer feed list, let’s address your setup and questions step-by-step:

  1. DNS Configuration:

    • Your dnsmasq.conf looks correct. Ensure that dnsmasq is running and properly configured to serve DNS requests from the Colibri module.
  2. Apache Server:

    • Verify that your Apache server is accessible from the Colibri module. You can do this by connecting to the module via serial console or SSH and using tools like curl or wget to fetch the image_list.json from your Apache server.
  3. Toradex Easy Installer:

    • Ensure that the image_list.json on your Apache server is correctly formatted and accessible. The URL should be reachable from the Colibri module.
  4. Recovery Mode:

    • When you run recovery-windows.bat, ensure that the module is in recovery mode and that the script completes successfully. This script should reset the module and start the Toradex Easy Installer.

Addressing Your Additional Questions:

  1. autoinstall Property:

    • The autoinstall property in image.json should be set to true if you want the image to be automatically installed without user intervention. If you want to manually select the image from the feed list, set it to false.
  2. Using a VM on Windows:

    • Running dnsmasq and Apache on a VM should generally work, but there could be network configuration issues. Ensure that the VM’s network settings allow proper communication between the VM, the host, and the Colibri module. Bridged networking mode is often more reliable than NAT for this purpose.
  3. Testing the Connection:

    • To test the connection between the board and the custom image server, you can use the serial console or SSH to access the Colibri module and run:
      curl http://tezi.toradex.com/image_list.json
      
      This will help you verify if the DNS resolution and HTTP access are working correctly.

Troubleshooting Steps:

  • Check Network Configuration:

    • Ensure that the Colibri module is getting an IP address from dnsmasq and that it can resolve tezi.toradex.com to the IP of your Apache server.
  • Logs and Debugging:

    • Check the logs of `dnsmasq

Hello @mag_oc !

An easier way to include a custom image in TEZI feeds list is to use TorizonCore Builder images serve command.

Even though it is a TorizonCore Builder command, it should work for BSPs and custom images built with Yocto.

Please refer to this article to understand how this command works, and refer to this article to see how it is done.

I didn’t test the command inside a Linux VM on a Windows host machine, so I would recommend doing it directly from a Linux host PC.

Best regards.
Lucas Azeituno.

Hey,

I’ve also developed a custom Yocto image and deploy it via HTTP through the Toradex Easy Installer. My approach was to use a zeroconf service which autopublishes its image_list.json. Here is my python script which hosts also the webserver and serves the image_list.json which must be located in the working directory. Maybe that’s helpful for you:

#!/usr/bin/env python3

import argparse
import logging
import socket
import sys
import threading
import time

import http.server
import socketserver

from zeroconf import IPVersion, ServiceInfo, Zeroconf

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print('ERROR: not enough arguments. python3 webserver.py <IP>')
        exit(1)
    ip_address = sys.argv[1]
    sys.argv = sys.argv[0:1]

    logging.basicConfig(level=logging.DEBUG)

    parser = argparse.ArgumentParser()
    parser.add_argument('--debug', action='store_true')
    version_group = parser.add_mutually_exclusive_group()
    version_group.add_argument('--v6', action='store_true')
    version_group.add_argument('--v6-only', action='store_true')
    args = parser.parse_args()

    if args.debug:
        logging.getLogger('zeroconf').setLevel(logging.DEBUG)
    if args.v6:
        ip_version = IPVersion.All
    elif args.v6_only:
        ip_version = IPVersion.V6Only
    else:
        ip_version = IPVersion.V4Only

    desc = {
        'name': 'Toradex Installer Feed',
        'path': '/image_list.json',
        'enabled': '1',
        'https': '0'
    }

    info = ServiceInfo(
        "_tezi._tcp.local.",
        "Toradex Installer Feed._tezi._tcp.local.",
        addresses=[socket.inet_aton(ip_address)],
        server=ip_address,
        port=8080,
        properties=desc,
    )  
    
    zeroconf = Zeroconf(ip_version=ip_version)
    handler = http.server.SimpleHTTPRequestHandler
    thread = None
    httpd = socketserver.TCPServer((ip_address, 8080), handler)
    try:
        print('Server started and listening on :8080...')
        thread = threading.Thread(target=httpd.serve_forever)
        thread.start()

        print('Registration of service {:s}...'.format(info.name))
        zeroconf.register_service(info)

        while True:
            time.sleep(100)
    except KeyboardInterrupt:
        pass
    finally:
        print('Shutdown of httpd initiated...')
        httpd.shutdown()
        thread.join()
        print('Shutdown finished.')

        print('Unregistering zeroconf service...')
        zeroconf.unregister_service(info)
        zeroconf.close()
        print('Finished.')

If you want to continue using the Apache webserver, you must enter the IP address of the Apache webserver as server in the ServiceInfo. You can then delete the lines of code that start the httpd service within the thread thread.

Edit: For the sake of completeness, here is the link to the documentation of the zeroconf functionality of the Toradex Easy Installer: Detailed Manual | Toradex Developer Center

Best regards
andi

Hi, @andi1337 !

Thanks for the reply!

Just out of curiosity, the images serve command uses ZeroConf to start the local server. It is basically the same as what you sent, but you don’t need to configure it, just install TorizonCore Builder.

Best regards.
Lucas Azeituno.

Hi!

Thank you both for your help. Unfortunately, I think my main issue is understanding where the changes should be made. Should I be making changes in TEZI?

So far, all my work has been within my Yocto environment. I have set up Apache and created a server that contains the image_list.json, but I’ve tried both alternatives and neither seems to be working. I set up TorizonCore in the environment, but the image server doesn’t seem to be doing anything.

Is there a detailed guide available somewhere?

Additionally, when I tried to use Andi’s script, it wasn’t connecting to Apache, even though the server works fine when I access it through a browser or use the curl command.

Thanks again for your help. I am now trying to follow something similar to this detailed manual.

Hi, @mag_oc !

The TorizonCore Builder should not be installed within your Yocto environment. It is a tool used to customize TorizonOS images, but it has the command images serve which adds a list of images to all the TEZI connected to the same network as your host machine.

In this case, the VM must be on the same network as the Colibri. Once they are in the same network, and you’ve installed TorizonCore Builder, you need to use the following commands in the same directory which you installed the tool to be able to see the images in TEZI list.

source tcb-env-setup.sh
torizoncore-builder images serve images/

I would recommend you try these steps again because, in my opinion, it is the easiest way to achieve what you want.

Feel free to send here any errors or trouble that you may find.

Best regards.

Thank you for your help Lucas!
I’ve tried it again and it works perfectly! I was just frustrated on Friday :rofl: :sweat_smile: Have a great week!

Hi, @mag_oc !

I’m glad to hear that.
Feel free to contact us if you have any other doubts or issues.

Best regards.
Lucas Azeituno.

Hello! It’s me again haha.

I was wondering how to execute this in an automated way. I created a setup_and_serve.sh script that looks like this:

#!/bin/bash

# Set up the environment
source /home/yocto-project/tcbdir/tcb-env-setup.sh

# Change to the tcbdir directory
cd /home/yocto-project/tcbdir && torizoncore-builder images serve /home/yocto-project/tcbdir/images/colibri-imx6ull

# Check if the command executed successfully
if [ $? -eq 0 ]; then
    echo "The image is being served correctly."
else
    echo "Error serving the image."
    exit 2
fi 

The issue is that while the torizoncore-builder commands work fine when I run them manually in the console, they fail when executed through this .sh script. I’ve also tried using Docker, but my requests get denied, even though I’ve already logged in successfully.
I get this:

/home/yocto-project/tcbdir/setup_and_serve.sh
You may have an outdated version installed. Would you like to check for updates online? [y/n] y
Setting up TorizonCore Builder with version 3.

Pulling TorizonCore Builder...
3: Pulling from torizon/torizoncore-builder
Digest: sha256:789105f3394c5d422a26395e356b2f30a33f6de68305bc5831d8394b85b0cbec
Status: Image is up to date for torizon/torizoncore-builder:3
docker.io/torizon/torizoncore-builder:3
Done!

Setup complete! TorizonCore Builder is now ready to use.
TorizonCore Builder internal status and image customizations will be stored in Docker volume named 'storage'.
********************
Important: When you run TorizonCore Builder, the tool can only access the files inside the current working directory. Files and directories outside of the current working directory, or links to files and directories outside of the current working directory, won't be visible to TorizonCore Builder. So please make sure that, when running TorizonCore Builder, all files and directories passed as parameters are within the current working directory.
Your current working directory is: /home/yocto-project/tcbdir
********************
For more information, run 'torizoncore-builder -h' or go to https://developer.toradex.com/knowledge-base/torizoncore-builder-tool
/home/yocto-project/tcbdir/setup_and_serve.sh: line 8: torizoncore-builder: command not found
Error serving the image.

Is there another way to automate this besides creating a .sh file? I also tried using Python scripts to throw the commands, but I get the same response. Any advice would be appreciated!

Hi, @mag_oc!

In my opinion, the .sh file is the easiest way to do it.

Searching for the right answer, I found this topic where they do it.

You were almost correct. There was a line missing:

#!/bin/bash
shopt -s expand_aliases

source /home/lucas/work/tcbdir/tcb-env-setup.sh

cd /home/lucas/work/tcbdir/ && torizoncore-builder images serve images/

As torizoncore-builder is an alias for another command, the script needed shopt -s expand_aliases to be able to use aliases.

Best regards.
Lucas Azeituno.

1 Like