i.MX8 - Nitrogen8M - System Recovery

From RidgeRun Developer Wiki


Previous: Nitrogen8M/Android/Installing_an_image Index Next: Multimedia






Overview

This page presents a guide about how to recover your board when it is not booting. In order to recover your board, some components are required to be built in specific folders. Required components:

  1. U-Boot
  2. Flash Image
  3. USB Loader

Define a building directory:

RECOVERY_DIR=~/Nitrogen8M-recovery
mkdir $RECOVERY_DIR

Dependencies

Install required dependencies for Nitrogen8M recovery:

sudo apt-get install crossbuild-essential-arm64 libusb-1.0-0-dev pkg-config

U-Boot

Clone Boundary Devices repository using your desired U-Boot version.

BRANCH=boundary-v2018.07
cd $RECOVERY_DIR
git clone https://github.com/boundarydevices/u-boot-imx6 -b $BRANCH

Define toolchain for building the source code.

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-

Build kernel and device tree.

DEFCONFIG=nitrogen8m_defconfig
cd $RECOVERY_DIR/u-boot-imx6
make $DEFCONFIG
make -j4

Building Image

In order to generate the final flash file, imx-mkimage tool is required. Download imx-mkimage tool as follows.

cd $RECOVERY_DIR
git clone https://github.com/boundarydevices/imx-mkimage.git

Define required variables.

UBOOT_PATH=$RECOVERY_DIR/u-boot-imx6

Create the flash image.

cd imx-mkimage
./make_boundary.sh

At this point, a flash.bin file should be created under $RECOVERY_DIR/imx-mkimage/iMX8M.

USB loader

Before flashing the board, build the flashing tool imx_usb as follows.

cd $RECOVERY_DIR
git clone git://github.com/boundarydevices/imx_usb_loader
cd imx_usb_loader
make

Flashing Board

Finally, under RECOVERY_DIR you must have 3 directories:

  1. imx-mkimage: Image to flash.
  2. imx_usb_loader: Flashing tool.
  3. u-boot-imx6: U-Boot used by image to flash.

Set your board to Serial Download mode, set the boot switch position as follows.

Boot switch on Nitrogen8M
Boot switch on Nitrogen8M

Now, connect the board to a host machine using the OTG port. Check with lsusb if your board is detected.

Output example:

 
user@laptop:~$ lsusb | grep NXP
Bus 001 Device 047: ID 1fc9:012b NXP Semiconductors

Before flashing, check mx8mq_usb_work.conf in RECOVERY_DIR/imx_usb_loader which contains the required files. As example, the Nitrogen8M with 2 GB RAM requires the file bl31_2g.bin in mx8mq_usb_work.conf.

See the table below in order to set the conf file according to your board's available RAM.

RAM File
2 GB bl31_2g.bin
3 GB bl31_3g.bin
4 GB bl31_4g.bin

In order to flash the board, run the following command:

sudo ./imx_usb

Output example:

config file <.//imx_usb.conf>
vid=0x066f pid=0x3780 file_name=mx23_usb_work.conf
vid=0x15a2 pid=0x004f file_name=mx28_usb_work.conf
vid=0x15a2 pid=0x0052 file_name=mx50_usb_work.conf
vid=0x15a2 pid=0x0054 file_name=mx6_usb_work.conf
vid=0x15a2 pid=0x0061 file_name=mx6_usb_work.conf
vid=0x15a2 pid=0x0063 file_name=mx6_usb_work.conf
vid=0x15a2 pid=0x0071 file_name=mx6_usb_work.conf
vid=0x15a2 pid=0x007d file_name=mx6_usb_work.conf
vid=0x15a2 pid=0x0080 file_name=mx6ull_usb_work.conf
vid=0x1fc9 pid=0x0128 file_name=mx6_usb_work.conf
vid=0x15a2 pid=0x0076 file_name=mx7_usb_work.conf
vid=0x1fc9 pid=0x0126 file_name=mx7ulp_usb_work.conf
vid=0x15a2 pid=0x0041 file_name=mx51_usb_work.conf
vid=0x15a2 pid=0x004e file_name=mx53_usb_work.conf
vid=0x15a2 pid=0x006a file_name=vybrid_usb_work.conf
vid=0x066f pid=0x37ff file_name=linux_gadget.conf
vid=0x1b67 pid=0x4fff file_name=mx6_usb_sdp_spl.conf
vid=0x0525 pid=0xb4a4 file_name=mx6_usb_sdp_spl.conf
vid=0x1fc9 pid=0x012b file_name=mx8mq_usb_work.conf
config file <.//mx8mq_usb_work.conf>
parse .//mx8mq_usb_work.conf
Trying to open device vid=0x1fc9 pid=0x012b
Interface 0 claimed
HAB security state: development mode (0x56787856)
== work item
filename ../imx-mkimage/iMX8M/flash.bin
load_size 0 bytes
load_addr 0x00000000
dcd 1
clear_dcd 1
plug 1
jump_mode 3
jump_addr 0x00000000
== end work item
No DCD table

loading binary file(../imx-mkimage/iMX8M/flash.bin) to 32c10000, skip=1c00, fsize=18000 type=aa

<<<98304, 98304 bytes>>>
succeeded (security 0x56787856, status 0x88888888)

loading binary file(../imx-mkimage/iMX8M/flash.bin) to 007e0bd0, skip=19c00, fsize=29800 type=aa

<<<169984, 169984 bytes>>>
succeeded (security 0x56787856, status 0x88888888)
jumping to 0x007e0fd0
failed (security 0x56787856, status 0x3311cf00)
HAB security state: development mode (0x56787856)
== work item
filename ../imx-mkimage/iMX8M/u-boot.bin
load_size 0 bytes
load_addr 0x40200000
dcd 0
clear_dcd 0
plug 0
jump_mode 0
jump_addr 0x00000000
== end work item

loading binary file(../imx-mkimage/iMX8M/u-boot.bin) to 40200000, skip=0, fsize=a82f0 type=0

<<<688880, 688880 bytes>>>
succeeded (security 0x56787856, status 0x88888888)
HAB security state: development mode (0x56787856)
== work item
filename ../imx-mkimage/iMX8M/bl31_2g.bin
load_size 0 bytes
load_addr 0x00910000
dcd 0
clear_dcd 0
plug 0
jump_mode 2
jump_addr 0x00910000
== end work item

loading binary file(../imx-mkimage/iMX8M/bl31_2g.bin) to 00910000, skip=0, fsize=b858 type=aa

<<<47192, 47192 bytes>>>
succeeded (security 0x56787856, status 0x88888888)
jumping to 0x0091b818


Previous: Nitrogen8M/Android/Installing_an_image Index Next: Multimedia