NXP i.MX Linux User Manual

NXP Semiconductors Document identifier: IMXLUG
User's Guide Rev. LF5.10.9_1.0.0, 31 March 2021
i.MX Linux® User's Guide
NXP Semiconductors

Contents

Chapter 1 Overview............................................................................................... 6
1.1 Audience....................................................................................................................................6
1.2 Conventions...............................................................................................................................6
1.3 Supported hardware SoCs and boards..................................................................................... 6
1.4 References................................................................................................................................ 7
Chapter 2 Introduction........................................................................................... 9
Chapter 3 Basic Terminal Setup.......................................................................... 10
Chapter 4 Booting Linux OS................................................................................ 11
4.1 Software overview................................................................................................................... 11
4.2 Universal update utility............................................................................................................ 12
4.3 Preparing an SD/MMC card to boot........................................................................................ 13
4.4 Downloading images .............................................................................................................. 17
4.4.1.1 Flashing an Arm Cortex-M4 image on QuadSPI .........................................................................17
4.4.1.2 Downloading an image to MMC/SD.............................................................................................18
4.4.1.3 Using eMMC................................................................................................................................ 20
4.4.1.4 Flashing U-Boot on SPI-NOR from U-Boot..................................................................................23
4.4.1.5 Flashing U-Boot on Parallel NOR from U-Boot............................................................................24
4.4.2 Using an i.MX board as the host server to create a rootfs........................................................ 25
4.5 How to boot the i.MX boards................................................................................................... 28
4.5.1 Booting from an SD card in slot SD1........................................................................................ 28
4.5.2 Booting from an SD card in slot SD2........................................................................................ 29
4.5.3 Booting from an SD card in slot SD3........................................................................................ 30
4.5.4 Booting from an SD card in slot SD4........................................................................................ 30
4.5.5 Booting from eMMC.................................................................................................................. 31
4.5.6 Booting from SATA................................................................................................................... 32
4.5.7 Booting from NAND...................................................................................................................32
4.5.8 Booting from SPI-NOR..............................................................................................................33
4.5.9 Booting from EIM (Parallel) NOR ............................................................................................. 33
4.5.10 Booting from QuadSPI or FlexSPI.......................................................................................... 33
4.5.11 Serial download mode for the Manufacturing Tool..................................................................35
4.5.12 How to build U-Boot and Kernel in standalone environment...................................................36
4.5.13 How to build imx-boot image by using imx-mkimage.............................................................. 38
4.6 Flash memory maps................................................................................................................40
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 2 / 103
NXP Semiconductors
Contents
4.6.1 MMC/SD/SATA memory map................................................................................................... 40
4.6.2 NAND flash memory map......................................................................................................... 40
4.6.3 Parallel NOR flash memory map...............................................................................................40
4.6.4 SPI-NOR flash memory map.....................................................................................................41
4.6.5 QuadSPI flash memory map..................................................................................................... 41
4.7 Running Linux OS on the target.............................................................................................. 41
4.7.1 Running the image from NAND ................................................................................................43
4.7.2 Running Linux OS from Parallel NOR.......................................................................................44
4.7.3 Running the Linux OS image from QuadSPI ........................................................................... 44
4.7.4 Running the Arm Cortex-M4 image...........................................................................................44
4.7.5 Linux OS login...........................................................................................................................46
4.7.6 Running Linux OS from MMC/SD............................................................................................. 46
4.7.7 Running the Linux image from NFS.......................................................................................... 47
Chapter 5 Enabling Solo Emulation..................................................................... 48
Chapter 6 Power Management............................................................................ 49
6.1 Suspend and resume.............................................................................................................. 49
6.2 CPU frequency scaling............................................................................................................49
6.3 Bus frequency scaling............................................................................................................. 50
Chapter 7 Multimedia...........................................................................................52
7.1 i.MX multimedia packages.......................................................................................................52
7.2 Building limited access packages............................................................................................52
7.3 Multimedia use cases..............................................................................................................52
7.3.1 Playback use cases.................................................................................................................. 52
7.3.1.1 Audio-only playback.....................................................................................................................53
7.3.1.2 Video-only playback.....................................................................................................................53
7.3.1.3 Audio/Video file playback.............................................................................................................53
7.3.1.4 Multichannel audio playback........................................................................................................54
7.3.1.5 Other methods for playback.........................................................................................................54
7.3.1.6 Video playback to multiple displays............................................................................................. 54
7.3.2 Audio encoding......................................................................................................................... 55
7.3.3 Video encoding......................................................................................................................... 55
7.3.4 Transcoding.............................................................................................................................. 56
7.3.5 Audio recording......................................................................................................................... 56
7.3.6 Video recording......................................................................................................................... 57
7.3.7 Audio/Video recording...............................................................................................................58
7.3.8 Camera preview........................................................................................................................ 58
7.3.9 Recording the TV-in source...................................................................................................... 58
7.3.10 Web camera............................................................................................................................58
7.3.11 HTTP streaming...................................................................................................................... 59
7.3.12 HTTP live streaming................................................................................................................59
7.3.13 Real Time Streaming Protocol (RTSP) playback.................................................................... 59
7.3.14 RTP/UDP MPEGTS streaming............................................................................................... 60
7.3.15 RTSP streaming server...........................................................................................................61
7.3.16 Video conversion ....................................................................................................................62
7.3.17 Video composition...................................................................................................................62
7.4 PulseAudio input/output settings............................................................................................. 63
7.5 Installing gstreamer1.0-libav into rootfs...................................................................................65
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 3 / 103
NXP Semiconductors
Contents
Chapter 8 Audio................................................................................................... 66
8.1 DSP support............................................................................................................................ 66
8.1.1 HiFi 4 DSP framework...............................................................................................................66
8.1.2 Sound Open Firmware.............................................................................................................. 66
Chapter 9 Graphics..............................................................................................67
9.1 imx-gpu-sdk.............................................................................................................................67
9.2 G2D-imx-samples....................................................................................................................67
9.3 viv_samples.............................................................................................................................68
9.4 Qt 5..........................................................................................................................................69
Chapter 10 Security............................................................................................. 70
10.1 CAAM kernel driver............................................................................................................... 70
10.1.1 Introduction............................................................................................................................. 70
10.1.2 Source files............................................................................................................................. 71
10.1.3 Module loading........................................................................................................................72
10.1.4 Kernel configuration................................................................................................................ 72
10.1.5 How to test the drivers............................................................................................................ 73
10.2 Crypto algorithms support..................................................................................................... 75
10.3 CAAM Job Ring backend driver specifications......................................................................76
10.3.1 Verifying driver operation and correctness..............................................................................77
10.3.2 Incrementing IRQs in /proc/interrupts..................................................................................... 77
10.3.3 Verifying the 'self test' fields say 'passed' in /proc/crypto........................................................77
10.4 OpenSSL offload................................................................................................................... 78
10.4.1 OpenSSL software architecture.............................................................................................. 78
10.4.2 OpenSSL's ENGINE interface.................................................................................................79
10.4.3 NXP solution for OpenSSL hardware offloading..................................................................... 80
10.4.4 Deploying OpenSSL into rootfs...............................................................................................80
10.4.5 Running OpenSSL benchmarking tests.................................................................................. 80
10.4.5.1 Running OpenSSL benchmarking tests for symmetric ciphering and digest............................. 80
10.4.5.2 Running OpenSSL speed for Asymmetric ciphers.....................................................................81
10.5 Disk encryption acceleration..................................................................................................81
10.5.1 Enabling disk encryption support in kernel..............................................................................82
10.5.2 User space tools for disk encryption....................................................................................... 83
10.5.3 DM-Crypt using CAAM's tagged key.......................................................................................83
10.5.4 Usage......................................................................................................................................85
Chapter 11 Connectivity.......................................................................................90
11.1 Connectivity for Bluetooth wireless technology and Wi-Fi ....................................................90
11.2 Connectivity for USB type-C..................................................................................................91
11.3 NXP Bluetooth/Wi-Fi information...........................................................................................92
11.4 Certification............................................................................................................................93
11.4.1 WFA certification..................................................................................................................... 93
11.4.2 Bluetooth controller certification.............................................................................................. 93
11.5 Wi-Fi throughput....................................................................................................................93
11.5.1 Throughput test setup............................................................................................................. 93
Chapter 12 Virtualization......................................................................................94
12.1 Xen overview.........................................................................................................................94
12.2 Basic architecture..................................................................................................................94
12.3 Xen xl.....................................................................................................................................94
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 4 / 103
NXP Semiconductors
Contents
12.4 How to boot multiple operating systems on i.MX 8QuadMax EVK........................................94
12.5 Jailhouse hypervisor..............................................................................................................98
Chapter 13 NXP eIQ Machine Learning............................................................ 101
Chapter 14 Revision History.............................................................................. 102
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 5 / 103
NXP Semiconductors
Chapter 1 Overview
This document describes how to build and install the i.MX Linux® OS BSP, where BSP stands for Board Support Package, on the i.MX platform. It also covers special i.MX features and how to use them.
The document also provides the steps to run the i.MX platform, including board DIP switch settings, and instructions on configuring and using the U-Boot bootloader.
The later chapters describe how to use some i.MX special features when running the Linux OS kernel.
Features covered in this guide may be specific to particular boards or SoCs. For the capabilities of a particular board or SoC, see the
i.MX Linux® Release Notes

