U-Boot features: Difference between revisions

From Variscite Wiki
m (Eran moved page New U-Boot features to U-Boot features without leaving a redirect)
No edit summary
Line 153: Line 153:
</pre><br>
</pre><br>


== File access ==
== File System access ==
=== FAT/ext File Systems ===
List files in a directory (default /):
List files in a directory (default /) on a FAT/ext partition:
<pre>
<pre>
FAT:
=> ls <interface> [<dev[:part]>] [directory]
=> fatls <interface> [<dev[:part]>] [directory]
 
ext:
=> ext4ls <interface> <dev[:part]> [directory]
</pre>
</pre>
For example:
For example:
<pre>
<pre>
List files in the BOOT partition of our NAND/eMMC Recovery SD card:
List files in the BOOT partition of our NAND/eMMC Recovery SD card (after booting from it):
=> fatls mmc 0:1
=> ls mmc 0:1


List files in directory /opt/images/Yocto in the rootfs partition of our NAND/eMMC Recovery SD card:
List files in directory /opt/images/Yocto in the rootfs partition of our NAND/eMMC Recovery SD card (after booting from it):
=> ext4ls mmc 0:2 /opt/images/Yocto
=> ls mmc 0:2 /opt/images/Yocto
</pre><br>
</pre><br>


Load binary file 'filename' from a FAT/ext partition to RAM address 'addr':
Load binary file 'filename' from a partition to RAM address 'addr':
<pre>
<pre>
FAT:
=> load <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
=> fatload <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
 
ext:
=> ext4load <interface> [<dev[:part]> [addr [filename [bytes [pos]]]]]
</pre>
</pre>
For example:
For example:
<pre>
<pre>
Load /boot/splash.bmp from the rootfs partition of our NAND/eMMC Recovery SD card (after booting from it) to RAM address 0x18100000:
=> load mmc 0:2 0x18100000 /boot/splash.bmp
</pre><br>
</pre><br>


=== UBI File System ===
=== UBI File System ===
UBIFS is very different to any traditional file system - it does not work on top of block devices (like hard drives, MMC/SD cards, USB flash drives, SSDs, etc). UBIFS was designed to work on top of raw flash, so this is a little more complicated than using FAT/ext.<br>
This is the FS we use on our NAND flash.<br>
First, mount the FS:
UBIFS is very different to any traditional file system - it does not work on top of block devices (like hard drives, MMC/SD cards, USB flash drives, SSDs, etc).<br>
UBIFS was designed to work on top of raw flash.<br><br>
The usage is a little different than using FAT/ext.<br>
Before you can access the UBIFS you need to mount it first:
<pre>
<pre>
=> ubi part rootfs
=> ubi part rootfs
=> ubifsmount ubi0:rootfs
=> ubifsmount ubi0:rootfs
</pre>
</pre>
List files in a directory (default /):
Now you can access the UBIFS with the regular commands above.<br>
The <interface> in this case is ubi, <dev> can be anything (the value is ignored) and part is not necessary.<br>
For example:
<pre>
<pre>
=> ubifsls [directory]
List files in directory /home/root on the mounted UBI file system:
=> ls ubi 0 /home/root
</pre>
</pre>
When finished accessing it, unmount the FS:
When finished accessing it, unmount the FS:

Revision as of 17:03, 31 March 2016

New features introduced in Variscite U-Boot 2015.04:

Splash Screen

A splash screen is enabled by default, and is shown on the LVDS LCD.
To disable the splash screen, stop the boot at u-boot command prompt and enter:

=> run disable_splash
=> saveenv && reset

And to re-enable it:

=> run enable_splash
=> saveenv && reset

The splash image is taken from /boot/splash.bmp in the root file system.

Note: It will take the splash image from whichever rootfs that is going to be mounted later at boot.

USB Mass Storage gadget

You can use the board as a USB Mass Storage device:
You will be able to access all the partitions of any block device that is on the board or connected to it, from your host PC - You will see them as /dev/sdXX, just like connecting a regular USB storage to your PC, and you'll be able to mount them, and have full read/write access to them. You can even use it to flash a new U-Boot, re-partition the storage, re-format it, etc.
This is especially useful for updating the internal eMMC.

To do this you need to connect a USB cable between the OTG/Client port of the board and a regular USB Host port on your PC, and use U-Boot's ums command.

General ums usage is:

ums <USB_controller> [<devtype>] <devnum>  e.g. ums 0 mmc 0
    devtype defaults to mmc

devtype can be any block device (e.g. mmc, usb)

To mount the eMMC:

On any SOM other than DART-MX6:

=> ums 0 mmc 1


On a DART-MX6 SOM when booting from SD card:

=> ums 0 mmc 1


