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 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.
The following code snippet will be included in all of the 6x_bootscript sources that we’ll use to set these variables.
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.
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.
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:- Load the kernel,
- Optionally load a RAM disk image,
- Configure bootargs (the kernel command-line), and
- Launch the kernel
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 ; doneThis 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 | android-bootscript-20121110.txt | android-bootscript-20121110 | Loads /uImage and /uramdisk.img. |
Non-Android Linux | 6x_bootscript-20121110.txt | 6x_bootscript-20121110 | Sets root=/dev/mmcblk0p1 (the first partition of the first SD card) |
All | 6x_upgrade-20121111.txt | 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:- Android R13.4-GA SD card image
- LTIB 12.09-GA tar-ball (No blog post behind this one)
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.