Imx uuu: Difference between revisions

From Variscite Wiki
(Created page with "<!-- Set release according to "release" parameter in URL and use Sumo_V2.1_DART-MX8M as default --> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!-- --> {{#lst:Yocto_Plat...")
 
No edit summary
 
(54 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<!-- Set release according to "release" parameter in URL and use Sumo_V2.1_DART-MX8M as default
<!-- Set release according to "release" parameter in URL and use Sumo_V2.1_DART-MX8M as default
--> {{#vardefine:RELEASE_PARAM|{{#urlget:release}}}} <!--
--> {{INIT_RELEASE_PARAM|RELEASE_SUMO_V2.1_DART-MX8M}}<!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM|RELEASE_SUMO_V2.1_DART-MX8M}}}} <!--
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{PageHeader|Booting from USB using UUU utility}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=}} __toc__
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!--
--> {{#vardefine:PLATFORM_OS|{{#varexists:B2QT_BSP_VERSION | B2QT | {{#varexists:DEBIAN_NAME | Debian | Yocto }}}}}} <!--
--> {{#vardefine:RELEASE_BUILD_GUIDE|{{#var:PLATFORM_OS}}_Build_Release }} <!--
--> {{DEBIAN_BUILD_GUIDE}} <!--
--> {{PageHeader|Booting from USB using UUU (Universal Update Utility)}} {{DocImage|category1={{#var:HARDWARE_NAME}}|category2=Yocto}}[[Category:Debian]] __toc__
= Introduction =
= Introduction =


UUU is an open source utility by NXP that allows to download and execute code on NXP i.MX5/i.MX6/i.MX7 and Vybrid SoCs through the Serial Download Protocol (SDP).<br>
UUU (Universal Update Utility) is an open source utility by NXP that allows downloading and executing code on i.MX SoCs through the Serial Download Protocol (SDP).<br>
Most commonly it is used as a replacement for NXP's MFGTOOL to load SPL and U-Boot via the USB OTG port.<br> <br>
It is the next generation of NXP's MFGTOOL used to load SPL and U-Boot via the USB OTG port and optionally program the internal storage of the SOM.<br>
<br>
For more details please visit https://github.com/NXPmicro/mfgtools<br>
Further reading:<br>
 
https://github.com/boundarydevices/imx_usb_loader/blob/master/README.md<br>
'''Note:'''<br>
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A || https://github.com/varigit/uboot-imx/blob/{{#var:U-BOOT_BRANCH}}/doc/{{#ifeq: {{#var:U-BOOT_BRANCH}} | imx_v2017.03_4.9.11_1.0.0_ga_var01 | README.sdp | imx/misc/sdp.txt }}<br>}}
All Variscite SOMs are shipped with U-Boot pre-programmed on the internal storage.<br>
<br>
In addition, all Variscite carrier boards have an SD card slot, and even in the unlikely event of the U-Boot being erased from the internal storage, the SOM can always be booted from an SD card (like our recovery SD card, for example).<br>
Note:<br>
So, generally, this utility is not needed, however, it is yet another option that can be used to boot (and optionally program) the Variscite SOMs, for anyone who is interested.
All Variscite SOMs are shipped with {{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A || SPL and}} U-Boot pre-programmed on the SOM's internal storage.<br>
In addition, all Variscite carrier boards have an SD card slot, and even in the unlikely event of the SPL/U-Boot being erased from the SOM's internal storage, the SOM can always be booted from an SD card (like our recovery SD card, for example).<br>
So, generally, this utility is not needed, however, it is yet another option that can be used to boot the Variscite SOMs, for anyone who is interested.<br>


= Step by step usage instructions =
= Step by step usage instructions =
 
== Prepare the host machine ==
'''Download and install the imx_usb_loader utility''':<br>
'''Download and build uuu''':<br>
<pre>
<pre>
$ sudo apt-get install libusb-1.0-0-dev
$ sudo apt-get install libusb-1.0-0-dev libbz2-dev libzstd-dev pkg-config cmake libssl-dev g++
$ cd ~
$ cd ~
$ git clone https://github.com/boundarydevices/imx_usb_loader.git
$ git clone https://github.com/NXPmicro/mfgtools.git
$ cd imx_usb_loader
$ cd mfgtools
$ git reset --hard c598fd14d67
$ git checkout uuu_1.4.240
$ cmake .
$ make
$ make
</pre>
</pre>
<br>
'''Build U-Boot''':<br>
Build U-Boot using the defconfig for SD card/eMMC.<br>
You can follow the "Build U-Boot from source code" instructions {{Varlink|Yocto_Build_U-Boot|{{#var:RELEASE_LINK}}|here}}.<br>
Copy the {{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A | U-Boot image | SPL and U-Boot images}} to the imx_usb_loader directory:
$ cp -v {{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A |{{#var:U-BOOT_IMAGE_NAME}}|SPL u-boot.img}} ~/imx_usb_loader
<br>
{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A ||
{{#ifeq: {{#var:MACHINE_NAME}} | imx7-var-som |
'''Configure imx_usb to load SPL and u-boot.img consecutively''':
$ cd ~/imx_usb_loader
Edit the imx_usb.conf file, and <u>prepend</u> the following lines to it:
#imx7
0x15a2:0x0076, mx7_usb_rom.conf, 0x0525:0xb4a4, mx7_usb_sdp_spl.conf


Create a file called mx7_usb_rom.conf with the following content:<br>
'''Note''':<br>
(the content is the same as mx7_usb_work.conf, with an 'SPL:jump header2' line appended to it)
emmc_burn_all.lst configures the eMMC to use the boot partition instead of the user partition. So the following patch is needed to avoid that:
  mx7
 
  hid,1024,0x910000,0x80000000,1G,0x00900000,0x20000
<pre>
SPL:jump header2
diff --git a/uuu/emmc_burn_all.lst b/uuu/emmc_burn_all.lst
index d868d05..521b3c0 100644
--- a/uuu/emmc_burn_all.lst
+++ b/uuu/emmc_burn_all.lst
@@ -32,7 +32,4 @@ FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev ${emmc_dev}
FB: ucmd mmc dev ${emmc_dev}
  FB: flash -raw2sparse all _image
-FB: flash -scanterm -scanlimited 0x800000 bootloader _flash.bin
-FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;
-FB: ucmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0
  FB: done
</pre>
 
== Bootloader ==
 
'''Building U-boot''':<br>
 
U-boot can be built in two ways. The first, from source, cloning the repository and compiling U-Boot. And the second, from yocto, using bitbake.<br>


Create a file called mx7_usb_sdp_spl.conf file, with the following content:
{| class="wikitable"
mx7_spl_sdp
|-
#hid/bulk,[old_header,]max packet size, {ram start, ram size}(repeat valid ram areas)
! Build U-Boot from source
#In SPL, we typically load u-boot.img which has a U-boot header...
! Build U-Boot from Yocto
hid,uboot_header,1024,0x80000000,1G,0x00907000,0x11000
|-
u-boot.img:jump header2
|
<br>
* Build U-Boot using the defconfig for SD card/eMMC. You can follow the "Build U-Boot from source code" instructions {{Varlink|Yocto_Build_U-Boot|{{#var:RELEASE_LINK}}|here}}.<br>
* Copy the U-Boot image to the uuu directory:<br>
$ cp -v {{#var:U-BOOT_SD_IMAGE_NAME}} ~/mfgtools/uuu/_flash.bin
|
|
'''Configure imx_usb to load SPL and u-boot.img consecutively''':
* Build imx-boot recipe:<br>
  $ cd ~/imx_usb_loader
  $ bitbake -c deploy imx-boot
Edit the imx_usb.conf file, and <u>prepend</u> the following lines to it:
* Copy the U-Boot image to the uuu directory:<br>
  #imx6dq/dqp
  $ cp -v ./tmp/deploy/images/{{#var:MACHINE_NAME}}/imx-boot ~/mfgtools/uuu/_flash.bin
0x15a2:0x0054, mx6_usb_rom.conf, 0x0525:0xb4a4, mx6_usb_sdp_spl.conf
|}
#imx6s/dl
0x15a2:0x0061, mx6_usb_rom.conf, 0x0525:0xb4a4, mx6_usb_sdp_spl.conf
#imx6ul
0x15a2:0x007d, mx6_usb_rom.conf, 0x0525:0xb4a4, mx6_usb_sdp_spl.conf
#imx6ull
0x15a2:0x0080, mx6_usb_rom.conf, 0x0525:0xb4a4, mx6_usb_sdp_spl.conf


Create a file called mx6_usb_rom.conf with the following content:<br>
(the content is the same as mx6_usb_work.conf, with an 'SPL:jump header2' line appended to it)
mx6_qsb
hid,1024,0x910000,0x10000000,1G,0x00900000,0x40000
SPL:jump header2
Edit the mx6_usb_sdp_spl.conf file, and append the following line to it:
u-boot.img:jump header2
<br>
}}
}}
'''Boot the board into serial download mode''':<br>
'''Boot the board into serial download mode''':<br>
{{Varlink|Yocto_Build_Release#Setting the Boot Mode|{{#var:RELEASE_LINK}}|Set the board boot mode}} to SD card, while not having an actual card inserted in its slot.<br>
*{{Varlink|{{#var:RELEASE_BUILD_GUIDE}}#Setting the Boot Mode|{{#var:RELEASE_LINK}}|Set the board boot mode}} to SD card, while not having an actual card inserted in its slot.<br>
Alternatively, set the board boot mode to eMMC/NAND flash, when the eMMC/NAND flash does not contain a bootloader.<br>
Alternatively, set the board boot mode to eMMC/NAND flash, when the eMMC/NAND flash does not contain a bootloader.<br>
Connect the board to your host PC via the USB OTG port, and power on the board.<br>
Connect the board to your host PC via the USB OTG port, and power on the board.<br>
The board should be recognized on the host as a "Freescale SemiConductor Inc  SE Blank ARIK" (or something similar).<br>
The board should be recognized on the host as a "NXP Semiconductors SE Blank M850" (or something similar).<br>
<br>
<br>
(Note: If your board only has a regular USB type-A connector and doesn't have a USB Micro-AB receptacle, you can use a "male USB type-A to male USB type-A" cable)<br>
'''Note:'''<br>
If your board only has a regular USB type-A connector and doesn't have a USB Micro-AB or Type-C receptacle, you can use a "male USB type-A to male USB type-A" cable.<br>
<br>
<br>
'''Run imx_usb to load {{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A || SPL and}} U-Boot on the board''':
'''Run uuu to load U-Boot on the board''':
  {{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A |
<pre>
  $ sudo ./imx_usb {{#var:U-BOOT_IMAGE_NAME}}|
  $ cd ~/mfgtools/uuu
$ sudo ./imx_usb}}
  $ sudo ./uuu ./spl_boot.lst
The board should now run {{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A || SPL and}} U-Boot.<br>
</pre>
The board should now run U-Boot.<br>
You can see its output on the console via the debug port, as always.<br>
You can see its output on the console via the debug port, as always.<br>
<br>
<br>
'''Notes''':
 
* The default boot command when booting from USB is bootcmd_mfg. It can be defined in the board's default env{{#ifeq: {{#var:SPL_SD_IMAGE_NAME}} | N/A ||&#32;(we leave it empty by default)}}.
'''Note''':<br>
The default boot command when booting from USB is bootcmd_mfg - it is defined by default in include/configs/imx_env.h in the U-Boot source code, as part of the the board's default environment.<br>
It can be redefined or made empty.
 
== Rootfs ==
 
<!-- THIS IS BROKEN FOR SOME RELEASES. FOR NOW, LET'S SIMPLIFY IT WITHOUT THE LINK
'''Build image''':<br>
* To build an image using the defconfig for SD card/eMMC, follow the "Setup and Build Yocto" instructions {{Varlink|Yocto_Build_Release|{{#var:RELEASE_LINK}}|here}}.<br>
* Copy the image file to the uuu directory:<br>
-->
Build an image and copy it to the uuu directory. For example:
 
$ unzstd {{#var:DEFAULT_IMAGE_BB_NAME|fsl-image-gui}}-{{#var:MACHINE_NAME}}.wic.zst                    # Example with .wic.zst image extension
$ gzip -dk {{#var:DEFAULT_IMAGE_BB_NAME|fsl-image-gui}}-{{#var:MACHINE_NAME}}.wic.gz                  # Example with wic.gz image extension
$ cp -v {{#var:DEFAULT_IMAGE_BB_NAME|fsl-image-gui}}-{{#var:MACHINE_NAME}}.wic ~/mfgtools/uuu/_image  # Example with fsl-image-gui image
 
'''Run uuu to load the image on the board''':
<pre>
$ cd ~/mfgtools/uuu
$ sudo ./uuu ./emmc_burn_all.lst
</pre>
 
* Set the boot selection switch to the eMMC position.<br>
 
The system should now boot from eMMC, and you can view the output on the console via the debug port as usual.<br>

Latest revision as of 21:28, 4 June 2025

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

This page is using the default release RELEASE_SUMO_V2.1_DART-MX8M.
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
Booting from USB using UUU (Universal Update Utility)

Introduction

UUU (Universal Update Utility) is an open source utility by NXP that allows downloading and executing code on i.MX SoCs through the Serial Download Protocol (SDP).
It is the next generation of NXP's MFGTOOL used to load SPL and U-Boot via the USB OTG port and optionally program the internal storage of the SOM.
For more details please visit https://github.com/NXPmicro/mfgtools

Note:
All Variscite SOMs are shipped with U-Boot pre-programmed on the internal storage.
In addition, all Variscite carrier boards have an SD card slot, and even in the unlikely event of the U-Boot being erased from the internal storage, the SOM can always be booted from an SD card (like our recovery SD card, for example).
So, generally, this utility is not needed, however, it is yet another option that can be used to boot (and optionally program) the Variscite SOMs, for anyone who is interested.

Step by step usage instructions

Prepare the host machine

Download and build uuu:

$ sudo apt-get install libusb-1.0-0-dev libbz2-dev libzstd-dev pkg-config cmake libssl-dev g++
$ cd ~
$ git clone https://github.com/NXPmicro/mfgtools.git
$ cd mfgtools
$ git checkout uuu_1.4.240 
$ cmake .
$ make

Note:
emmc_burn_all.lst configures the eMMC to use the boot partition instead of the user partition. So the following patch is needed to avoid that:

diff --git a/uuu/emmc_burn_all.lst b/uuu/emmc_burn_all.lst
index d868d05..521b3c0 100644
--- a/uuu/emmc_burn_all.lst
+++ b/uuu/emmc_burn_all.lst
@@ -32,7 +32,4 @@ FB: ucmd setenv fastboot_dev mmc
 FB: ucmd setenv mmcdev ${emmc_dev}
 FB: ucmd mmc dev ${emmc_dev}
 FB: flash -raw2sparse all _image
-FB: flash -scanterm -scanlimited 0x800000 bootloader _flash.bin
-FB: ucmd if env exists emmc_ack; then ; else setenv emmc_ack 0; fi;
-FB: ucmd mmc partconf ${emmc_dev} ${emmc_ack} 1 0
 FB: done

Bootloader

Building U-boot:

U-boot can be built in two ways. The first, from source, cloning the repository and compiling U-Boot. And the second, from yocto, using bitbake.

Build U-Boot from source Build U-Boot from Yocto
  • Build U-Boot using the defconfig for SD card/eMMC. You can follow the "Build U-Boot from source code" instructions here.
  • Copy the U-Boot image to the uuu directory:
$ cp -v imx-boot-sd.bin ~/mfgtools/uuu/_flash.bin
  • Build imx-boot recipe:
$ bitbake -c deploy imx-boot
  • Copy the U-Boot image to the uuu directory:
$ cp -v ./tmp/deploy/images/imx8mq-var-dart/imx-boot ~/mfgtools/uuu/_flash.bin

Boot the board into serial download mode:

Alternatively, set the board boot mode to eMMC/NAND flash, when the eMMC/NAND flash does not contain a bootloader.
Connect the board to your host PC via the USB OTG port, and power on the board.
The board should be recognized on the host as a "NXP Semiconductors SE Blank M850" (or something similar).

Note:
If your board only has a regular USB type-A connector and doesn't have a USB Micro-AB or Type-C receptacle, you can use a "male USB type-A to male USB type-A" cable.

Run uuu to load U-Boot on the board:

 $ cd ~/mfgtools/uuu
 $ sudo ./uuu ./spl_boot.lst

The board should now run U-Boot.
You can see its output on the console via the debug port, as always.

Note:
The default boot command when booting from USB is bootcmd_mfg - it is defined by default in include/configs/imx_env.h in the U-Boot source code, as part of the the board's default environment.
It can be redefined or made empty.

Rootfs

Build an image and copy it to the uuu directory. For example:

$ unzstd fsl-image-gui-imx8mq-var-dart.wic.zst                    # Example with .wic.zst image extension
$ gzip -dk fsl-image-gui-imx8mq-var-dart.wic.gz                   # Example with wic.gz image extension
$ cp -v fsl-image-gui-imx8mq-var-dart.wic ~/mfgtools/uuu/_image   # Example with fsl-image-gui image

Run uuu to load the image on the board:

 $ cd ~/mfgtools/uuu
 $ sudo ./uuu ./emmc_burn_all.lst
  • Set the boot selection switch to the eMMC position.

The system should now boot from eMMC, and you can view the output on the console via the debug port as usual.