On a DART-MX6 SOM when booting from eMMC:

=> ums 0 mmc 0

To mount an SD card:

On any SOM other than DART-MX6:

=> ums 0 mmc 0


On a DART-MX6 SOM when booting from SD card:

=> ums 0 mmc 0


On a DART-MX6 SOM when booting from eMMC:

=> ums 0 mmc 1

Depending on your host PC, it may automatically mount it or not. If not, you can use dmesg to see the names of the device and its partitions (it should be in the form of /dev/sdXX) and mount them yourself.
To exit the ums command and disconnect the USB device press ctrl+c.

Note: You should use a Linux PC host as Windows can't naturally read ext file systems.

USB Ethernet Gadget




HDMI auto-detection

If an HDMI screen is connected to the board, it will auto-detect it on boot and use it as its display.
No need to manually change anything.

What it actually does is use the hdmidet command to detect the hdmi and automatically add "video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24;" to bootargs, accordingly.

Host/Client mode on VAR-MX6CustomBoard's micro-USB port

On VAR-MX6CustomBoard the micro-USB port is not a fully native OTG - it supports either Client or Host mode.
When using it in U-Boot, it is set to Client mode by default and you can change it to Host mode by setting the following environment variable:

=> setenv usbmode host

You can change it back and forth in real time when using this USB port in U-Boot, but pay attention that you are using the USB port correctly, according to the mode you set it to.

Note: The rest of the USB ports on VAR-MX6CustomBoard are always Hosts.

Choosing Root File System location when booting from NAND

If you're using a SOM with both NAND flash and eMMC, and you want to manually set the rootfs location to eMMC when booting from NAND, set the following environment variable:

=> setenv chosen_rootfs emmc

Otherwise, it will try to mount the rootfs from NAND.

What it actually does is choose between running "run bootargs_ubifs" or "run bootargs_emmc" which sets bootargs accordingly:

bootargs_ubifs=setenv bootargs console=${console},${baudrate} ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs; run videoargs
bootargs_emmc=setenv bootargs console=${console},${baudrate} root=/dev/mmcblk1p1 rootwait rw; run videoargs


Note: If you use our NAND/eMMC recovery SD card ver. 50 and above to flash Yocto, the chosen rootfs will be updated automatically to the location that you install the rootfs to - no need to manually change the environment.

DART-MX6 features previously missing

  • U-Boot now supports both SD card and eMMC at the same time, also on DART-MX6 SOMs, regardless of where you boot from.
On DART-MX6 SOMs, the device you boot from is always mmc 0, and the other is mmc 1.
  • U-Boot now supports USB also on DART-MX6 SOMs.

Other Variscite U-Boot features

Automatic Device Tree selection

Automatic Device Tree selection
Disable Automatic Device Tree selection

General U-Boot commands

List all supported commands and their description/usage (help command)

List all supported commands with a brief description for each one:

=> help

Print the description and usage of 'command':

=> help command


Environment handling commands

Print the values of all environment variables:

=> printenv

Print value of environment variable 'name':

=> printenv name

Set environment variable 'name' to 'value ...':

=> setenv name value ...

Delete environment variable 'name':

=> setenv name

Reset default environment:

=> env default -a

Save environment variables to persistent storage:

=> saveenv


File System access

List files in a directory (default /):

=> ls <interface> [<dev[:part]>] [directory]

For example:

List files in the BOOT partition of our NAND/eMMC Recovery SD card (after booting from it):
=> ls mmc 0:1

List files in directory /opt/images/Yocto in the rootfs partition of our NAND/eMMC Recovery SD card (after booting from it):
=> ls mmc 0:2 /opt/images/Yocto


Load binary file 'filename' from a partition to RAM address 'addr':

=> load <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]

For example:

Load /boot/splash.bmp from the rootfs partition of our NAND/eMMC Recovery SD card (after booting from it) to RAM address 0x18100000:
=> load mmc 0:2 0x18100000 /boot/splash.bmp


UBI File System

This is the FS we use on our NAND flash.
UBIFS is very different to any traditional file system - it does not work on top of block devices (like hard drives, MMC/SD cards, USB flash drives, SSDs, etc).
UBIFS was designed to work on top of raw flash.

The usage is a little different than using FAT/ext.
Before you can access the UBIFS you need to mount it first:

=> ubi part rootfs
=> ubifsmount ubi0:rootfs

Now you can access the UBIFS with the regular commands above.
The <interface> in this case is ubi, <dev> can be anything (the value is ignored) and part is not necessary.
For example:

List files in directory /home/root on the mounted UBI file system:
=> ls ubi 0 /home/root

When finished accessing it, unmount the FS:

=> ubifsumount

USB sub-system

...