iMX6 Rex Pro U-Boot

From Voipac Wiki
Revision as of 21:45, 23 March 2021 by Voipac (talk | contribs)
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 mx6rexpro_config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
cp u-boot.imx /srv/tftp/imx6/u-boot-imx6-rexpro.imx
cp u-boot.bin /srv/tftp/imx6/u-boot-imx6-rexpro.bin

Compile for SD, Linux/Yocto and SD bootloader

File iMX6DQ_SPI_to_uSDHC3.bin will be used in combination with the compiled U-Boot.

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

Compile for SATA and Linux/Yocto

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

Compile for Android 7.x

cd ~/workdir/imx6/bootloader/uboot-imx-v2015.04-rex
make distclean
make mx6rexproandroid_config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
cp u-boot.imx /srv/tftp/imx6/u-boot-imx6-rexproandroid.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 - pro
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-rexpro.imx            
Using FEC device
TFTP from server 192.168.1.1; our IP address is 192.168.1.150
Filename 'imx6/u-boot-imx6-rexpro.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 mx6rexpro_config
make
cp u-boot.imx /srv/tftp/imx6/u-boot-imx6-rexpro.imx
cp u-boot.bin /srv/tftp/imx6/u-boot-imx6-rexpro.bin

Compile for Linux/Yocto and SD bootloader

File iMX6DQ_SPI_to_uSDHC3.bin will be used in combination with the compiled U-Boot.

cd ~/workdir/imx6/bootloader/uboot-imx-v2014.10-rex
make distclean
make mx6rexprosd_config
make
cp u-boot.imx /srv/tftp/imx6/u-boot-imx6-rexprosd.imx
cp u-boot.bin /srv/tftp/imx6/u-boot-imx6-rexprosd.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-rexpro.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-rexpro.imx
sf probe 2:2;sf erase 0x0 0x80000;sf write 0x10800000 0x400 0x7fc00

U-Boot with SD bootloader version

Bootloader can be also stored directly into SD card using host system:

sudo dd if=u-boot-imx6-rexprosd.imx of=/dev/sdb bs=1k seek=1 skip=0 oflag=dsync

or

#setenv ipaddr 192.168.0.150
#setenv serverip 192.168.0.1
#tftp 0x177ff400 imx6/u-boot-imx6-rexpro.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-rexprosd.imx
mmc dev 0
setexpr fw_sz ${filesize} / 0x200
setexpr fw_sz ${fw_sz} + 1
mmc write 0x10800000 0x2 ${fw_sz}

U-Boot v2009.08

Download and Extract source code

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

Compile

Output file is called u-boot.imx. The compiled image is intended for production usage and capable of loading Linux, Yocto or Android 4.4.x

cd ~/workdir/imx6/bootloader/uboot-imx-v2009.08-rex
make distclean
make mx6q_rex_config
make -j4
cp -av u-boot.bin /srv/tftp/imx6/u-boot-0x27800000_imx6q_$(date "+%Y%m%d").bin

How to Flash a new version

Flash image into SPI

setenv ipaddr 192.168.0.150
setenv serverip 192.168.0.1

mw.b 0x10800000 0xFF 0x80000
tftp 0x10800000 imx6/u-boot-0x27800000_imx6q_20160410.bin
sf probe 2:2;sf erase 0x0 0x80000;sf write 0x10800000 0x0 0x80000

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

Android 4.4.2 bootloader + FEDEVEL kernels

To boot kernels available at iMX6Rex.com the machine id variable must be modified:

Rex U-Boot > setenv machid f8c
Rex U-Boot > saveenv

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