iMX6 Rex UltraPlus U-Boot

From Voipac Wiki
Jump to navigation Jump to search

U-Boot is a bootloader responsible for hardware initialization, loading and booting Linux kernel. It is also used for module flashing.

Build

Set toolchain

Export toolchain variables for every related terminal session.

Initial steps

Create working directory

mkdir -pv ~/workdir/imx6/bootloader/

U-Boot v2015.04

Download and extract source code

cd ~/workdir/imx6/bootloader/
git clone -b uboot-imx-v2015.04 --single-branch https://github.com/voipac/uboot-imx uboot-imx-v2015.04-rex
cd uboot-imx-v2015.04-rex

Compile

Output file is called u-boot.imx. All the compiled images are intended for production usage.

Compile for SD and Linux/Yocto

cd ~/workdir/imx6/bootloader/uboot-imx-v2015.04-rex
make distclean
make mx6rexultra_config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
cp u-boot.imx /srv/tftp/imx6/u-boot-imx6-rexultra.imx
cp u-boot.bin /srv/tftp/imx6/u-boot-imx6-rexultra.bin

Compile for SATA and Linux/Yocto

cd ~/workdir/imx6/bootloader/uboot-imx-v2015.04-rex
make distclean
make mx6rexultrasata_config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
cp u-boot.imx /srv/tftp/imx6/u-boot-imx6-rexultrasata.imx
cp u-boot.bin /srv/tftp/imx6/u-boot-imx6-rexultrasata.bin

Compile for Android 7.x

cd ~/workdir/imx6/bootloader/uboot-imx-v2015.04-rex
make distclean
make mx6rexultraandroid_config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
cp u-boot.imx /srv/tftp/imx6/u-boot-imx6-rexultraandroid.imx

How to Flash a new version

Flash image into SPI

setenv ipaddr 192.168.0.150
setenv serverip 192.168.0.1
tftp 0x177ff400 imx6/u-boot-imx6-rex*.bin
go 0x17800000

setenv ipaddr 192.168.0.150
setenv serverip 192.168.0.1
mw.b 0x10800000 0xFF 0x80000
tftp 0x10800000 imx6/u-boot-imx6-rex*.imx
if sf probe 2:2; then sf erase 0x0 0x80000; sf write 0x10800000 0x400 0x7fc00; fi

Flashing log:

U-Boot 2015.04-g3e8754e-dirty (May 08 2017 - 15:31:43)

CPU:   Freescale i.MX6Q rev1.2 at 792 MHz
CPU:   Temperature 42 C
Reset cause: WDOG
Board: MX6 Rex - ultra
I2C:   ready
DRAM:  2 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
SF: Detected SST25VF032B with page size 256 Bytes, erase size 4 KiB, total 4 MiB
In:    serial
Out:   serial
Err:   serial
Fastboot: Normal
flash target is MMC:0
Bad partition index:5 for partition:system
Bad partition index:4 for partition:data
Net:   FEC [PRIME]
Normal Boot
Hit any key to stop autoboot:  0 
Rex U-Boot > setenv ipaddr 192.168.1.150
Rex U-Boot > setenv serverip 192.168.1.1
Rex U-Boot > mw.b 0x10800000 0xFF 0x80000
Rex U-Boot > tftp 0x10800000 imx6/u-boot-imx6-rexultra.imx            
Using FEC device
TFTP from server 192.168.1.1; our IP address is 192.168.1.150
Filename 'imx6/u-boot-imx6-rexultra.imx'.
Load address: 0x10800000
Loading: #######################
         2.9 MiB/s
done
Bytes transferred = 330752 (50c00 hex)
Rex U-Boot > sf probe 2:2;sf erase 0x0 0x80000;sf write 0x10800000 0x400 0x7fc00
SF: Detected SST25VF032B with page size 256 Bytes, erase size 4 KiB, total 4 MiB
SF: 524288 bytes @ 0x0 Erased: OK
SF: 523264 bytes @ 0x400 Written: OK
Rex U-Boot >

Flash image into SATA

setenv ipaddr 192.168.0.150
setenv serverip 192.168.0.1
tftp 0x177ff400 imx6/u-boot-imx6-rex*.bin
go 0x17800000

setenv ipaddr 192.168.0.150
setenv serverip 192.168.0.1
mw.b 0x10800000 0xFF 0x80000
tftp 0x10800000 imx6/u-boot-imx6-rex*sata.imx
if sata init; then sata write 0x10800000 0x2 0x3ff; fi

U-Boot v2014.10

Download and Extract source code

cd ~/workdir/imx6/bootloader/
git clone -b uboot-imx-v2014.10 --single-branch https://github.com/voipac/uboot-imx uboot-imx-v2014.10-rex
cd uboot-imx-v2014.10-rex

Compile

Output file is called u-boot.imx. The compiled image is intended for production usage.

Compile for Linux/Yocto

cd ~/workdir/imx6/bootloader/uboot-imx-v2014.10-rex
make distclean
make mx6rexultra_config
make
cp u-boot.imx /srv/tftp/imx6/u-boot-imx6-rexultra.imx
cp u-boot.bin /srv/tftp/imx6/u-boot-imx6-rexultra.bin

How to Flash a new version

setenv ipaddr 192.168.0.150
setenv serverip 192.168.0.1
tftp 0x177ff400 imx6/u-boot-imx6-rexultra.imx
go 0x17800000

setenv ipaddr 192.168.0.150
setenv serverip 192.168.0.1
mw.b 0x10800000 0xFF 0x80000
tftp 0x10800000 imx6/u-boot-imx6-rexultra.imx
sf probe 2:2;sf erase 0x0 0x80000;sf write 0x10800000 0x400 0x7fc00

Configure

Manually erase configuration

Rex U-Boot > sf probe 2:2           
SF: Detected SST25VF032B with page size 256 Bytes, erase size 4 KiB, total 4 MiB
Rex U-Boot > sf erase 0x80000 0x2000
SF: 8192 bytes @ 0x80000 Erased: OK
Rex U-Boot > reset

Running bootloader from SD card

iMX6 Rex Modules are configured to boot from SPI flash memory by default using eFuses configuration. This setting can be overwritten by running a special firmware that must be stored into SPI flash memory:

setenv ipaddr 192.168.0.150
setenv serverip 192.168.0.1
mw.b 0x10800000 0xFF 0x80000
tftp 0x10800000 imx6/iMX6DQ_SPI_to_uSDHC3.bin
sf probe 2:2
sf erase 0x0 0x80000
sf write 0x10800000 0x0 0x80000

Manually boot from SATA

mw.l 0x020d8040 0x00001020; mw.l 0x020d8044 0x10000000; reset