How to Customize Toradex Easy Installer Boot
Introduction
This article aims to guide you through customizing the boot process and scripts of the Toradex Easy Installer tool in a case-oriented manner.
Why Customize U-Boot for Toradex Easy Installer (Tezi)?
There are situations when you may need to pass special boot parameters to the Toradex Easy Installer. On all Toradex modules, the Toradex Easy Installer boots from on-module flash, either via custom scripts (for raw NAND-based devices) or using the "distro boot" script on the first internal partition (for modules using eMMC).
Overview
Distro Boot
Distro Boot boot is a default boot script in U-Boot. It simplifies the boot sequence by providing a standardized method for locating and executing boot scripts, kernel images, and devicetree files.
As specified in U-Boot Standard Boot, Distro boot searches for a script file named boot.scr
or boot.scr.uimg
. This script can contain a sequence of U-Boot commands, including instructions to load the kernel, device tree, and initramfs. The standard Tezi folder contains a valid boot.scr
or boot-tezi.scr
, which can be unpacked and moved to the root of an SD card.
While "distro boot" provides a standardized boot method, it's customizable. Users can craft their own boot.scr
scripts to meet specific needs, like altering kernel parameters or executing custom actions. For kernel parameter modifications, the regular boot.scr
file can be used as a template.
The Toradex Easy Installer recognizes certain custom kernel arguments:
Parameter | Description |
---|---|
autoinstall | Automatically install an image which has autoinstall set to true |
fullscreen | Start the Qt user interface in full-screen mode instead of fixed VGA size |
hotplugfb | Automatically show Toradex Easy Installer on framebuffer device added at runtime (required when using DRM fbdev) |
keyboard=xy | Select keyboard layout |
For more details of distro boot on the Toradex context, refer to Distro Boot
Distro Boot Custom Scripts
Toradex Easy Installer also allows you to use custom scripts to tailor the boot process to the user specific requirements. These scripts are particularly useful when you need to perform advanced configuration or customization during the boot sequence. Two important notes while considering creating and using custom boot scripts for Tezi:
Script Content: A custom boot script typically contains a series of U-Boot commands written in a specific format. These commands can modify environment variables, load kernel images, perform device tree alterations, or execute other actions crucial to your use case. The script should be created with a ".cmd" extension.
Maintenance: As your system evolves, you may need to update and maintain your custom boot scripts to accommodate changes in hardware or software requirements.
Remember that custom boot scripts offer flexibility and customization but should be used with care. Incorrectly configured scripts can lead to boot failures or system instability. Refer to the Distro Boot documentation .
Case-oriented Examples
Custom Script For Capacitive Multi-touch 7"
Here's an example of a custom boot script designed for a Capacitive Multi-touch 7" display. This script utilizes fdt commands to dynamically customize the device tree.
In this particular example, the script enables the already existing but disabled node atmel_mxt_ts by setting the status property to true. Since Toradex Easy Installer uses a FIT image containing the kernel, device tree, and rootfs (squashfs), the bootm start command is used to split the booting process using the FIT image into two parts, allowing alterations to the device tree in between.
# Set timings for 7" multitouch
setenv bootargs console=ttymxc0,115200 quiet video=mxcfb0:dev=lcd,FusionF07A,if=RGB666 rootfstype=squashfs root=/dev/ram autoinstall fullscreen ${teziargs}
# Reenable fdt relocation since in place fdt edits corrupt the ramdisk
# in a FIT image...
setenv fdt_high
# Load FIT image from location as detected by distro boot
load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${prefix}tezi.itb
bootm start ${ramdisk_addr_r} && bootm loados && bootm ramdisk && bootm fdt
# Enable capacitive multitouch driver
fdt set /soc/aips-bus@02100000/i2c@021a8000/atmel_mxt_ts@4a status okay
bootm prep && bootm go
In this script:
- We set kernel boot parameters using the
bootargs
variable to configure console output, video settings, and more. fdt_high
is set to reenable device tree (FDT) relocation, which is important when using FIT images.- The FIT image is loaded with load and then the bootm command is used to start the boot process.
- Finally, we use
fdt set
to enable a specific hardware component in the device tree.
This is a basic example, and real-world custom boot scripts can be more complex depending on your specific requirements.
Then, to create a U-Boot script image, use the mkimage
command:
$ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Distro boot script" -d boot.cmd boot.scr
Placing this script into the root of the Tezi zip folder, ensures that the Toradex Easy Installer is properly displayed and touch-enabled when using the Capacitive Multi-touch 7" display.
Creating an Extra MTD Partition on Raw NAND Flash
To create an additional MTD partition, you need to pass the new partition as boot parameters for the kernel. So, create and/or edit and existing boot.scr
by adding the mtdparts
parameters as follows.
mtdparts=gpmi-nand:512k(mx6ull-bcb),1536k(u-boot1),1536k(u-boot2),1024k(splash),512k(u-boot-env),-(ubi)
This can be accomplished by modifying the files boot.scr and boot.sdp.scr.