1.1 Audience

This document is intended for software, hardware, and system engineers who are planning to use the product, and for anyone who wants to know more about the product.

1.2 Conventions

(IMXLXRN).
This document uses the following conventions:
Courier New font: This font is used to identify commands, explicit command parameters, code examples, expressions, data types, and directives.

1.3 Supported hardware SoCs and boards

These are the systems covered in this guide:
• i.MX 6Quad SABRE-SD board and platform
• i.MX 6DualLite SABRE-SD platform
• i.MX 6Quad SABRE-AI platform
• i.MX 6SoloX SABRE-SD platform
• i.MX 7Dual SABRE-SD platform
• i.MX 6QuadPlus SABRE-AI platform
• i.MX 6QuadPlus SABRE-SD platform
• i.MX 6UltraLite EVK platform
• i.MX 6ULL EVK platform
• i.MX 6ULZ EVK platform
• i.MX 7ULP EVK platform
• i.MX 8QuadMax MEK board
• i.MX 8QuadXPlus MEK platform
• i.MX 8DXL EVK Platform
• i.MX 8M Quad EVK platform
• i.MX 8M Mini EVK Board
• i.MX 8M Nano EVK Board
• i.MX 8M Plus EVK board
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 6 / 103
NXP Semiconductors
• i.MX 8DualX MEK Board
Some abbreviations are used in places in this document.
• SABRE-SD refers to the i.MX 6Quad SABRE-SD, i.MX 6DualLite SABRE-SD, i.MX 6QuadPlus SABRE-SD, and i.MX 7Dual SABRE-SD boards.
• SABRE-AI refers to the i.MX 6Quad SABRE-AI, i.MX 6DualLite SABRE-AI, and i.MX 6QuadPlus SABRE-AI boards.
• SoloX or SX refers to the i.MX 6SoloX SABRE-SD and SABRE-AI boards.
• 6UL refers to the i.MX 6UltraLite board.
• 6ULL refers to the i.MX 6ULL board.
• 6ULZ refers to the i.MX 6ULZ board.
• 7ULP refers to the i.MX 7Ultra Low Power platform.
• 8QXP refers to the 8QuadXPlus platform.
• 8QM refers to the 8QuadMax platform.
• 8MQ refers to the 8M Quad platform.
• 8MM refers to the 8M Mini platform.
• 8MN refers to the 8M Nano platform.
Overview
• 8MP refers to the 8M Plus platform.
• 8DXL refers to the 8DualXLite platform.
• 8DX refers to the 8DualX platform.

1.4 References

i.MX has multiple families supported in software. The following are the listed families and SoCs per family. The i.MX Linux Release Notes describes which SoC is supported in the current release. Some previously released SoCs might be buildable in the current release but not validated if they are at the previous validated level.
• i.MX 6 Family: 6QuadPlus, 6Quad, 6DualLite, 6SoloX, 6SLL, 6UltraLite, 6ULL, 6ULZ
• i.MX 7 Family: 7Dual, 7ULP
• i.MX 8 Family: 8QuadMax
• i.MX 8M Family: 8M Plus, 8M Quad, 8M Mini, 8M Nano
• i.MX 8X Family: 8QuadXPlus, 8DXL, 8DualX
This release includes the following references and additional information.
i.MX Linux® Release Notes
i.MX Linux® User's Guide
(IMXLXRN) - Provides the release information.
(IMXLUG) - Provides the information on installing U-Boot and Linux OS and using i.MX-specific
features.
i.MX Yocto Project User's Guide
(IMXLXYOCTOUG) - Describes the board support package for NXP development
systems using Yocto Project to set up host, install tool chain, and build source code to create images.
®
i.MX Machine Learning User's Guide
i.MX Linux Reference Manual
i.MX Graphics User's Guide
i.MX Porting Guide
i.MX VPU Application Programming Interface Linux® Reference Manual
(IMXXBSPPG) - Provides the instructions on porting the BSP to a new board.
(IMXGRAPHICUG) - Describes the graphics features.
(IMXMLUG) - Provides the machine learning information.
(IMXLXRM) - Provides the information on Linux drivers for i.MX.
(IMXVPUAPI) - Provides the reference information
on the VPU API on i.MX 6 VPU.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 7 / 103
NXP Semiconductors
The quick start guides contain basic information on the board and setting it up. They are on the NXP website.
SABRE Platform Quick Start Guide (IMX6QSDPQSG)
SABRE Board Quick Start Guide (IMX6QSDBQSG)
i.MX 6UltraLite EVK Quick Start Guide (IMX6ULTRALITEQSG)
i.MX 6ULL EVK Quick Start Guide (IMX6ULLQSG)
SABRE Automotive Infotainment Quick Start Guide (IMX6SABREINFOQSG)
i.MX 7Dual SABRE-SD Quick Start Guide (SABRESDBIMX7DUALQSG)
i.MX 8M Quad Evaluation Kit Quick Start Guide (IMX8MQUADEVKQSG)
i.MX 8M Mini Evaluation Kit Quick Start Guide (8MMINIEVKQSG)
i.MX 8M Nano Evaluation Kit Quick Start Guide (8MNANOEVKQSG)
i.MX 8QuadXPlus Multisensory Enablement Kit Quick Start Guide (IMX8QUADXPLUSQSG)
i.MX 8QuadMax Multisensory Enablement Kit Quick Start Guide (IMX8QUADMAXQSG)
i.MX 8M Plus Evaluation Kit Quick Start Guide (IMX8MPLUSQSG)
Documentation is available online at nxp.com.
• i.MX 6 information is at nxp.com/iMX6series
Overview
• i.MX SABRE information is at nxp.com/imxSABRE
• i.MX 6UltraLite information is at nxp.com/iMX6UL
• i.MX 6ULL information is at nxp.com/iMX6ULL
• i.MX 7Dual information is at nxp.com/iMX7D
• i.MX 7ULP information is at nxp.com/imx7ulp
• i.MX 8 information is at nxp.com/imx8
• i.MX 6ULZ information is at nxp.com/imx6ulz
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 8 / 103
NXP Semiconductors
Chapter 2 Introduction
The i.MX Linux BSP is a collection of binary files, source code, and support files that can be used to create a U-Boot bootloader, a Linux kernel image, and a root file system for i.MX development systems. The Yocto Project is the framework of choice to build the images described in this document, although other methods can be used.
All the information on how to set up the Linux OS host, how to run and configure a Yocto Project, generate an image, and generate a rootfs, are covered in the
When Linux OS is running, this guide provides information on how to use some special features that i.MX SoCs provide. The release notes provide the features that are supported on a particular board.
i.MX Yocto Project User's Guide
(IMXLXYOCTOUG).
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 9 / 103
NXP Semiconductors
Chapter 3 Basic Terminal Setup
The i.MX boards can communicate with a host server (Windows® OS or Linux OS) using a serial cable. Common serial communication programs such as HyperTerminal, Tera Term, or PuTTY can be used. The example below describes the serial terminal setup using HyperTerminal on a host running Windows OS.
The i.MX 6Quad/QuadPlus/DualLite SABRE-AI boards connect to the host server using a serial cable.
The other i.MX boards connect the host driver using the micro-B USB connector.
1. Connect the target and the PC running Windows OS using a cable mentioned above.
2. Open HyperTerminal on the PC running Windows OS and select the settings as shown in the following figure.
Figure 1. Teraterm settings for terminal setup
The i.MX 8 board connects the host driver using the micro USB connector. The USB to serial driver can be found under
www.ftdichip.com/Drivers/VCP.htm. The FT4232 USB to serial convertor provides four serial ports. The i.MX 8 board uses the
first port for the Arm® Cortex®-A cores console and the second port for SCU's console. Users need to select the first port (COM) in the terminal setup. The i.MX 8DXL board uses the third and fourth ports respectively for Arm Cortex-A cores console and SCU console.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 10 / 103
NXP Semiconductors
Chapter 4 Booting Linux OS
Before booting the Linux OS kernel on an i.MX board, copy the images (U-Boot, Linux kernel, device tree, and rootfs) to a boot device and set the boot switches to boot that device. There are various ways to boot the Linux OS for different boards, boot devices, and results desired. This section describes how to prepare a boot device, where files need to be in the memory map, how to set switches for booting, and how to boot Linux OS from U-Boot.

