Boot scripts for main-line U-Boot on i.MX6

Published on November 10, 2012

Archived Notice

This article has been archived and may contain broken links, photos and out-of-date information. If you have any questions, please Contact Us.

Note the age of this post (it's really old).

This post was written at a time when we were switching from the U-Boot 2009.08 code base provided by Freescale to main-line U-Boot in December 2012. We're leaving this post up because it may provide some guidance to those who have purchased boards from other suppliers that provide woefully out-of-date software.

The links below are dead because we started shipping the upgrade path (file 6q_upgrade) in our U-Boot releases.

We're no longer supplying instructions about how to down-grade because that's a bad idea.

Refer to the main U-Boot on i.MX6 page for more details.

As discussed in yesterday's post on upgrading (and downgrading) U-Boot to the latest version, we're changing the name of the boot script from 6q_bootscript to 6x_bootscript to reflect the syntax changes between the two and to allow userspace images to continue to operate with either version in the near term. In this post, we'll walk through the structure of the new boot scripts, which have auto-configuration of displays as discussed in in this post. We'll also provide sample source and binaries for both Android and non-Android Linux userspaces.

Boot script review

To recap a lot of other posts, boot scripts provide a very flexible means of setting up the environment for a particular Operating system. For Linux-based systems, this generally involves four steps:

  1. Load the kernel,
  2. Optionally load a RAM disk image,
  3. Configure bootargs (the kernel command-line), and
  4. Launch the kernel

Each of these steps have distribution-specific tweaks. For example, Android wants command-line arguments for things like androidboot.console and calibration. Ubuntu and Debian systems often use a flag like fixrtc to prevent extraneous filesystem checks.

Boot scripts are essentially text files with a 64-byte header that contains a checksum of the content.


There's an on-line tool to compile a boot script on this page.

Auto-configuration of displays

Configuration of displays under Linux on i.MX6 involves mostly adding a set of "video=" clauses to the kernel command-line, but for high-resolution displays, the "fbmem=" clause is also needed.

The following code snippet will be included in all of the 6x_bootscript sources that we'll use to set these variables.

setenv nextcon 0; if hdmidet ; then setenv bootargs $bootargs video=mxcfb${nextcon}:dev=hdmi,1280x720M@60,if=RGB24 setenv fbcon "fbcon=28M"; setexpr nextcon $nextcon + 1 else echo "------ no HDMI monitor"; fi i2c dev 2 if i2c probe 0x04 ; then setenv bootargs $bootargs video=mxcfb${nextcon}:dev=ldb,LDB-XGA,if=RGB666 if test "0" -eq $nextcon; then setenv fbcon "fbcon=10M"; else setenv fbcon ${fbcon},10M fi setexpr nextcon $nextcon + 1 else echo "------ no Freescale display"; fi if i2c probe 0x38 ; then setenv bootargs $bootargs video=mxcfb${nextcon}:dev=ldb,1024x600M@60,if=RGB666 if test "0" -eq $nextcon; then setenv fbcon "fbcon=10M"; else setenv fbcon ${fbcon},10M fi setexpr nextcon $nextcon + 1 else echo "------ no 1024x600 display"; fi if i2c probe 0x48 ; then setenv bootargs $bootargs video=mxcfb${nextcon}:dev=lcd,CLAA-WVGA,if=RGB666 if test "0" -eq $nextcon; then setenv fbcon "fbcon=10M"; else setenv fbcon ${fbcon},10M fi setexpr nextcon $nextcon + 1 else echo "------ no 800x480 display"; fi while test "3" -ne $nextcon ; do setenv bootargs $bootargs video=mxcfb${nextcon}:off ; setexpr nextcon $nextcon + 1 ; done

This is a lot of script, but has a pretty simple form. As discussed in the post on auto-configuration, we're making use of the hdmidetect and i2c detect commands to determine whether an HDMI monitor or set of touch screen controllers is connected to the system.

The ordering of the display detection code is from highest resolution to lowest resolution, and if multiple are connected, the first will be the primary display.

At the tail end of the script, a while loop will explicitly turn off all remaining displays because the Linux kernel will otherwise default to enabling a 1024x768 display.


Reference boot scripts


The following is a list of reference boot scripts. In order to use each, you'll need to rename the binary file to /6x_bootscript on the first partition of your bootable media.

Operating system Source Binary Details
Android title="Android boot script source text" target="_blank">
android-bootscript-20121110.txt
title="Android boot script binary" target="_blank">
android-bootscript-20121110
Loads /uImage and /uramdisk.img.
Non-Android Linux title="Non-Android boot script source text" target="_blank">
6x_bootscript-20121110.txt
title="Non-Android boot script binary" target="_blank">
6x_bootscript-20121110
Sets root=/dev/mmcblk0p1 (the first partition of the first SD card)
All title="Upgrade script text" target="_blank">
6x_upgrade-20121111.txt
title="Upgrade script binary" target="_blank">
6x_upgrade-20121111
Validates U-Boot in SPI-NOR from /u-boot.imx or //u-boot.nopadding.

Updated images

If you don't already have an SD card image for your platform, we've updated the following images to contain 6x_bootscript:

To-do list

We're in the process of cleaning up our patch set and re-basing on the latest main-line code base. As soon as this is done, we'll publish a new branch of source code in the production branch of this project on GitHub:

We'll also create a blog post with instructions on how to get and compile the image.


If you're in a hurry, you can look at the nit6x-prerelease branch.