Yocto U-Boot 4.1.15 features: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use ROCKO_V1.0_DART-6UL as default
<!-- Set release according to "release" parameter in URL and use ROCKO_V1.0_DART-6UL as default
--> {{INIT_RELEASE_PARAM|RELEASE_MORTY_V1.0_DART-6UL}}<!--
--> {{INIT_RELEASE_PARAM|am62-yocto-kirkstone-6.1.46_09.01.00.08-v1.1}}<!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
Line 57: Line 57:
  $ saveenv
  $ saveenv


{{#ifeq: {{#var:SOC}} | mx8qxp |
{{#switch: {{#var:SOC}}
YOUR_SELECTION should be one of {sd, emmc}
| mx8qxp =
|
| mx8qm =
YOUR_SELECTION should be one of {sd, emmc, nand} (nand means UBIFS)<br>
| am62 = YOUR_SELECTION should be one of {sd, emmc}
| #default = YOUR_SELECTION should be one of {sd, emmc, nand} (nand means UBIFS)<br>
<br>
<br>
Note:<br>
Note:<br>
Line 107: Line 108:
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}} | imx8 | imx9=
{{#switch: {{#var:SOC_SERIES}}
| imx8
| imx9 =
To mount the eMMC:<br>
To mount the eMMC:<br>


Line 115: Line 118:


  => ums {{#var:U-BOOT_UMS_DEV}} mmc {{#var:U-BOOT_SD_DEV}}
  => ums {{#var:U-BOOT_UMS_DEV}} mmc {{#var:U-BOOT_SD_DEV}}
|#default=
| am6 =
To mount the eMMC:<br>
 
=> ums {{#var:U-BOOT_UMS_DEV}} mmc $emmc_dev
 
To mount an SD card:<br>
 
=> ums {{#var:U-BOOT_UMS_DEV}} mmc $sd_dev
| #default =
To mount the eMMC:<br>
To mount the eMMC:<br>


Line 138: Line 149:
|
|
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>


Line 215: Line 226:
|}}
|}}


{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=|#default=
{{#switch: {{#var:SOC_SERIES}} | am6 | imx8 | imx9=|#default=
== Automatic Device Tree selection ==
== Automatic Device Tree selection ==
{{#switch: {{#var:PLATFORM_OS}} |
{{#switch: {{#var:PLATFORM_OS}} |
Line 290: Line 301:
}}
}}


{{#switch: {{#var:SOC_SERIES}} | imx8 |imx9=|#default=
{{#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 352: Line 363:
The <interface> in this case is 'usb'.<br><br>
The <interface> in this case is 'usb'.<br><br>


{{#switch: {{#var:SOC_SERIES}} | imx8 | imx9=|#default=
{{#switch: {{#var:SOC_SERIES}} | am6 | imx8 | imx9=|#default=
= Flashing NAND using U-Boot =
= Flashing NAND using U-Boot =
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A ||
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A ||

Revision as of 23:13, 22 July 2024

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

This page is using the default release am62-yocto-kirkstone-6.1.46_09.01.00.08-v1.1.
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}

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 the U-Boot source code, according to your LCD parameters.


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 $emmc_dev

To mount an SD card:

=> ums 0 mmc $sd_dev

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.

This feature is disabled by default. To enable it, you need to un-comment the defines of the following configs in in the U-Boot source code:

CONFIG_USB_ETHER
CONFIG_USB_ETH_CDC

Now you should have a new Ethernet interface called usb_ether.

Before actually using it you should get to know the following environment variables:
Variables specific to this gadget:

usbnet_devaddr  - The virtual MAC address of the device (the board side).
usbnet_hostaddr - The virtual MAC address of the host (the PC side).

General network variables:

ethprime - Sets the primary Ethernet interface. This is the interface that will be tried first.
ethact   - Sets the currently active Ethernet interface. Normally, it is modified by the Ethernet driver, but you can change it if you want to override.
ipaddr   - IP address of the device - needed for tftp command.
netmask  - Subnet Mask.
serverip - TFTP server IP address - needed for tftp command.

So, for example:

=> setenv usbnet_devaddr f8:dc:7a:00:00:02
=> setenv usbnet_hostaddr f8:dc:7a:00:00:01
=> setenv ethact usb_ether
=> setenv ipaddr 192.168.0.100
=> setenv netmask 255.255.255.0
=> setenv serverip 192.168.0.101

And now your are ready to use tftpboot over the usb_ether interface.

Notes:

  • 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.



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 :
=> load mmc 0:2  /boot/splash.bmp


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'.