4.1 Software overview

This section describes the software needed for the board to be able to boot and run Linux OS.
To boot a Linux image on i.MX 6 and i.MX 7, the following elements are needed:
• Bootloader (U-Boot)
• Linux kernel image (zImage)
• A device tree file (.dtb) for the board being used
• A root file system (rootfs) for the particular Linux image
• Arm Cortex-M4 image for i.MX 7ULP
To boot a Linux image on i.MX 8QuadMax, i.MX 8QuadXPlus, i.MX 8DXL, and i.MX 8DualX, four elements are needed:
• Bootloader (imx-boot built by imx-mkimage, which is a tool that combines firmware and U-Boot to create a bootloader for i.MX
8), which includes U-Boot, Arm Trusted Firmware, DCD file, System controller firmware, and the SECO firmware since B0.
• Arm Cortex-M4 image
• Linux kernel image (Image built by linux-imx)
• A device tree file (.dtb) for the board being used
• A root file system (rootfs) for the particular Linux image
On i.MX 8M Quad, i.MX 8M Mini, i.MX 8M Nano, and i.MX 8M Plus, four elements are needed:
• imx-boot (built by imx-mkimage), which includes SPL, U-Boot, Arm Trusted Firmware, DDR firmware
• HDMI firmware (only supported by i.MX 8M Quad)
• Linux kernel image
• A device tree file (.dtb) for the board being used.
• A root file system (rootfs) for the particular Linux image
The system can be configured for a specific graphical backend. For i.MX 8, the graphical backend is XWayland. For i.MX 7ULP, the default backend is XWayland.

4.1.1 Bootloader

U-Boot is the tool recommended as the bootloader for i.MX 6 and i.MX 7. i.MX 8 requires a bootloader that includes U-boot as well as other components described below. U-Boot must be loaded onto a device to be able to boot from it. U-Boot images are board-specific and can be configured to support booting from different sources.
The pre-built or Yocto project default bootloader names start with the name of the bootloader followed by the name of the platform and board and followed by the name of the device that this image is configured to boot from: u-boot-[platform]
[board]_[machine_configuration].bin. If no boot device is specified, it boots from SD/MMC.
The manufacturing tool can be used to load U-Boot onto all devices with i.MX 6 and i.MX 7. U-Boot can be loaded directly onto an SD card using the Linux dd command. U-Boot can be used to load a U-Boot image onto some other devices.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 11 / 103
NXP Semiconductors
Booting Linux OS
On i.MX 8, the U-Boot cannot boot the device by itself. The i.MX 8 pre-built images or Yocto Project default bootloader is imx-boot for the SD card, which is created by the imx-mkimage. The imx-boot binary includes the U-boot, Arm trusted firmware, DCD file (8QuadMax/8QuadXPlus/8DXL), system controller firmware (8QuadMax/8QuadXPlus/8DXL), SPL (8M SoC), DDR firmware (8M), HDMI firmware (8M Quad), and SECO firmware for B0 (8QuadMax/8QuadXPlus/8DXL).
On i.MX 8M SoC, the second program loader (SPL) is enabled in U-Boot. SPL is implemented as the first-level bootloader running on TCML (For i.MX 8M Nano and i.MX 8M Plus, the first-level bootloader runs in OCRAM). It is used to initialize DDR and load U-Boot, U-Boot DTB, Arm trusted firmware, and TEE OS (optional) from the boot device into the memory. After SPL completes loading the images, it jumps to the Arm trusted firmware BL31 directly. The BL31 starts the optional BL32 (TEE OS) and BL33 (U-Boot) for continue booting kernel.
In imx-boot, the SPL is packed with DDR Firmware together, so that ROM can load them into Arm Cortex-M4 TCML or OCRAM (only for i.MX 8M Nano and i.MX 8M Plus). The U-Boot, U-Boot DTB, Arm Trusted firmware, and TEE OS (optional) are packed into a FIT image, which is finally built into imx-boot.

4.1.2 Linux kernel image and device tree

This i.MX BSP contains a pre-built kernel image based on the 5.10.9 version of the Linux kernel and the device tree files associated with each platform.
The same kernel image is used for all the i.MX 6 and i.MX 7 with name zImage. Device trees are tree data structures, which describe the hardware configuration allowing a common kernel to be booted with different pin settings for different boards or configurations. Device tree files use the .dtb extension. The configuration for a device tree can be found in the Linux source code under arch/arm/boot/dts in the *.dts files.
The i.MX Linux delivery package contains pre-built device tree files for the i.MX boards in various configurations. File names for the prebuilt images are named Image-[platform]-[board]-[configuration].dtb. For example, the device tree file of the i.MX 8QuadMax MEK board is Image-imx8qm-mek.dtb.
For i.MX 6 and i.MX 7, the *ldo.dtb device trees are used for LDO-enabled feature support. By default, the LDO bypass is enabled. If your board has the CPU set to 1.2 GHz, you should use the *ldo.dtb device tree instead of the default, because LDO bypass mode is not supported on the CPU at 1.2 GHz. The device tree *hdcp.dtb is used to enable the HDCP feature because of a pin conflict, which requires this to be configured at build time.
On i.MX 8 and i.MX 8M, the kernel is 64 bit and device trees are located in the arch/arm64/boot/dts/freescale folder and use the dts extension. The kernel is built using linux-imx software provided in the release package and the file name starting with Image.

4.1.3 Root file system

The root file system package (or rootfs) provides busybox, common libraries, and other fundamental elements.
The i.MX BSP package contains several root file systems. They are named with the following convention: [image name]-
[backend]-[platform][board].[ext4|sdcard]. The ext4 extension indicates a standard file system. It can be mounted as
NFS, or its contents can be stored on a boot media such as an SD/MMC card.
The graphical backend to be used is also defined by the rootfs.

4.2 Universal update utility

The Universal Update Utility (UUU) runs on a Windows or Linux OS host and is used to download images to different devices on an i.MX board.

4.2.1 Downloading UUU

Download UUU version 1.4.72 or later from https://github.com/NXPmicro/mfgtools/releases.

4.2.2 Using UUU

