Skip to content

Update U Boot in SPI Flash

Per Sandström edited this page Dec 4, 2017 · 33 revisions

The stock U-Boot delivered with the board is too old (2009.08) to be used with a current Linux kernel like 3.10.17 or newer which use a Device Tree. Therefore, U-Boot needs to be updated.

Note: this voids your warranty. You might want to save the original U-Boot first (extract it form SPI flash and save it on a microSD card) to be able to restore the original state later (I you feel the need).

Prerequisites

Procedure

On the build host:

Copy u-boot.imx to a microSD card. You may use the same card that you might have prepared for the Linux image (see Build a Linux image and Prepare SD card). In the following we assume that the first partition of the micro SD card contains a FAT file system that is mounted as /media/frank/uboot

sudo cp '.../fsl-community-bsp/build/tmp/deploy/images/marsboard/u-boot.imx' /media/frank/uboot
sync
sudo umount /media/frank/uboot

Remove the card form the build host, but do not insert it in the target (Mars Board) yet.

Connect MarS Board via USB-OTG and download u-boot.imx (see USB-OTG Boot)

sudo .../imx_usb .../fsl-community-bsp/build/tmp/deploy/images/marsboard/u-boot.imx

Connect to MarS Board using the other mini USB ("debug") port and a terminal program (minicom):

sudo minicom -D/dev/ttyUSB0
Welcome to minicom 2.7

OPTIONS: I18n 
Compiled on Jan  1 2014, 17:13:19.
Port /dev/ttyUSB1, 11:29:17
Press CTRL-A Z for help on special keys 
=> 

Depending on the U-Boot version, it is possible that U-Boot tries to boot via network. Try to stop this by pressing Ctrl+C and/or waiting a bit. Eventually the U-Boot prompt will appear.

You may check U-Boot version by typing

ver

Now, insert the prepared microSD card in the target board. Find the u-boot.imx file on sd-card:

fatls mmc 0:1 / 

The device:partition may vary, depending on Das U-Boot version. If Das U-Boot "hangs", re-boot and try another device:partition

Load u-boot.imx file into DRAM memory, starting at address 0x10800000. This is the address normally used for the Linux kernel, so we know there is plenty of free memory available. (Advanced: use bdinfo to locate memory.)

fatload mmc 0:1 0x10800000 /u-boot.imx                                 

Erase SPI-NOR flash and write u-boot.imx to it:

The last parameter of sf write 0x80000 must be at least the size of u-boot.imx in hex.

sf probe 0
sf erase 0 0xC0000
sf write 0x10800000 0x400 0x80000

The sf erase size is the total size reserved for U-Boot. SPI partitioning is as follows:

  • U-Boot (u-boot.imx) partition: start at offset 0, size 0xC0000
  • U-Boot environment partition: start at offset 0xC0000, size 0x2000
  • U-Boot splash screen partition: start at offset 0xC2000, size 0x13e000

Switch boot mode to "SPI-NOR boot", i.e. both SW1 switches OFF (towards the iMX6), remove the micro SD card and reset board. The newly updated U-Boot should boot from SPI flash.

Next, you must Set U-Boot Environment to tell U-Boot where and how to boot Linux.

If you accidentally bricked your board, you may recover it by using USB OTG Boot and retry.