U-Boot
From Boundary Devices Wiki
//
This section will provide all the details about the U-Boot bootloader, from the source code location to the flashing procedure.
Where is U-Boot source code?
Just like most of our source code, it is located on GitHub:
Note that the master branch README should give you all the details about which branch to use.
How to build U-Boot?
The following blog posts cover the build procedure:
Where to get the latest binary for my platform?
Our build server automatically generates and uploads all the latest binaries to this address:
The README file contains the exact commit ID of this build images.
Also, the up-to-date 6x_upgrade / upgrade.scr U-Boot script is included so you can copy all the files directly to the root of your media storage.
How to flash U-Boot?
The easiest way is to copy both the 6x_upgrade file and the binary for your platform from the link above to the root of an SDCard.
Then if your u-boot prompt is "U-boot >" run:
U-Boot > setenv uboot_defconfig nitrogen6q U-Boot > run upgradeu
Otherwise just run:
=> run upgradeu
This will run the 6x_upgrade or upgrade.scr
script and look for a file u-boot.{uboot_defconfig} and burn it.
If the above fails, it most likely mean your u-boot version is very old and therefore flashing u-boot manually can be required:
U-Boot > fatload mmc 0 ${loadaddr} u-boot.nitrogen6q U-Boot > sf probe U-Boot > sf erase 0 0xc2000 U-Boot > sf write ${loadaddr} 0x400 ${filesize} U-Boot > reset
At this point it might be worth while to clear your environment variables
=> run clearenv
Oops, I bricked the device, how do I recover?
The below procedure applies to all i.MX devices.
How to erase U-Boot environment?
If you have a fairly recent U-Boot image from, you should be able to do the following:
=> run clearenv
The above should erase the NOR partition which contains the environment
Otherwise you can for the use of the default environment variables and save this instead.
=> env default -a => savee
How to access U-Boot env from user-space?
Some tools (fw_printenv
& fw_setenv
) are included inside U-Boot source code.
Here is an article that explains how to use those tools:
How to enable secure booting with U-Boot?
All the i.MX processors embed some security engine which allows to sign/encrypt the boot-loader.
The article below details the engine architecture and how to enable/use it:
How can I debug U-Boot?
There are many available techniques to debug the boot-loader, we generally debug it using print statements.
However if you are looking at JTAG debugging, many options are available (like ARM DStream) but we've only tested Segger J-Link probes:
How can I configure the display?
Since we offer many display options to our customers, it became obvious that we needed a custom method to configure the display configuration.
The following article explains how to setup the display for kernel >= 3.14:
How can I add a splashscreen?
U-Boot is capable of displaying a splash screen as explained in the following article.
What is the boot.scr file?
In order to provide a single OS image that can work for all our platform, U-Boot is made to look for and execute a file named boot.scr
.
This script will load the appropriate binaries (kernel, device tree and/or ramdisk), setup the bootargs and start the OS.
[legacy] What is the 6x_bootscript file?
Same as boot.scr
, but for outdated U-Boot versions (< 2017.07). This has been deprecated since then as boot.scr
is the new U-Boot standard.
How to modify the boot.scr?
The bootscript text files can be found inside our U-Boot code base under the bootscripts
folder:
- Yocto bootscript: bootscript-yocto.txt
- Ubuntu/Debian bootscript: bootscript-ubuntu.txt
- Mainline bootscript: bootscript-mainline.txt
If you wish to modify any of the above, make sure to modify the .txt
file. Then you only need mkimage
U-Boot tool to generate your own:
~$ sudo apt-get install u-boot-tools ~$ mkimage -A arm -O linux -T script -C none -n "boot script" -a 0 -e 0 -d bootscript.txt boot.scr
[legacy] How to modify the 6x_bootscript?
The bootscript text files can be found inside our U-Boot code base under the nitrogen6x
folder:
- Yocto bootscript: 6x_bootscript-yocto-3.14.txt
- Ubuntu/Debian bootscript: 6x_bootscript-ubuntu-3.14.txt
- Mainline bootscript: 6x_bootscript-mainline.txt
If you wish to modify any of the above, make sure to modify the .txt
file. Then you only need mkimage
U-Boot tool to generate your own:
~$ sudo apt-get install u-boot-tools ~$ mkimage -A arm -O linux -T script -C none -n "boot script" -a 0 -e 0 -d 6x_bootscript.txt 6x_bootscript
How can I modify the bootargs?
The bootscript, explained above, usually reset the bootargs
variable before setting the values that seem appropriate.
However, we provide one "workaround" for those who want to execute something during the 6x_bootscript
without having to build a new one: cmd_custom
.
In all the recent releases, cmd_custom
will be executed after the device tree has been loaded so it allows you to:
- Modify a device tree node if necessary
- Add a base
bootargs
Here is an example that adds some bootargs that allows serial port for power management debugging on Android:
=> setenv cmd_custom 'setenv bootargs no_console_suspend=1'
Another example, here is the device tree modification for Android when using the Silex module:
=> setenv cmd_custom 'fdt set bt_kim status disabled; fdt set bt_rfkill status okay'