Follow these instructions to use the UUU for i.MX 6, i.MX 7, i.MX 8:
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 12 / 103
NXP Semiconductors
Booting Linux OS
1. Connect a USB cable from a computer to the USB OTG/TYPE C port on the board.
2. Connect a USB cable from the OTG-to-UART port to the computer for console output.
3. Open a Terminal emulator program. See Section "Basic Terminal Setup" in this document.
4. Set the boot pin to serial download mode mode. See Section "Serial download mode for the Manufacturing Tool" in this document.
For detailed usage of UUU, see github.com/NXPmicro/mfgtools/wiki.
For example, the following command writes rootfs.wic into eMMC.
uuu -b emmc_all <bootloader> <rootfs.wic>
The following command decompresses bz2 file and writes into eMMC:
uuu -b emmc_all <bootloader> <rootfs.wic.bz2/*>
The following command executes downloading and bootloader (SPL and U-Boot) by USB:
uuu -b spl <bootloader>
The follow command burns into eMMC (If only one board is supported in such a release package and the board supports eMMC chip):
uuu <release package>.zip
NOTE For i.MX 8QuadXPlus B0, UUU flashes the eMMC image to boot partition with 32 KB offset. It may not be compatible with all eMMC devices. It is recommended to enable eMMC fastboot mode and use the UUU kernel version script to flash the eMMC image to boot partition with 0 offset.

4.3 Preparing an SD/MMC card to boot

This section describes the steps to prepare an SD/MMC card to boot up an i.MX board using a Linux host machine. These instructions apply to SD and MMC cards although for brevity, and usually only the SD card is listed.
For a Linux image to be able to run, four separate pieces are needed:
• Linux OS kernel image (zImage/Image)
• Device tree file (*.dtb)
• Bootloader image
• Root file system (i.e., EXT4)
The Yocto Project build creates an SD card image that can be flashed directly. This is the simplest way to load everything needed onto the card with one command.
A .wic image contains all four images properly configured for an SD card. The release contains a pre-built .wic image that is built specifically for the one board configuration. It runs the Wayland graphical backend. It does not run on other boards unless U-Boot, the device tree, and rootfs are changed.
When more flexibility is desired, the individual components can be loaded separately, and those instructions are included here as well. An SD card can be loaded with the individual components one-by-one or the .wic image can be loaded and the individual parts can be overwritten with the specific components.
The rootfs on the default .wic image is limited to a bit less than 4 GB, but re-partitioning and re-loading the rootfs can increase that to the size of the card. The rootfs can also be changed to specify the graphical backend that is used.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 13 / 103
NXP Semiconductors
Booting Linux OS
The device tree file (.dtb) contains board and configuration-specific changes to the kernel. Change the device tree file to change the kernel for a different i.MX board or configuration.
By default, the release uses the following layout for the images on the SD card. The kernel image and DTB move to use the FAT partition without a fixed raw address on the SD card. The users have to change the U-Boot boot environment if the fixed raw address is required.
Table 1. Image layout
Start address (sectors) Size (sectors) Format Description
0x400 bytes (2) 0x9FFC00 bytes (20478) RAW i.MX 6 and i.MX 7 U-Boot and
reserved area
0x8400 (66) 0x9F7C00 (20414) RAW i.MX 8M Quad and i.MX 8M
Mini imx-boot reserved area
0x8000 (64) 0x9F800 (20416) RAW i.MX 8QuadMax/8QuadXPlus/
8M Nano/8M Plus/ 8DXL/8DualX
0xa00000 bytes (20480) 500 Mbytes (1024000) FAT Kernel Image and DTBs
0x25800000 bytes (1228800) Remaining space Ext3/Ext4 Rootfs

4.3.1 Preparing the card

An SD/MMC card reader, such as a USB card reader, is required. It is used to transfer the bootloader and kernel images to initialize the partition table and copy the root file system. To simplify the instructions, it is assumed that a 4 GB SD/MMC card is used.
Any Linux distribution can be used for the following procedure.
The Linux kernel running on the Linux host assigns a device node to the SD/MMC card reader. The kernel might decide the device node name or udev rules might be used. In the following instructions, it is assumed that udev is not used.
To identify the device node assigned to the SD/MMC card, carry out the following command:
$ cat /proc/partitions
major minor #blocks name
8 0 78125000 sda
8 1 75095811 sda1
8 2 1 sda2
8 5 3028221 sda5
8 32 488386584 sdc
8 33 488386552 sdc1
8 16 3921920 sdb
8 18 3905535 sdb1
In this example, the device node assigned is /dev/sdb (a block is 1024 Bytes).
NOTE Make sure that the device node is correct for the SD/MMC card. Otherwise, it may damage your operating system or data on your computer.

4.3.2 Copying the full SD card image

The SD card image (with the extension .wic) contains U-Boot, the Linux image and device trees, and the rootfs for a 4 GB SD card. The image can be installed on the SD card with one command if flexibility is not required.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 14 / 103
NXP Semiconductors
Booting Linux OS
Carry out the following command to copy the SD card image to the SD/MMC card. Change sdx below to match the one used by the SD card.
$ sudo dd if=<image name>.wic of=/dev/sdx bs=1M && sync
The entire contents of the SD card are replaced. If the SD card is larger than 4 GB, the additional space is not accessible.

4.3.3 Partitioning the SD/MMC card

The full SD card image already contains partitions. This section describes how to set up the partitions manually. This needs to be done to individually load the bootloader, kernel, and rootfs.
There are various ways to partition an SD card. Essentially, the bootloader image needs to be at the beginning of the card, followed by the Linux image and the device tree file. These can either be in separate partitions or not. The root file system needs to be in a partition that starts after the Linux section. Make sure that each section has enough space. The example below creates two partitions.
On most Linux host operating systems, the SD card is mounted automatically upon insertion. Therefore, before running fdisk, make sure that the SD card is unmounted if it was previously mounted (through sudo umount /dev/sdx).
Start by running fdisk with root permissions. Use the instructions above to determine the card ID. We are using sdx here as an example.
$ sudo fdisk /dev/sdx
Type the following parameters (each followed by <ENTER>):
p [lists the current partitions]
d [to delete existing partitions. Repeat this until no unnecessary partitions
are reported by the 'p' command to start fresh.]
n [create a new partition]
p [create a primary partition - use for both partitions]
1 [the first partition]
20480 [starting at offset sector]
1024000 [ending position of the first partition to be used for the boot images]
p [to check the partitions]
n
p
2
1228800 [starting at offset sector, which leaves enough space for the kernel,
the bootloader and its configuration data]
<enter> [using the default value will create a partition that extends to
the last sector of the media]
p [to check the partitions]
w [this writes the partition table to the media and fdisk exits]

4.3.4 Copying a bootloader image

This section describes how to load only the bootloader image when the full SD card image is not used. Execute the following command to copy the U-Boot image to the SD/MMC card.
$ sudo dd if=<U-Boot image> of=/dev/sdx bs=1k seek=<offset> conv=fsync
Where offset is:
• 1 - for i.MX 6 or i.MX 7
• 33 - for i.MX 8QuadMax A0, i.MX 8QuadXPlus A0, and i.MX 8M Quad
• 32 - for i.MX 8QuadXPlus B0, i.MX 8QuadMax B0, i.MX 8DualX, i.MX 8DXL, i.MX 8M Nano, i.MX 8M Mini, and i.MX 8M Plus
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 15 / 103
NXP Semiconductors
Booting Linux OS
The first 16 KB of the SD/MMC card, which includes the partition table, is reserved.

4.3.5 Copying the kernel image and DTB file

This section describes how to load the kernel image and DTB when the full SD card image is not used. The pre-built SD card image uses the VFAT partition for storing kernel image and DTB, which requires a VFAT partition that is mounted as a Linux drive and the files are simply copied into it. This is the preferred method.
Another method that can be used is for users to put the kernel image and DTB to the fixed raw address of the SD card by using the
dd command. The later method needs to modify the U-Boot default environment variables for loading the kernel image and DTB.
Default: VFAT partition
1. Format partition 1 on the card as VFAT with this command:
$ sudo mkfs.vfat /dev/sdx1
2. Mount the formatted partition with this command:
$ mkdir mountpoint
$ sudo mount /dev/sdx1 mountpoint
3. Copy the zImage and *.dtb files to the mountpoint by using cp. The device tree names should match the one used by the variable specified by U-Boot. Unmount the partition with this command:
$ sudo umount mountpoint
Alternative: Pre-defined raw address
The following command can be used to copy the kernel image to the SD/MMC card:
For i.MX 6 and i.MX7, use this command:
$ sudo dd if=zImage_imx_v7_defconfig of=/dev/sdx bs=512 seek=2048 conv=fsync
For i.MX 8, use this command:
sudo dd if=Image-imx8qmsabreauto.bin of=/dev/sdx bs=512 seek=2048 conv=fsync
Each of them copies the kernel to the media at offset 1 MB (bs x seek = 512 x 2048 = 1 MB). The file zImage_imx_v7_defconfig refers to the zImage file created when using the imx_v7_defconfig configuration file, which supports both i.MX 6 and i.MX 7 SoCs.
The i.MX DTB image can be copied by using the copy command and copying the file to the 2nd partition or the following commands copy an i.MX DTB image to the SD/MMC card by using dd command.
Choose a command for your board:
$ sudo dd if=zImage-imx6qp-sabreauto.dtb of=/dev/sdx bs=512 seek=20480 conv=fsync
$ sudo dd if=zImage-imx6qp-sabresd.dtb of=/dev/sdx bs=512 seek=20480 conv=fsync
$ sudo dd if=zImage-imx6q-sabreauto.dtb of=/dev/sdx bs=512 seek=20480 conv=fsync
$ sudo dd if=zImage-imx6q-sabresd.dtb of=/dev/sdx bs=512 seek=20480 conv=fsync
$ sudo dd if=zImage-imx6sl-evk.dtb of=/dev/sdx bs=512 seek=20480 conv=fsync
$ sudo dd if=zImage-imx7d-sdb.dtb of=/dev/sdx bs=512 seek=20480 conv=fsync
For i.MX 6 and i.MX 7, the following command can be used to copy the kernel image to the boards, such as the i.MX 6UltraLite EVK board and i.MX 6ULL EVK board:
$ sudo dd if=zImage-imx6ul-14x14-evk.dtb of=/dev/sdx bs=512 seek=20480 conv=fsync
$ sudo dd if=zImage-imx6ull-14x14-evk.dtb of=/dev/sdx bs=512 seek=20480 conv=fsync
For i.MX 6 and i.MX 7, this copies the board-specific .dtb file to the media at offset 10 MB (bs x seek = 512 x 20480 = 10 MB).
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 16 / 103
NXP Semiconductors
Booting Linux OS

4.3.6 Copying the root file system (rootfs)

This section describes how to load the rootfs image when the full SD card image is not used.
Copy the target file system to a partition that only contains the rootfs. This example uses partition 2 for the rootfs. First format the partition. The file system format ext3 or ext4 is a good option for the removable media due to the built-in journaling. Replace sdx with the partition in use in your configuration.
$ sudo mkfs.ext3 /dev/sdx2
Or
$ sudo mkfs.ext4 /dev/sdx2
Copy the target file system to the partition:
$ mkdir /home/user/mountpoint
$ sudo mount /dev/sdx2 /home/user/mountpoint
Extract a rootfs package to a directory: for example, extract imx-image-multimedia-imx7ulpevk.tar.bz2 to /home/
user/rootfs:
$ cd /home/user/rootfs
$ tar -jxvf imx-image-multimedia-imx7ulpevk.tar.bz2
The rootfs directory needs to be created manually.
Assume that the root file system files are located in /home/user/rootfs as in the previous step:
$ cd /home/user/rootfs
$ sudo cp -a * /home/user/mountpoint
$ sudo umount /home/user/mountpoint
$ sync
The file system content is now on the media.
NOTE
Copying the file system takes several minutes depending on the size of your rootfs.

4.4 Downloading images

Images can be downloaded to a device using a U-Boot image that is already loaded on the boot device or by using the Manufacturing Tool UUU. Use a terminal program to communicate with the i.MX boards.

4.4.1 Downloading images using U-Boot

The following sections describe how to download images using the U-Boot bootloader.
The commands described below are generally useful when using U-Boot. Additional commands and information can be found by typing help at the U-Boot prompt.
The U-Boot print command can be used to check environment variable values.
The setenv command can be used to set environment variable values.
4.4.1.1 Flashing an Arm Cortex-M4 image on QuadSPI
i.MX 6SoloX SABRE-SD/SABRE-AI, i.MX 7ULP EVK, and i.MX 7Dual SABRE-SD boards have the Arm Cortex-M4 processor and QuadSPI memory that can be used to flash an image to it.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 17 / 103
NXP Semiconductors
Booting Linux OS
NOTE To enable the full features for i.MX 7ULP, burn the Arm Cortex-M4 image to QuadSPI. It is recommended to use the MfgTool script uuu LF5.10.9_1.0.0_images_MX7ULPEVK.zip\uuu_sd_m4.auto to burn both BSP and Arm Cortex-M4 images.
i.MX U-Boot provides a reference script on i.MX 7Dual SABRESD and i.MX 6SoloX SABRE-AI/SABRE-SD to flash the Arm Cortex-M4 image from the SD card. To execute the script, perform the following steps:
1. Copy the Arm Cortex-M4 image to the first VFAT partition of the boot SD card. Name the file to “m4_qspi.bin”.
2. Boot from the SD card.
3. Flash the Arm Cortex-M4 image from the SD card to the NOR flash on QuadSPI2 PortB CS0 on the i.MX 6SoloX SABRE-SD board, QuadSPI1 PortB CS0 on the i.MX 6SoloX SABRE-AI board, or QuadSPI1 PortA CS0 offset 1 MB on the i.MX 7Dual SABRE-SD board.
U-Boot > run update_m4_from_sd
Alternatively, users can flash the Arm Cortex-M4 image from TFTP by performing the following steps:
1. Boot from the SD card.
2. TFTP the Arm Cortex-M4 image.
U-Boot > tftp ${loadaddr} m4_qspi.bin
3. Select the NOR flash on QuadSPI2 PortB CS0 on the i.MX 6SoloX SABRE-SD board or QuadSPI1 PortB CS0 on the i.MX 6SoloX SABRE-AI board.
U-Boot > sf probe 1:0
Select the NOR flash on QuadSPI1 PortA CS0 on the i.MX 7Dual SABRE-SD board and i.MX 7ULP EVK board.
U-Boot > sf probe 0:0
4. Flash the Arm Cortex-M4 image to the selected NOR flash. The erase size is ${filesize}, around 64 Kbytes. This example assumes that it is 128 Kbytes.
U-Boot > sf erase 0x0 0x20000
U-Boot > sf write ${loadaddr} 0x0 ${filesize}
i.MX 7Dual SABRE-SD needs to program the Arm Cortex-M4 images to 1 MB offset, because the first 1 MB is used by the U-Boot image in QuadSPI.
U-Boot > sf erase 0x100000 0x20000
U-Boot > sf write ${loadaddr} 0x100000 ${filesize}
NOTE On i.MX 7Dual SABRE-SD, the Arm Cortex-M4 image on QuadSPI is supported only when the U-Boot image is built by the target mx7dsabresd_qspi1_defconfig booted by U-Boot from QuadSPI.
The default U-Boot for the i.MX 7Dual SABRESD board uses the Cortex-M4 image from the SD card and runs it on OCRAM.
On i.MX 7ULP EVK, the Arm Cortex-M4 image needs to be programmed. Otherwise, it will not boot.
4.4.1.2 Downloading an image to MMC/SD
This section describes how to download U-Boot to an MMC/SD card that is not the one used to boot from.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 18 / 103
NXP Semiconductors
Booting Linux OS
Insert an MMC/SD card into the SD card slot. This is slot SD3 on i.MX 6 SABRE, SD2 on i.MX 6UltraLite EVK and i.MX 6ULL EVK, SD1 on i.MX 7Dual SABRE-SD and i.MX 7ULP EVK (MicroSD), and SD1 on i.MX 8QuadMax MEK , 8QuadXPlus MEK, and i.MX 8M Quad EVK.
NOTE To enable the full features for i.MX 7ULP, burn the Arm Cortex-M4 image to QuadSPI. It is recommended to use the MfgTool script uuu LF5.10.9_1.0.0_images_MX7ULPEVK.zip\uuu_sd_m4.auto to burn both BSP and Arm Cortex-M4 images.
For i.MX 7ULP, to burn the Arm Cortext-M4 image to QuadSPI, perform the following steps:
1. Copy the Arm Cortext-M4 image to the SD card vfat partition, insert the SD card, and then boot to the U-Boot console.
2. Probe the Quad SPI in U-Boot, and erase an enough big size QuardSPI flash space for this Arm Cortext-M4 image.
U-Boot > sf probe
U-Boot > sf erase 0x0 0x30000;
3. Read the Arm Cortext-M4 image (in the first vfat partition on the SD card) to memory address, the Arm Cortext-M4 image name is sdk20-app.img here.
U-Boot > fatload mmc 0:1 0x62000000 sdk20-app.img;
4. Write the Arm Cortext-M4 image to the QuardSPI.
U-Boot > sf write 0x62000000 0x0 0x30000
To flash the original U-Boot, see Section Preparing an SD/MMC card to boot.
The U-Boot bootloader is able to download images from a TFTP server into RAM and to write from RAM to an SD card. For this operation, the Ethernet interface is used and U-Boot environment variables are initialized for network communications.
The boot media contains U-Boot, which is executed upon power-on. Press any key before the value of the U-Boot environment variable, "bootdelay", decreases and before it times out. The default setting is 3 seconds to display the U-Boot prompt.
1. To clean up the environment variables stored on MMC/SD to their defaults, execute the following command in the U-Boot console:
U-Boot > env default -f -a U-Boot > saveenv U-Boot > reset
2. Configure the U-Boot environment for network communications. The folllowing is an example. The lines preceded by the "#" character are comments and have no effect.
U-Boot > setenv serverip <your TFTPserver ip>
U-Boot > setenv bootfile <your kernel zImage/Image name on the TFTP server>
U-Boot > setenv fdt_file <your dtb image name on the TFTP server>
The user can set a fake MAC address through ethaddr enviroment if the MAC address is not fused.
U-Boot > setenv ethaddr 00:01:02:03:04:05
U-Boot > save
3. Copy zImage/Image to the TFTP server. Then download it to RAM:
U-Boot > dhcp
4. Query the information about the MMC/SD card.
U-Boot > mmc devU-Boot > mmcinfo
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 19 / 103
NXP Semiconductors
Booting Linux OS
5. Check the usage of the "mmc" command. The "blk#" is equal to "<the offset of read/write>/<block length of the card>". The "cnt" is equal to "<the size of read/write>/<block length of the card>".
U-Boot > help mmc
mmc - MMC sub system
Usage:
mmc read addr blk# cnt
mmc write addr blk# cnt
mmc erase blk# cnt
mmc rescan
mmc part - lists available partition on current mmc device
mmc dev [dev] [part] - show or set current mmc device [partition]
mmc list - lists available devices
6. Program the kernel zImage/Image located in RAM at ${loadaddr} into the SD card. For example, the command to write the image with the size 0x800000 from ${loadaddr} to the offset of 0x100000 of the microSD card. See the following examples for the definition of the MMC parameters.
blk# = (microSD Offset)/(SD block length) = 0x100000/0x200 = 0x800
cnt = (image Size)/(SD block length) = 0x800000/0x200 = 0x4000
This example assumes that the kernel image is equal to 0x800000. If the kernel image exceeds 0x800000, increase the image length. After issuing the TFTP command, filesize of the U-Boot environment variable is set with the number of bytes transferred. This can be checked to determine the correct size needed for the calculation. Use the U-Boot command printenv to see the value.
U-Boot > mmc dev 2 0
U-Boot > tftpboot ${loadaddr} ${bootfile}
### Suppose the kernel zImage is less than 8M.
U-Boot > mmc write ${loadaddr} 0x800 0x4000
7. Program the dtb file located in RAM at ${fdt_addr} into the microSD.
U-Boot > tftpboot ${fdt_addr} ${fdt_file}
U-Boot > mmc write ${fdt_addr} 0x5000 0x800
8. On i.MX 6 SABRE boards, you can boot the system from rootfs on SD card, using the HannStar LVDS as display. The kernel MMC module now uses a fixed mmcblk index for the uSDHC slot. The SD3 slot uses mmcblk2 on i.MX 6 SABRE boards, the SD1 slot uses mmcblk0 on the i.MX 7Dual SABRE-SD board, and the SD2 slot uses mmcblk1 on the i.MX 6UltraLite board and i.MX 6ULL EVK board. The SD1 slot uses mmcblk1 on i.MX 8 MEK boards and i.MX 8M boards.
9. Boot the board.
U-Boot >setenv bootcmd_mmc 'run bootargs_base mmcargs;mmc dev;mmc
read ${loadaddr} 0x800 0x4000;mmc read ${fdt_addr} 0x5000 0x800;bootz ${loadaddr} - ${fdt_addr}'
U-Boot > setenv bootcmd 'run bootcmd_mmc'
U-Boot > saveenv
4.4.1.3 Using eMMC
There is an eMMC chip on i.MX SABRE boards, i.MX 8 MEK and EVK boards, and i.MX 8M EVK boards. It is accessed through SDHC4 on i.MX 6 SABRE boards or SDHC3 on i.MX 7Dual SABRE-SD board, SDHC1 on i.MX 8 MEK and EVK boards, and i.MX 8M EVK boards. The i.MX 7ULP EVK board also supports to rework eMMC on the MicroSD port. The following steps describe how to use this memory device.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 20 / 103
NXP Semiconductors
NOTE To enable the full features for i.MX 7ULP, burn the Arm Cortex-M4 image to QuadSPI. It is recommended to use the MfgTool script uuu LF5.10.9_1.0.0_images_MX7ULPEVK.zip\uuu_sd_m4.auto to burn both BSP and Arm Cortex-M4 images.
1. Execute the following command on the U-Boot console to clean up the environments stored on eMMC:
U-Boot > env default -f -a
U-Boot > save
U-Boot > reset
2. Configure the boot pin. Power on the board and set the U-Boot environment variables as required. For example,
U-Boot > setenv serverip <your tftpserver ip>
U-Boot > setenv bootfile <your kernel zImage/Image name on the tftp server>
U-Boot > setenv fdt_file <your dtb image name on the tftp server>
### The user can set fake MAC address via ethaddr enviroment if the MAC address is not fused
U-Boot > setenv ethaddr 00:01:02:03:04:05
U-Boot > save
3. Copy zImage to the TFTP server. Then download it to RAM:
U-Boot > dhcp
Booting Linux OS
4. Query the information about the eMMC chip.
U-Boot > mmc dev
U-Boot > mmcinfo
5. Check the usage of the "mmc" command. "blk#" is equal to "<the offset of read/write>/<block length of the card>". "cnt" is equal to "<the size of read/write>/<block length of the card>".
mmc read addr blk# cnt
mmc write addr blk# cnt
mmc erase blk# cnt
mmc rescan
mmc part - lists available partition on current mmc device
mmc dev [dev] [part] - show or set current mmc device [partition]
mmc list - lists available devices
6. Program the kernel zImage/Image into eMMC. For example, the command below writes the image with the size 0x800000 from ${loadaddr} to the offset 0x100000 of the eMMC chip. Here, the following equations are used: 0x800 =0x100000/0x200, 0x4000=0x800000/0x200. The block size of this card is 0x200. This example assumes that the kernel image is less than 0x800000 bytes. If the kernel image exceeds 0x800000, enlarge the image length.
### Select mmc dev 2 (USDHC4) on the i.MX 6 SABRESD board:
U-Boot > mmc dev 2 0
### Select mmc dev 1 (USDHC3) on the i.MX 7Dual SABRESD board:
U-Boot > mmc dev 1 0
### Select mmc dev 1 (USDHC2) on the i.MX 6UltraLite EVK board:
U-Boot > mmc dev 1 0
### Select mmc dev 0 (USDHC1) on the i.MX 7ULP EVK board:
U-Boot > mmc dev 0 0
### Select mmc dev 0 (eMMC0) on the i.MX 8QuadMax MEK, i.MX 8QuadXPlus MEK, i.MX 8M Quad,
8DualX, and 8DXL boards:
U-Boot > mmc dev 0 0
### select mmc dev 2 (USDHC3) on the i.MX 8M Mini EVK, i.MX 8M Nano EVK, and i.MX 8M Plus EVK:
U-Boot > mmc dev 2 0
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 21 / 103
NXP Semiconductors
Booting Linux OS
### Suppose kernel zImage is less than 8 MB:
U-Boot > tftpboot ${loadaddr} ${bootfile}
U-Boot > mmc write ${loadaddr} 0x800 0x4000
7. Program the dtb file located in RAM at ${fdt_addr} into the eMMC chip.
U-Boot > tftpboot ${fdt_addr} ${fdt_file}
U-Boot > mmc write ${fdt_addr} 0x5000 0x800
8. Boot up the system through the rootfs in eMMC, using the HannStar LVDS as display. The kernel MMC module now uses the fixed mmcblk indices for the USDHC slots. The eMMC/SD4 slot on the i.MX 6 SABRE boards is mmcblk3. The eMMC5.0 on the i.MX 8QuadMax MEK board, i.MX 8QuadXPlus MEK board, and i.MX 8M Quad EVK board are mmcblk0. The eMMC5.0/SD3 slot on the i.MX 7Dual SABRE board is mmcblk2. eMMC is not populated on the i.MX 7Dual SABRE board.
U-Boot > setenv mmcboot 'run bootargs_base mmcargs; mmc dev 2;
mmc read ${loadaddr} 0x800 0x4000; mmc read ${fdt_addr} 0x5000 0x800;bootz ${loadaddr} - $
{fdt_addr} '
U-Boot > setenv bootcmd 'run mmcboot'
U-Boot > saveenv
9. Boot up the system through the rootfs in eMMC, using the CLAA WVGA panel as display:
• For i.MX 6 boards:
U-Boot > setenv mmcargs 'setenv bootargs ${bootargs}
root=/dev/mmcblk3p2 rootwait rw video=mxcfb0:dev=lcd,CLAA-WVGA,if=RGB565 ip=dhcp'
• For i.MX 7Dual SABRE boards:
U-Boot > setenv mmcargs 'setenv bootargs ${bootargs}
root=/dev/mmcblk2p2 rootwait rw video=mxcfb0:dev=lcd,CLAA-WVGA,if=RGB565 ip=dhcp'
10. Boot up the system through rootfs in eMMC, using HDMI as display:
• For i.MX 6 boards:
U-Boot > setenv mmcargs 'setenv bootargs ${bootargs} root=/dev/mmcblk3p2 rootwait rw
video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24'
• For i.MX 7Dual SABRE boards:
U-Boot > setenv mmcargs 'setenv bootargs ${bootargs} root=/dev/mmcblk2p2 rootwait rw
video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24'
• For i.MX 8QuadMax/8QuadXPlus/8M Quad/8M Plus, the following display kernel parameters are supported:
a. Pick a particular video mode for legacy FB emulation since system startup.
video=HDMI-A-{n}: {video_mode}
n can be 1 to the maximum number of HDMI connectors in the system. video_mode should be the one that
the monitor on the connector supports. For example, video=HDMI-A-1:1920x1080@60. By default, if there is no parameter in the command line, the system uses the video mode that the monitor recommends.
b. Enable or disable legacy FB emulation.
drm_kms_helper.fbdev_emulation=0 or 1
0 to disable, 1 to enable. By default, if there is no parameter in the command line, the emulation is enabled.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 22 / 103
NXP Semiconductors
Booting Linux OS
c. Set legacy FB emulation framebuffer’s bits per pixel (bpp) parameter.
imxdrm.legacyfb_depth=16 or 24 or 32
By default, if there is no parameter in the command line, bpp is 16.
To program the rootfs to MMC/SD, see Using an i.MX board as the host server to create a rootfs or Preparing an SD/MMC card
to boot.
4.4.1.4 Flashing U-Boot on SPI-NOR from U-Boot
Flashing directly to SPI-NOR with TFTPBoot is limited to i.MX 6 SABRE-AI boards. To flash U-Boot on SPI-NOR, perform the following steps:
1. Boot from an SD card.
2. Set Jumper J3 to position: 2-3.
3. Fetch the U-Boot image with built-in SPI-NOR support. This example uses u-boot.imx.
U-Boot > tftpboot ${loadaddr} u-boot.imx
4. Flash the U-Boot image in SPI-NOR.
U-Boot > sf probe
U-Boot > sf erase 0 0x80000
U-Boot > sf write ${loadaddr} 0x400 0x7FC00
5. Set boot switches to boot from SPI-NOR on SABRE-AI.
• S2-1 1
• S2-2 1
• S2-3 0
• S2-4 0
• S1-[1:10] X
6. Reboot the target board.
4.4.1.4.1 Flashing an Arm Cortex-M4 image on QuadSPI
i.MX 6SoloX SABRE-SD/SABRE-AI, i.MX 7ULP EVK, and i.MX 7Dual SABRE-SD boards have the Arm Cortex-M4 processor and QuadSPI memory that can be used to flash an image to it.
NOTE To enable the full features for i.MX 7ULP, burn the Arm Cortex-M4 image to QuadSPI. It is recommended to use the MfgTool script uuu LF5.10.9_1.0.0_images_MX7ULPEVK.zip\uuu_sd_m4.auto to burn both BSP and Arm Cortex-M4 images.
i.MX U-Boot provides a reference script on i.MX 7Dual SABRESD and i.MX 6SoloX SABRE-AI/SABRE-SD to flash the Arm Cortex-M4 image from the SD card. To execute the script, perform the following steps:
1. Copy the Arm Cortex-M4 image to the first VFAT partition of the boot SD card. Name the file to “m4_qspi.bin”.
2. Boot from the SD card.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 23 / 103
NXP Semiconductors
Booting Linux OS
3. Flash the Arm Cortex-M4 image from the SD card to the NOR flash on QuadSPI2 PortB CS0 on the i.MX 6SoloX SABRE-SD board, QuadSPI1 PortB CS0 on the i.MX 6SoloX SABRE-AI board, or QuadSPI1 PortA CS0 offset 1 MB on the i.MX 7Dual SABRE-SD board.
U-Boot > run update_m4_from_sd
Alternatively, users can flash the Arm Cortex-M4 image from TFTP by performing the following steps:
1. Boot from the SD card.
2. TFTP the Arm Cortex-M4 image.
U-Boot > tftp ${loadaddr} m4_qspi.bin
3. Select the NOR flash on QuadSPI2 PortB CS0 on the i.MX 6SoloX SABRE-SD board or QuadSPI1 PortB CS0 on the i.MX 6SoloX SABRE-AI board.
U-Boot > sf probe 1:0
Select the NOR flash on QuadSPI1 PortA CS0 on the i.MX 7Dual SABRE-SD board and i.MX 7ULP EVK board.
U-Boot > sf probe 0:0
4. Flash the Arm Cortex-M4 image to the selected NOR flash. The erase size is ${filesize}, around 64 Kbytes. This example assumes that it is 128 Kbytes.
U-Boot > sf erase 0x0 0x20000
U-Boot > sf write ${loadaddr} 0x0 ${filesize}
i.MX 7Dual SABRE-SD needs to program the Arm Cortex-M4 images to 1 MB offset, because the first 1 MB is used by the U-Boot image in QuadSPI.
U-Boot > sf erase 0x100000 0x20000
U-Boot > sf write ${loadaddr} 0x100000 ${filesize}
NOTE On i.MX 7Dual SABRE-SD, the Arm Cortex-M4 image on QuadSPI is supported only when the U-Boot image is built by the target mx7dsabresd_qspi1_defconfig booted by U-Boot from QuadSPI.
The default U-Boot for the i.MX 7Dual SABRESD board uses the Cortex-M4 image from the SD card and runs it on OCRAM.
On i.MX 7ULP EVK, the Arm Cortex-M4 image needs to be programmed. Otherwise, it will not boot.
4.4.1.5 Flashing U-Boot on Parallel NOR from U-Boot
Flashing directly to Parallel NOR with TFTPBoot is limited to i.MX 6 SABRE-AI boards. To flash U-Boot on Parallel NOR, perform the following steps:
1. Check the jumper J3, should not between pins 2 and 3.
2. Update the SD U-Boot with EIM NOR version. For details on commands, see Copying a bootloader image. Then boot from the SD card.
3. TFTP the U-Boot image.
tftpboot ${loadaddr} u-boot.imx
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 24 / 103
NXP Semiconductors
Booting Linux OS
4. Flash the U-Boot image.
cp.b ${loadaddr} 0x08001000 ${filesize}
5. Change boot switches and reboot.
S2 all 0 S1-6 1 others 0
6. By default, rootfs is mounted on NFS.

4.4.2 Using an i.MX board as the host server to create a rootfs

Linux OS provides multiple methods to program images to the storage device. This section describes how to use the i.MX platform as a Linux host server to create the rootfs on an MMC/SD card or the SATA device. The following example is for an SD card. The device file node name needs to be changed for a SATA device.
1. Boot from NFS or other storage. Determine your SD card device ID. It could be mmcblk* or sd*. (The index is determined by the USDHC controller index.) Check the partition information with the command:
$ cat /proc/partitions
2. To create a partition on the MMC/SD card, use the fdisk command (requires root privileges) in the Linux console:
root@ ~$ sudo fdisk /dev/$SD
Replace $SD above with the name of your device.
3. If this is a new SD card, you may get the following message:
The device contains neither a valid DOS partition table, nor Sun, SGI or OSF disk label
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that the previous content
won't be recoverable.
The number of cylinders for this disk is set to 124368.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
The usual prompt and commands to partition the card are as follows. Text in boldface indicates what the user types.
Command (m for help): p
Disk /dev/sdd: 3965 MB, 3965190144 bytes
4 heads, 32 sectors/track, 60504 cylinders, total 7744512 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00080bff
Device Boot Start End Blocks Id System
4. As described in Flash memory maps, the rootfs partition should be located after the kernel image. The first 0x800000 bytes can be reserved for MBR, bootloader, and kernel sections. From the log shown above, the Units of the current MMC/SD card is 32768 bytes. The beginning cylinder of the first partition can be set to "0x300000/32768 = 96." The last cylinder can be set according to the rootfs size. Create a new partition by typing the letters in bold:
Command (m for help): n
e extended
p primary partition (1-4)
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 25 / 103
NXP Semiconductors
Select (default p): p
Partition number (1-4): 1
First cylinder (1-124368, default 1): 96
Last cylinder or +size or +sizeM or +sizeK (96-124368, default 124368): Using default value
124368
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read $SD partition table
5. Check the partitions (see above) to determine the name of the partition. $PARTITION is used here to indicate the partition to be formatted. Format the MMC/SD partitions as ext3 or ext4 type. For example, to use ext3:
root@ ~$ mkfs.ext3 /dev/$PARTITION
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
248992 inodes, 994184 blocks
49709 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1019215872
31 block groups
32768 blocks per group, 32768 fragments per group
8032 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 20 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Booting Linux OS
6. Copy the rootfs contents to the MMC/SD card. The name may vary from the one used below. Check the directory for the rootfs desired. (Copy the *.ext2 to NFS rootfs).
mkdir /mnt/tmpmnt
mount -t ext3 -o loop /imx-image-multimedia.ext3 /mnt/tmpmnt
cd /mnt
mkdir mmcblk0p1
mount -t ext3 /dev/$PARTITION /mnt/mmcblk0p1
cp -af /mnt/tmpmnt/* /mnt/mmcblk0p1/
umount /mnt/mmcblk0p1
umount /mnt/tmpmnt
7. Type sync to write the contents to MMC/SD.
8. Type poweroff to power down the system. Follow the instructions in Running Linux OS on the target to boot the image from the MMC/SD card.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 26 / 103
NXP Semiconductors
Booting Linux OS
NOTE By default, v2013.04 and later versions of U-Boot support loading the kernel image and DTB file from the SD/MMC vfat partition by using the fatload command. To use this feature, perform the following steps:
1. Format the first partition (for example 50 MB) of the SD/MMC card with vfat filesystem.
2. Copy zImage and the DTB file into the VFAT partition after you mount the VFAT partition into your host computer.
3. Make sure that the zImage and DTB file name are synchronized with the file name pointed to by the U-Boot environment variables: fdt_file and image. Use the print command under U-Boot to display these two environment variables. For example:
print fdt_file image
4. U-Boot loads the kernel image and the DTB file from your VFAT partition automatically when you boot from the SD/MMC card.
The following is an example to format the first partition to a 50 MB vfat filesystem and format the second partition to an ext4 filesystem:
~$ fdisk /dev/sdb
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-30318591, default 2048): 4096
Last sector, +sectors or +size{K,M,G} (4096-30318591, default 30318591): +50M
Command (m for help): p
Disk /dev/sdb: 15.5 GB, 15523119104 bytes
64 heads, 32 sectors/track, 14804 cylinders, total 30318592 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3302445d
Device Boot Start End Blocks Id System
/dev/sdb1 4096 106495 51200 83 Linux
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (2048-30318591, default 2048): 106496
Last sector, +sectors or +size{K,M,G} (106496-30318591, default 30318591):
Using default value 30318591
Command (m for help): p
Disk /dev/sdb: 15.5 GB, 15523119104 bytes
64 heads, 32 sectors/track, 14804 cylinders, total 30318592 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3302445d
Device Boot Start End Blocks Id System
/dev/sdb1 4096 106495 51200 83 Linux
/dev/sdb2 106496 30318591 15106048 83 Linux
Command (m for help): w
The partition table has been altered!
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 27 / 103
NXP Semiconductors
Booting Linux OS
Calling ioctl() to re-read partition table.
Syncing disks.
~$ mkfs.vfat /dev/mmcblk0p1
~$ mkfs.ext4 /dev/mmcblk0p2

4.5 How to boot the i.MX boards

When U-Boot is loaded onto one of the devices that support booting, the DIP switches can be used to boot from that device. The boot modes of the i.MX boards are controlled by the boot configuration DIP switches on the board. For help locating the boot configuration switches, see the quick start guide for the specific board as listed under References above.
The following sections list basic boot setup configurations. The tables below represent the DIP switch settings for the switch blocks on the specified boards. An X means that particular switch setting does not affect this action.

4.5.1 Booting from an SD card in slot SD1

The following table shows the DIP switch settings for booting from the SD card slot labeled SD1 on the i.MX 7Dual SABRE­SD boards.
Table 2. Booting from SD1 on i.MX 7Dual SABRE-SD
Switch D1 D2 D3 D4 D5 D6 D7 D8
SW2 OFF OFF ON OFF OFF OFF OFF OFF
SW3 ON OFF - - - - - -
The following table shows the DIP switch settings for booting from the SD card slot labeled SD1 on the i.MX 7ULP EVK boards.
Table 3. Booting from SD1 on i.MX 7ULP EVK
Switch D1 D2 D3 D4
SW1 ON OFF OFF ON
The following table shows the bootcfg pin settings for booting from the SD card slot labeled SD1 on the i.MX 8QuadMax MEK boards.
Table 4. Booting from SD1 on i.MX 8QuadMax MEK
Switch D1 D2 D3 D4 D5 D6 D7 D8
SW2 OFF OFF ON ON OFF OFF - -
The following table shows the bootcfg pin settings for booting from the SD card slot labeled SD1 on the i.MX 8QuadXPlus MEK boards.
NOTE
This is the same setting for the i.MX 8DualX MEK and i.MX 8DXL EVK boards
Table 5. Booting from SD1 on i.MX 8QuadXPlus MEK
Switch D1 D2 D3 D4
SW2 ON ON OFF OFF
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 28 / 103
NXP Semiconductors
Booting Linux OS

4.5.2 Booting from an SD card in slot SD2

The SD card slot that is labeled SD2 indicates that this slot is connected to the uSDHC pin SD2 on the processor. Most boards label this slot as SD2. This slot is referred to as SD2 in this document.
The following table shows the DIP switch settings for booting from the SD card slot labeled SD2 and J500 on the i.MX 6 SABRE-SD boards. The SD2 card slot is located beside the LVDS1 connection on the back of the board.
Table 6. Booting from SD2 (J500) on i.MX 6 SABRE-SD
Switch D1 D2 D3 D4 D5 D6 D7 D8
SW6 ON OFF OFF OFF OFF OFF ON OFF
The i.MX 6UltraLite EVK board or i.MX 6ULL EVK board has one TF card slot on the CPU board. This slot uses the USDHC2 controller. The following table shows the DIP switch settings for booting from the TF slot.
Table 7. Booting from TF on i.MX 6UltraLite EVK and i.MX 6ULL EVK
Switch D1 D2 D3 D4
SW601 OFF OFF ON OFF
SW602 ON OFF - -
The i.MX 8M Quad EVK board has one TF card slot. This slot uses the USDHC2 controller. The following table shows the DIP switch settings for booting from the TF slot.
Table 8. Booting from TF on i.MX 8M Quad EVK
Switch D1 D2 D3 D4
SW801 ON ON OFF OFF
SW802 ON OFF - -
The i.MX 8M Mini EVK board has one TF card slot. This slot uses the USDHC2 controller. The following table shows the DIP switch settings for booting from the TF slot.
Table 9. Booting from TF on i.MX 8M Mini EVK
Switch D1 D2 D3 D4 D5 D6 D7 D8
SW1101 OFF ON OFF OFF OFF ON ON OFF
SW1102 OFF OFF ON ON OFF ON OFF OFF
The i.MX 8M Nano EVK board has one TF card slot. This slot uses the USDHC2 controller. The following table shows the DIP switch settings for booting from the TF slot.
Table 10. Booting from TF on i.MX 8M Nano EVK
Switch D1 D2 D3 D4
SW1101 ON ON OFF OFF
The i.MX 8M Plus EVK board has one TF card slot. This slot uses the USDHC2 controller. The following table shows the DIP switch settings for booting from the TF slot.
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 29 / 103
NXP Semiconductors
Booting Linux OS
Table 11. Booting from TF on i.MX 8M Plus EVK
Switch D1 D2 D3 D4
SW4 OFF OFF ON ON

4.5.3 Booting from an SD card in slot SD3

The SD card slot that is labeled SD3 indicates that this slot is connected to the uSDHC pin SD3 on the processor. Most boards label this slot as SD3. This slot is referred to as SD3 in this document.
The following table shows the DIP switch settings to boot from an SD card in slot SD3 on i.MX 6 SABRE-AI boards.
Table 12. Booting from an SD card in slot SD3 on i.MX 6 SABRE-AI
Switch D1 D2 D3 D4 D5 D6 D7 D8 D9 D10
S1 X X X OFF ON X X X X X
S2 X OFF ON OFF - - - - - -
S3 OFF OFF ON OFF - - - - - -
The following table shows the DIP switch settings to boot from an SD card in slot SD3 on i.MX 6SoloX SABRE-AI boards.
Table 13. Booting from an MMC card in Slot SD3 on i.MX 6SoloX SABRE-AI
Switch D1 D2 D3 D4 D5 D6 D7 D8
S4 OFF ON OFF X OFF OFF ON OFF
S3 X OFF OFF OFF ON ON OFF OFF
S1 OFF OFF ON OFF - - - -
The following table shows the DIP switch settings for booting from SD3, also labeled as J507. The SD3 slot is located between the HDMI and UART ports.
Table 14. Booting from an SD card in slot SD3 on i.MX 6 SABRE-SD
Switch D1 D2 D3 D4 D5 D6 D7 D8
SW6 OFF ON OFF OFF OFF OFF ON OFF

4.5.4 Booting from an SD card in slot SD4

The following table describes the dip switch settings for booting from an SD card in slot SD4.
The SD4 slot is on the center of the edge of the SoloX board.
Table 15. Booting from an SD card in slot SD4 on i.MX 6SoloX SABRE-SD
Switch D1 D2 D3 D4 D5 D6 D7 D8
SW10 OFF OFF OFF OFF OFF OFF OFF OFF
SW11 OFF OFF ON ON ON OFF OFF OFF
SW12 OFF ON OFF OFF OFF OFF OFF OFF
i.MX Linux® User's Guide, Rev. LF5.10.9_1.0.0, 31 March 2021
User's Guide 30 / 103
Loading...
+ 73 hidden pages