I am working with a Colibri IMX6ULL-512MB and Yocto-Project BSP 6. I’ve been trying to customize the prepare.sh and wrapup.sh scripts to include a serial number in my image. However, when I install it using EasyInstaller, it doesn’t seem to apply any changes. Below are the scripts I’ve tried. (Note: I’ve created a layer that adds serial.cpp to /etc/serial-nmbr, and that part works just fine.)
[prepare.sh]
#!/bin/sh
#
# (c) Toradex AG 2016
#
PRODUCT_ID=$1
BOARD_REV=$2
SERIAL=$3
IMAGE_FOLDER=$4
# Specific serial number
SERIAL_NUMBER="15000901999"
# Save the serial number to a file within the root filesystem of the image
echo "Serial Number: $SERIAL_NUMBER" > "/etc/serial-number.txt"
# Error handling
error_exit () {
echo "$1" 1>&2
exit 1
}
exit 0
[wrapup.sh]
#!/bin/bash
# Compile the serial.cpp program
g++ /etc/serial-nmbr/serial.cpp -o /usr/bin/serial
# Define the serial number (you can customize this as needed)
serial_number="19990915"
# Run the serial program with the serial number as a parameter
/usr/bin/serial $serial_number
Here is how these scripts are referenced in the image’s .json file:
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?
Hello,
When customizing the prepare.sh and wrapup.sh scripts for use with the Toradex Easy Installer on a Colibri iMX6ULL module, it’s crucial to ensure that the scripts are executed in the correct environment and that their changes persist after the installation process. Here are some steps and considerations to ensure your customizations are applied correctly:
Script Execution Environment: The prepare.sh and wrapup.sh scripts are executed on the host machine running the Toradex Easy Installer, not on the target device. This means any changes these scripts make are to the unpacked image on the host before it’s installed on the target.
File System Paths: The paths used in your scripts should be relative to the root of the unpacked image. For example, when you try to echo the serial number into /etc/serial-number.txt, this path should be relative to the image’s root file system that is being prepared for installation. Ensure you’re modifying the correct path within the context of the script’s execution environment.
Persistence of Changes: Any changes made by these scripts should be within the unpacked image directory. For instance, if you’re adding a file or making changes to the filesystem, ensure these are being done within the image directory that will be transferred to the target device. It looks like your prepare.sh script intends to write directly to /etc/serial-number.txt, which might not reference the correct location within the unpacked image directory.
Debugging Script Execution: To ensure your scripts are executed and are performing as expected, you can add logging statements within these scripts to confirm their execution and output. For example, adding echo statements at various points in your scripts can help you track their progress and verify that they’re being called by the Easy Installer.
Correct Reference in the Image JSON: Ensure that the .json file correctly references the scripts’ relative paths from the root of the image directory. If the paths are incorrect, the Easy Installer will not execute them.
Permissions and Environment: Ensure that your scripts have the correct execution permissions set before they are packaged with the image. Also, consider that the environment in which these scripts run may be minimal, so dependencies (like g++ for compiling in wrapup.sh) need to be available in the environment where the Easy Installer is running.
If after checking these points your customizations still do not appear in the installed image, it might be
Please, also check if these links can help you solve your problem:
Please note that the prepare.sh and wrapup.sh scripts are executed in the Toradex Easy Installer (TEZI) environment, where the root filesystem is a RAMFS. This means that any data written to it will be lost after a reboot.
To write data to the filesystem that will persist after image installation, you need to mount the target filesystem first. Typically, on Colibri iMX6ULL modules, the root filesystem is a UBI partition located on /dev/mtd4.
Thank you for your help! Your suggestions were very useful. I ended up adding a new environment variable in the u-boot-init-env file. However, I have a few questions about using the wrapup.sh script.
Can I configure wrapup.sh to send logs or status information to my computer? For example, can I set it up to notify me if the installation was successful?
Is it possible to display a message indicating that the installation was successful? I’m trying to confirm if the serial number was correctly set in the file I mentioned earlier, but I want to avoid powering it off because it takes a lot of time to turn back on. Can wrapup.sh provide feedback, given that it’s the last script executed after a successful installation?
Similarly, can I get logs from the error_script on my development or production computer? How can I be informed if something goes wrong during the installation?
Best regards,
Magdalena
The Toradex Easy Installer is a lightweight but fully functional Linux system that uses BusyBox. This means you can use any of the commands available in BusyBox. For example, you can send a string to the UART connected to your computer, or you can use the error_exit "message" command to display a message on the Toradex Easy Installer GUI.