Yocto U-Boot 4.1.15 features: Difference between revisions

From Variscite Wiki
No edit summary
 
(70 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use MORTY_BETA_DART-6UL as default
<!-- Set release according to "release" parameter in URL and use ROCKO_V1.0_DART-6UL as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{INIT_RELEASE_PARAM|RELEASE_MORTY_V1.0_DART-6UL}}<!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_MORTY_BETA_DART-6UL}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|U-Boot features}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}}  
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
{{Note|Note: The default environment has changed in the our 4.1.15 branch of U-Boot.<br>
--> {{PageHeader|U-Boot features}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}}[[Category:Debian]] <!--
:: If you manually upgrade U-Boot, and you have an old environment saved, you need to reset your environment to the new default (see [[U-Boot 4.1.15 features#Environment handling commands|Environment handling commands]]).<br>
 
Helper to define some OS-specific variables
Default on Yocto
-->
    {{#vardefine:PLATFORM_OS|Yocto}}
    {{#vardefine:BUILD_RELEASE_GUIDE|Yocto_Build_Release}}
    {{#vardefine:IMAGE_INSTALL_PATH|/opt/images/Yocto}} <!--
Debian
--> {{#varexists:DEBIAN_NAME |
    {{#vardefine:PLATFORM_OS|Debian}}
    {{#vardefine:BUILD_RELEASE_GUIDE|Debian_Build_Release}}
    {{#vardefine:IMAGE_INSTALL_PATH|/opt/images/Debian}} }} <!--
B2Qt
--> {{#varexists:B2QT_BSP_VERSION |
    {{#vardefine:PLATFORM_OS|Boot2Qt}}
    {{#vardefine:BUILD_RELEASE_GUIDE|B2QT_Build_Release}}
    {{#vardefine:IMAGE_INSTALL_PATH|/opt/images/Yocto}} }} <!--
 
--> {{Note|Note: The default environment may change between releases/commits.<br>
:: If you manually upgrade U-Boot, and you have an old environment saved, it is a good idea to reset your environment to the new default (see [[U-Boot 4.1.15 features#Environment handling commands|Environment handling commands]]).<br>
:: (There is no need to do that manually if you install U-Boot using our recovery SD card image).<br>
:: (There is no need to do that manually if you install U-Boot using our recovery SD card image).<br>
|}}
|}}
|}}
__toc__
__toc__
=New features introduced in Variscite U-Boot 2015.04:=
= Notable features:=
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL ||
{{#switch: {{#var:SOC}} | mx8mq | mx8m | mx8mm | mx8mn | mx93 | mx95=
== Splash Screen ==
| mx8mp={{#ifexpr: {{#var:YOCTO_VERSION}} >= 5.0 | {{Yocto_uboot_splash_mx8mp}} | }}
A splash screen is enabled by default, and is shown on the LVDS LCD.<br>
| #default={{Yocto_uboot_splash}}
To disable the splash screen, enter the following in the U-Boot command line interface:
}}


=> run disable_splash
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL |
=> saveenv && reset
== USB ports ==
On the VAR-6ULCustomBoard the micro-USB port is not a fully native OTG - it supports either Client or Host mode (the ID pin is not connected).<br>
<br>
In the DART-6UL U-Boot:<br>
USB port 1 (lower type-A receptacle) is defined as USB Host.<br>
USB port 0 (micro USB receptacle / upper type-A receptacle) is defined as USB Client by default.<br><br>


And to re-enable it:
{{#ifeq: {{#var:U-BOOT_BRANCH}} | imx_v2015.10_dart_6ul_var1 ||
{{#ifeq: {{#var:U-BOOT_BRANCH}} | imx_v2015.04_4.1.15_1.1.0_ga_var03 ||
To use port 0 as USB Host set the following environment variable:


  => run enable_splash
  => setenv usbmode host
=> saveenv && reset


The splash image is taken from /boot/splash.bmp in the root file system.<br><br>
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.<br><br>
 
---<br>
=== Automatic Splash source selection ===
Note that the above is only relevant for the VAR-6ULCustomBoard (DART-6UL) and that on the Concerto-Board (VAR-SOM-6UL) the micro-USB port is fully native OTG (the ID pin is connected and used).
The splash image will be taken from whichever rootfs that is going to be mounted later at boot.
}}
To enable the automatic selection (already enabled by default):
}}
 
}}
$ setenv splashsourceauto yes
$ saveenv
 
To disable the automatic selection:


$ setenv splashsourceauto no
$ setenv splashsource YOUR_SELECTION
$ saveenv
YOUR_SELECTION should be one of {sd, emmc, nand} (nand means UBIFS)
</pre>
Note:<br>
* In case the rootfs is a UBIFS, mounting it in order to load the splash file will add ~1.8 seconds to the boot time.
<br>
=== Using your own LCD screen ===
There is support for the {{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |three different|}} 800x480 LCD screen {{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |types|}} that Variscite uses.<br>
If you want to add support for a different LCD that is not currently supported, you need to edit the <span style="font-family:Consolas;">displays[]</span> array
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |(and possibly the <span style="font-family:Consolas;">setup_display()</span> function) in <span style="font family:Consolas;">board/variscite/mx6var_som/mx6var_som.c</span>|}}in the U-Boot source code, according to your LCD parameters.<br><br>
}}
== USB Mass Storage gadget ==
== USB Mass Storage gadget ==
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL |
In the DART-6UL U-Boot:<br>
USB port 0 (micro USB receptacle / upper type-A receptacle) is defined as USB Client.</br>
USB port 1 (lower type-A receptacle) is defined as USB Host.<br><br>
|}}
You can use the board as a USB Mass Storage device:<br>
You can use the board as a USB Mass Storage device:<br>
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.<br>
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.<br>
Line 70: Line 68:
devtype can be any block device (e.g. mmc, usb)<br><br>
devtype can be any block device (e.g. mmc, usb)<br><br>


{{#switch: {{#var:SOC_SERIES}}
| am6
| imx8
| imx9 =
To mount the eMMC:<br>
=> ums {{#var:U-BOOT_UMS_DEV}} mmc {{#var:U-BOOT_EMMC_DEV}}
To mount an SD card:<br>
=> ums {{#var:U-BOOT_UMS_DEV}} mmc {{#var:U-BOOT_SD_DEV}}
| #default =
To mount the eMMC:<br>
To mount the eMMC:<br>


Line 77: Line 87:


  => ums 0 mmc 0
  => ums 0 mmc 0
}}


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.<br>
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.<br>
Line 91: Line 102:
|
|
This feature is disabled by default. To enable it, you need to un-comment the defines of the following configs in <span style="font-family:Consolas;">{{#var:UBOOT_CONFIG_FILE}}</span> in the U-Boot source code:<br>
This feature is disabled by default. To enable it, you need to un-comment the defines of the following configs in <span style="font-family:Consolas;">{{#var:UBOOT_CONFIG_FILE}}</span> in the U-Boot source code:<br>
<span style="font-family:Consolas;">
 
CONFIG_USB_ETHER<br>
CONFIG_USB_ETHER
CONFIG_USB_ETH_CDC<br>
CONFIG_USB_ETH_CDC
</span><br>
 
Now you should have a new Ethernet interface called <span style="font-family:Consolas;">usb_ether</span>.<br><br>
Now you should have a new Ethernet interface called <span style="font-family:Consolas;">usb_ether</span>.<br><br>
}}
 
Before actually using it you should get to know the following environment variables:<br>
Before actually using it you should get to know the following environment variables:<br>
Variables specific to this gadget:
Variables specific to this gadget:
Line 112: Line 123:


So, for example:
So, for example:
{{#ifeq: {{#var:HARDWARE_NAME}} | DART-6UL ||
{{#ifeq: {{#var:HARDWARE_NAME}}|DART-6UL||:
  => setenv usbnet_devaddr f8:dc:7a:00:00:02
  => setenv usbnet_devaddr f8:dc:7a:00:00:02
  => setenv usbnet_hostaddr f8:dc:7a:00:00:01
  => setenv usbnet_hostaddr f8:dc:7a:00:00:01
Line 126: Line 137:
* Once you run a network command, e.g. tftpboot, the gadget will be connected to your host PC and a new network adapter will be added to it, for the duration of the network interaction.
* Once you run a network command, e.g. tftpboot, the gadget will be connected to your host PC and a new network adapter will be added to it, for the duration of the network interaction.
* Note that you may need to configure your host PC to use the new network adapter properly - this configuration is OS dependent.<br><br>
* Note that you may need to configure your host PC to use the new network adapter properly - this configuration is OS dependent.<br><br>
}}


{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |
Line 136: Line 148:


== Host/Client mode on VAR-MX6CustomBoard's micro-USB port ==
== 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.<br>
On VAR-MX6CustomBoard the micro-USB port is not a fully native OTG - it supports either Client or Host mode (the ID pin is not connected).<br>
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:
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:


Line 166: Line 178:


|}}
|}}
=Other Variscite U-Boot features =


{{#switch: {{#var:SOC_SERIES}} | am6 | imx8 | imx9=|#default=
== Automatic Device Tree selection ==
== Automatic Device Tree selection ==
{{Varlink2|Yocto Build Release|{{#var:RELEASE_LINK}}#Automatic_device_Tree_selection_in_U-Boot}}<br>
{{#switch: {{#var:PLATFORM_OS}} |
Debian= <!--
  Use BUILD_RELEASE_GUIDE (pointing to Debian's Release Build Guide)
--> {{#vardefine:AUTO_DEVICETREE_LINK|{{#var:BUILD_RELEASE_GUIDE}}#Automatic_device_tree_selection_in_U-Boot}} |
#default= <!--
  Yocto and B2Qt currently share the same guide for 'Automatic Device Tree selection'
-->{{#vardefine:AUTO_DEVICETREE_LINK|Yocto_Build_Release#Automatic_device_tree_selection_in_U-Boot}}
}} <!-- #switch: {{#var:PLATFORM_OS}} -->
 
{{Varlink|{{#var:AUTO_DEVICETREE_LINK}}|{{#var:RELEASE_LINK}}|Automatic Device Tree selection}}
 
}} <!-- #switch: {{#var:SOC_SERIES}} -->


= General U-Boot commands =
= General U-Boot commands =
Line 209: Line 232:
== File System access ==
== File System access ==
List files in a directory (default /):
List files in a directory (default /):
<pre>
 
=> ls <interface> [<dev[:part]>] [directory]
=> ls <interface> [<dev[:part]>] [directory]
</pre>
 
For example:
For example:
<pre>
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):
List files in the BOOT partition of our NAND/eMMC Recovery SD card (after booting from it):
=> ls mmc 0:2 /opt/images/Yocto
=> ls mmc 0:1
</pre><br>
 
List files in directory {{#var:IMAGE_INSTALL_PATH}} in the rootfs partition of our NAND/eMMC Recovery SD card (after booting from it):
=> ls mmc 0:2 {{#var:IMAGE_INSTALL_PATH}}


Load binary file 'filename' from a partition to RAM address 'addr':
Load binary file 'filename' from a partition to RAM address 'addr':
<pre>
 
=> load <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
=> load <interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]
</pre>
 
{{#switch: {{#var:SOC}} | mx8qm | mx8qxp | mx8mq | mx8m | mx8mm | mx8mn | mx8mp | mx93= |#default=
For example:
For example:


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


{{#switch: {{#var:SOC_SERIES}} | am6 | imx8 |imx9=|#default=
=== UBI File System ===
=== UBI File System ===
This is the FS we use on our NAND flash.<br>
This is the FS we use on our NAND flash.<br>
Line 237: Line 261:
The usage is a little different than using FAT/ext.<br>
The usage is a little different than using FAT/ext.<br>
Before you can access the UBIFS you need to mount it first:
Before you can access the UBIFS you need to mount it first:
<pre>
 
=> ubi part rootfs
=> ubi part rootfs
=> ubifsmount ubi0:rootfs
=> ubifsmount ubi0:rootfs
</pre>
 
Now you can access the UBIFS with the regular commands above.<br>
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>
The <interface> in this case is 'ubi', <dev> can be anything (the value is ignored) and part is not necessary.<br>
For example:
For example:
<pre>
 
List files in directory /home/root on the mounted UBI file system:
List files in directory /home/root on the mounted UBI file system:
=> ls ubi 0 /home/root
=> ls ubi 0 /home/root
</pre>
 
When finished accessing it, unmount the FS:
When finished accessing it, unmount the FS:
<pre>
 
=> ubifsumount
=> ubifsumount
</pre><br>
}}


== USB sub-system ==
== USB sub-system ==
To use the USB as host (connect a USB Storage or Ethernet Device to the board), you need to use the usb command.<br>
To use the USB as host (connect a USB Storage or Ethernet Device to the board), you need to use the usb command.<br>
Usage:
Usage:
<pre>
usb start - start (scan) USB controller
usb start - start (scan) USB controller
usb reset - reset (rescan) USB controller
usb reset - reset (rescan) USB controller
usb stop [f] - stop USB [f]=force stop
usb stop [f] - stop USB [f]=force stop
usb tree - show USB device tree
usb tree - show USB device tree
usb info [dev] - show available USB devices
usb info [dev] - show available USB devices
usb test [dev] [port] [mode] - set USB 2.0 test mode
usb test [dev] [port] [mode] - set USB 2.0 test mode
    (specify port 0 to indicate the device's upstream port)
    (specify port 0 to indicate the device's upstream port)
    Available modes: J, K, S[E0_NAK], P[acket], F[orce_Enable]
    Available modes: J, K, S[E0_NAK], P[acket], F[orce_Enable]
usb storage - show details of USB storage devices
usb storage - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage    devices
usb part [dev] - print partition table of one or all USB storage    devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'
    to memory address `addr'
    to memory address `addr'
usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'
usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'
    from memory address `addr'
    from memory address `addr'
</pre>
 
First, connect your device to a USB port on the board.<br>
First, connect your device to a USB port on the board.<br>
After the device is connected, start the USB controller:
After the device is connected, start the USB controller:
<pre>
 
=> usb start
=> usb start
</pre>
 
If you connect/disconnect devices after that, before you can access them you need to rescan the USB controller:
If you connect/disconnect devices after that, before you can access them you need to rescan the USB controller:
<pre>
 
=> usb reset
=> usb reset
</pre>


{{#ifeq: {{#var:MACHINE_NAME}} | var-som-mx6 |
{{#ifeq: {{#var:MACHINE_NAME}} | var-som-mx6 |
Line 288: Line 311:
To fix this, you need to disable the D-Cache by adding the following definition to <span style="font-family:Consolas;">include/configs/mx6var_som.h</span> in the U-Boot source code:<br>
To fix this, you need to disable the D-Cache by adding the following definition to <span style="font-family:Consolas;">include/configs/mx6var_som.h</span> in the U-Boot source code:<br>
CONFIG_SYS_DCACHE_OFF<br><br>
CONFIG_SYS_DCACHE_OFF<br><br>
|}}<!--
|}}
--> === Using a USB Storage Device ===
=== Using a USB Storage Device ===
Once you connected the device and stated the USB controller, you can now use the regular File System commands mentioned [[U-Boot_features#File System access|above]] with it.<br>
Once you connected the device and stated the USB controller, you can now use the regular File System commands mentioned [[U-Boot_features#File System access|above]] with it.<br>
The <interface> in this case is 'usb'.<br><br>
The <interface> in this case is 'usb'.<br><br>


{{#switch: {{#var:SOC_SERIES}} | am6 | imx8 | imx9=|#default=
= Flashing NAND using U-Boot =
= Flashing NAND using U-Boot =
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX7 ||
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A ||
  == Flashing U-Boot to NAND ==
  == Flashing U-Boot to NAND ==
Assuming you are reading the U-Boot image from our Recovery SD card:
Assuming you are reading the U-Boot image from our Recovery SD card:


  => mw.b {{#var:RAM_LOAD_ADDRESS}} 0xff {{#var:UBOOT_PAD_SIZE}} # Write 0xFF to RAM in order to pad the image and align it to the NAND erase block size
  => mw.b {{#var:RAM_LOAD_ADDRESS}} 0xff {{#var:UBOOT_PAD_SIZE}} # Write 0xFF to RAM in order to pad the image and align it to the NAND erase block size
  => load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} /opt/images/Yocto/u-boot.img # Load the U-Boot image from the SD card to RAM
  => load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} {{#var:IMAGE_INSTALL_PATH}}/u-boot.img-nand # Load the U-Boot image from the SD card to RAM
  => nand erase 0x200000 {{#var:UBOOT_PAD_SIZE}} # Erase the part of the NAND saved for the U-Boot image  
  => nand erase 0x200000 {{#var:UBOOT_PAD_SIZE}} # Erase the part of the NAND saved for the U-Boot image  
  => nand write {{#var:RAM_LOAD_ADDRESS}} 0x200000 {{#var:UBOOT_PAD_SIZE}} # Write the U-Boot image from RAM to NAND
  => nand write {{#var:RAM_LOAD_ADDRESS}} 0x200000 {{#var:UBOOT_PAD_SIZE}} # Write the U-Boot image from RAM to NAND
}}
}}
 
Note:<br>
It is not recommended to update U-Boot without also updating SPL accordingly.<br>
SPL can't be flashed to NAND flash using U-Boot - it can only be done using the kobs-ng utility under Linux.<br>
 
== Flashing the Linux kernel to NAND ==
== Flashing the Linux kernel to NAND ==
Assuming you are reading the kernel image from our Recovery SD card:
Assuming you are reading the kernel image from our Recovery SD card:


  => mw.b {{#var:RAM_LOAD_ADDRESS}} 0xff {{#var:KERNEL_PAD_SIZE}} # Write 0xFF to RAM in order to pad the image and align it to the NAND erase block size
  => mw.b {{#var:RAM_LOAD_ADDRESS}} 0xff {{#var:KERNEL_PAD_SIZE}} # Write 0xFF to RAM in order to pad the image and align it to the NAND erase block size
  => load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} /opt/images/Yocto/{{#var: KERNEL_IMAGE}} # Load the Linux kernel image from the SD card to RAM
  => load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} {{#var:IMAGE_INSTALL_PATH}}/{{#var: KERNEL_IMAGE}} # Load the Linux kernel image from the SD card to RAM
  {{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |
  {{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |
  => nand erase.part kernel # Erase the 'kernel' MTD partition
  => nand erase.part kernel # Erase the 'kernel' MTD partition
Line 316: Line 344:
  => nand write {{#var:RAM_LOAD_ADDRESS}} {{#var:KERNEL_START_ADDRESS}} {{#var:KERNEL_PAD_SIZE}} # Write the Linux kernel image from RAM to MTD partition 'kernel'
  => nand write {{#var:RAM_LOAD_ADDRESS}} {{#var:KERNEL_START_ADDRESS}} {{#var:KERNEL_PAD_SIZE}} # Write the Linux kernel image from RAM to MTD partition 'kernel'
  }}
  }}
<br>


== Flashing the Linux device tree to NAND ==
== Flashing the Linux device tree to NAND ==
Line 322: Line 349:


  => mw.b {{#var:RAM_LOAD_ADDRESS}} 0xff 0x20000 # Write 0xFF to RAM in order to pad the image and align it to the NAND erase block size (128KiB)
  => mw.b {{#var:RAM_LOAD_ADDRESS}} 0xff 0x20000 # Write 0xFF to RAM in order to pad the image and align it to the NAND erase block size (128KiB)
  => load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} /opt/images/Yocto/<DEVICE_TREE_FILE> # Load the dtb from the SD card to RAM - Change to the correct .dtb filename for your setup
  => load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} {{#var:IMAGE_INSTALL_PATH}}/<DEVICE_TREE_FILE> # Load the dtb from the SD card to RAM - Change to the correct .dtb filename for your setup
  => nand erase {{#var:DTB_START_ADDRESS}} 0x20000 # Erase the part of the NAND saved for the device tree
  => nand erase {{#var:DTB_START_ADDRESS}} 0x20000 # Erase the part of the NAND saved for the device tree
  => nand write {{#var:RAM_LOAD_ADDRESS}} {{#var:DTB_START_ADDRESS}} 0x20000 # Write the device tree from RAM to NAND
  => nand write {{#var:RAM_LOAD_ADDRESS}} {{#var:DTB_START_ADDRESS}} 0x20000 # Write the device tree from RAM to NAND
<br>


== Flashing UBIFS to NAND ==
== Flashing UBIFS to NAND ==
Line 332: Line 358:


Assuming you are reading the UBI image from our Recovery SD card:
Assuming you are reading the UBI image from our Recovery SD card:
<pre>
 
=> load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} /opt/images/Yocto/rootfs.ubi # Load the UBI image from the SD card to RAM
=> load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} {{#var:IMAGE_INSTALL_PATH}}/rootfs.ubi # Load the UBI image from the SD card to RAM
=> nand erase.part rootfs # Erase the 'rootfs' MTD partition
=> nand erase.part rootfs # Erase the 'rootfs' MTD partition
=> nand write.trimffs {{#var:RAM_LOAD_ADDRESS}} rootfs $filesize # Write the UBI image from RAM to MTD partition 'rootfs'
=> nand write.trimffs {{#var:RAM_LOAD_ADDRESS}} rootfs $filesize # Write the UBI image from RAM to MTD partition 'rootfs'
</pre><br>


Note:<br>
Note:<br>
There is another method to do this using U-Boot, that preserves erase counters, using the higher level ubi command, but you need a UBIFS image for it (which Yocto also creates, but we do not put on our Recovery SD card by default):
There is another method to do this using U-Boot, that preserves erase counters, using the higher level ubi command, but you need a UBIFS image for it (which Yocto also creates, but we do not put on our Recovery SD card by default):
<pre>
 
=> load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} /opt/images/Yocto/rootfs.ubifs # Load the UBIFS image from an SD card to RAM
=> load mmc 0:2 {{#var:RAM_LOAD_ADDRESS}} {{#var:IMAGE_INSTALL_PATH}}/rootfs.ubifs # Load the UBIFS image from an SD card to RAM
=> ubi part rootfs # Set current MTD partition to 'rootfs'
=> ubi part rootfs # Set current MTD partition to 'rootfs'
=> ubi remove rootfs # Remove the 'rootfs' UBI volume (if already exists)
=> ubi remove rootfs # Remove the 'rootfs' UBI volume (if already exists)
=> ubi create rootfs # Create a new dynamic UBI volume (read/write) with max size, and name it 'rootfs'
=> ubi create rootfs # Create a new dynamic UBI volume (read/write) with max size, and name it 'rootfs'
=> ubi write {{#var:RAM_LOAD_ADDRESS}} rootfs $filesize # Write the volume from RAM
=> ubi write {{#var:RAM_LOAD_ADDRESS}} rootfs $filesize # Write the volume from RAM
</pre>
}}


{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |
{{#ifeq: {{#var:HARDWARE_NAME}} | VAR-SOM-MX6 |

Latest revision as of 23:27, 14 November 2024

Warning: This page is designed to be used with a 'release' URL parameter.

This page is using the default release RELEASE_MORTY_V1.0_DART-6UL.
To view this page for a specific Variscite SoM and software release, please follow these steps:

  1. Visit variwiki.com
  2. Select your SoM
  3. Select the software release
U-Boot features


Note: The default environment may change between releases/commits.
If you manually upgrade U-Boot, and you have an old environment saved, it is a good idea to reset your environment to the new default (see Environment handling commands).
(There is no need to do that manually if you install U-Boot using our recovery SD card image).

Notable features:

Splash Screen

A splash screen is enabled by default, and is shown on the LVDS LCD.
To disable the splash screen, enter the following in the U-Boot command line interface:

=> run splashdisable
=> saveenv && reset

And to re-enable it:

=> run splashenable
=> saveenv && reset

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

Automatic Splash source selection

The splash image will be taken from whichever rootfs that is going to be mounted later at boot. To enable the automatic selection (already enabled by default):

$ setenv splashsourceauto yes
$ saveenv

To disable the automatic selection:

$ setenv splashsourceauto no
$ setenv splashsource YOUR_SELECTION
$ saveenv

YOUR_SELECTION should be one of {sd, emmc, nand} (nand means UBIFS)

Note:

  • In case the rootfs is a UBIFS, mounting it in order to load the splash file will add a few seconds to the boot time.


Using your own LCD screen

There is support for the 800x480 LCD screen that Variscite uses.
If you want to add support for a different LCD that is not currently supported, you need to edit the displays[] array in board/variscite/mx6ul_var_dart/mx6ul_var_dart.c in the U-Boot source code, according to your LCD parameters.

USB ports

On the VAR-6ULCustomBoard the micro-USB port is not a fully native OTG - it supports either Client or Host mode (the ID pin is not connected).

In the DART-6UL U-Boot:
USB port 1 (lower type-A receptacle) is defined as USB Host.
USB port 0 (micro USB receptacle / upper type-A receptacle) is defined as USB Client by default.

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 USB 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:

=> ums 0 mmc 1

To mount an SD card:

=> ums 0 mmc 0

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

The USB Ethernet gadget allows you to make the board act as a USB Ethernet device when connecting its USB Client port to a host PC using a USB cable.
Basically, it allows for "Ethernet over USB".
This is especially useful if you build a custom board without an Ethernet interface and you want to boot via network using TFTP.

For this, a new Ethernet interface called usb_ether was added to U-Boot.


Automatic Device Tree selection

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 0x83100000:
=> load mmc 0:2 0x83100000 /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

To use the USB as host (connect a USB Storage or Ethernet Device to the board), you need to use the usb command.
Usage:

usb start - start (scan) USB controller
usb reset - reset (rescan) USB controller
usb stop [f] - stop USB [f]=force stop
usb tree - show USB device tree
usb info [dev] - show available USB devices
usb test [dev] [port] [mode] - set USB 2.0 test mode
    (specify port 0 to indicate the device's upstream port)
    Available modes: J, K, S[E0_NAK], P[acket], F[orce_Enable]
usb storage - show details of USB storage devices
usb dev [dev] - show or set current USB storage device
usb part [dev] - print partition table of one or all USB storage    devices
usb read addr blk# cnt - read `cnt' blocks starting at block `blk#'
    to memory address `addr'
usb write addr blk# cnt - write `cnt' blocks starting at block `blk#'
    from memory address `addr'

First, connect your device to a USB port on the board.
After the device is connected, start the USB controller:

=> usb start

If you connect/disconnect devices after that, before you can access them you need to rescan the USB controller:

=> usb reset


Using a USB Storage Device

Once you connected the device and stated the USB controller, you can now use the regular File System commands mentioned above with it.
The <interface> in this case is 'usb'.

Flashing NAND using U-Boot

Flashing U-Boot to NAND

Assuming you are reading the U-Boot image from our Recovery SD card:

=> mw.b 0x83100000 0xff 0x200000					# Write 0xFF to RAM in order to pad the image and align it to the NAND erase block size
=> load mmc 0:2 0x83100000 /opt/images/Yocto/u-boot.img-nand		# Load the U-Boot image from the SD card to RAM
=> nand erase 0x200000 0x200000						# Erase the part of the NAND saved for the U-Boot image 
=> nand write 0x83100000 0x200000 0x200000				# Write the U-Boot image from RAM to NAND

Note:
It is not recommended to update U-Boot without also updating SPL accordingly.
SPL can't be flashed to NAND flash using U-Boot - it can only be done using the kobs-ng utility under Linux.

Flashing the Linux kernel to NAND

Assuming you are reading the kernel image from our Recovery SD card:

=> mw.b 0x83100000 0xff 0x7e0000					# Write 0xFF to RAM in order to pad the image and align it to the NAND erase block size
=> load mmc 0:2 0x83100000 /opt/images/Yocto/zImage			# Load the Linux kernel image from the SD card to RAM
=> nand erase 0x600000 0x7e0000						# Erase the 'kernel' MTD partition
=> nand write 0x83100000 0x600000 0x7e0000				# Write the Linux kernel image from RAM to MTD partition 'kernel'

Flashing the Linux device tree to NAND

Assuming you are reading the .dtb file from our Recovery SD card:

=> mw.b 0x83100000 0xff 0x20000						# Write 0xFF to RAM in order to pad the image and align it to the NAND erase block size (128KiB)
=> load mmc 0:2 0x83100000 /opt/images/Yocto/<DEVICE_TREE_FILE>		# Load the dtb from the SD card to RAM - Change to the correct .dtb filename for your setup
=> nand erase 0xde0000 0x20000						# Erase the part of the NAND saved for the device tree
=> nand write 0x83100000 0xde0000 0x20000				# Write the device tree from RAM to NAND

Flashing UBIFS to NAND

The best way to flash a UBI image is by using ubiformat (which is a part of mtd-utils) under Linux, as it preserves erase counters (our Recovery SD card scripts are using ubiformat).
But if you flash the UBIFS for the first time, then it doesn't matter because there are no erase counters to preserve.

Assuming you are reading the UBI image from our Recovery SD card:

=> load mmc 0:2 0x83100000 /opt/images/Yocto/rootfs.ubi				# Load the UBI image from the SD card to RAM
=> nand erase.part rootfs							# Erase the 'rootfs' MTD partition
=> nand write.trimffs 0x83100000 rootfs $filesize				# Write the UBI image from RAM to MTD partition 'rootfs'

Note:
There is another method to do this using U-Boot, that preserves erase counters, using the higher level ubi command, but you need a UBIFS image for it (which Yocto also creates, but we do not put on our Recovery SD card by default):

=> load mmc 0:2 0x83100000 /opt/images/Yocto/rootfs.ubifs			# Load the UBIFS image from an SD card to RAM
=> ubi part rootfs								# Set current MTD partition to 'rootfs'
=> ubi remove rootfs								# Remove the 'rootfs' UBI volume (if already exists)
=> ubi create rootfs								# Create a new dynamic UBI volume (read/write) with max size, and name it 'rootfs'
=> ubi write 0x83100000 rootfs $filesize					# Write the volume from RAM