Loading...
 

Update the Bootloader

 Warning

Reflashing the bootloader image can potentially brick your ESPRESSObin board, especially if you have modified the bootloader source code by your own, or the ESPRESSObin board experiences power loss during the update procedure. Please proceed with extra caution.

Bootloader images for different ESPRESSObin flavors can be obtained either by:

  • Building them manually from source by following the steps in Build from source - Bootloader
  • Downloading prebuilt 17.06 or 17.10 release images from Tech Spec page, Software table under Bootloader.

 Warning

Whether using manually built or prebuilt images, make sure to use the image according to the DDR flash configuration (DDR3 or DDR4) and the DDR memory size (512MB, 1GB or 2GB) of your ESPRESSObin board.

We will cover two methods of updating the bootloader:

  • Using TFTP server
  • Using USB stick or SD card 

TFTP server

This section will show you how to setup a TFTP server on your local Linux machine and use it to transfer the bootloader image. Trivial File Transfer Protocol (TFTP) is a simple File Transfer Protocol for transferring files onto a remote host. The protocol is primarily used in the early stages of nodes booting from a local network.

Requirements

  • Bootloader image.
  • Installed TFTP server - To setup TFTP on your Linux machine, install tftp-hpa package (the package name might differ depending on your distribution so check your distribution's official documentation).
  • Both the host (laptop) and the client (board) connected to the same IP switch or router (that is, they both must be on the same subnet).

Steps

On your local machine navigate to where you have manually built or downloaded the pre-built bootloader image. From there start the TFTP server with:

$ sudo in.tftpd -L -s .

Connect an Ethernet cable to the WAN port on ESPRESSObin and the other end to your router or IP switch. Also connect to the ESPRESSObin board via serial (see section Serial Connection in Quick User Guide).

Now power on the ESPRESSObin board and interrupt the autoboot process to stay in the U-Boot command prompt. Once here, set the server (Linux machine where the TFTP server is running) and the client (ESPRESSObin board) IP addresses:

Marvell>> setenv serverip 192.168.x.x
Marvell>> setenv ipaddr 192.168.x.x

You can check if the server is alive with ping:

Marvell>> ping $serverip

Once you have a working network under U-Boot, you can update the bootloader using the bubt command.

Below is an example of flashing the U-Boot-armada-17.10 1GB 2CS DDR3 bootloader image (replace the image name accordingly). By default, bubt flashes the image on the currently active boot source.

Marvell>> bubt espressobin-bootloader-cpu-1000-ddr3-2cs-1g-atf-ga3306ab-uboot-gaee49fc-20180129-REL.bin
Burning U-BOOT image "espressobin-bootloader-cpu-1000-ddr3-2cs-1g-atf-ga3306ab-uboot-gaee49fc-20180129-REL.bin" from "tftp" to "spi"
Using neta@30000 device
TFTP from server 192.168.10.134; our IP address is 192.168.10.145
Filename 'espressobin-bootloader-cpu-1000-ddr3-2cs-1g-atf-ga3306ab-uboot-gaee49fc-20180129-REL.bin'.
Load address: 0x2000000
Loading: #################################################################
 #################################################################
 #################################################################
 #################################################################
 ##########################
 2.3 MiB/s
done
Bytes transferred = 4194304 (400000 hex)
Image checksum...OK!
SF: Detected w25q32dw with page size 256 Bytes, erase size 4 KiB, total 4 MiB
Erasing 4198400 bytes (1025 blocks) at offset 0 ...Done!
Writing 4194304 bytes from 0x2000000 to offset 0 ...Done!

After the bootloader update is done, reset or power cycle the ESPRESSObin. Check the log info of the ATF and bootloader to confirm if the update is successful.

USB stick or SD card


Below instructions show how to prepare a bootable USB stick, however, the steps are identical to how you would go about preparing a micro SD card.

Requirements

  • Bootloader image.
  • Working USB stick or micro SD card

Steps 

On your local machine navigate to where you have manually built or downloaded the prebuilt bootloader image. Insert the USB stick and list block devices with lsblk:

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 238.5G  0 disk 
├─sda1   8:1    0  1023M  0 part /boot
├─sda2   8:2    0     5G  0 part [SWAP]
└─sda3   8:3    0 232.5G  0 part /
sdb      8:16   1   3.6G  0 disk 
└─sdb1   8:17   1   3.6G  0 part

The USB stick is listed here as /dev/sdb but it is not empty, so we will clean everything from it (replace sdX with the label of your USB stick/SD card):

$ sudo dd if=/dev/zero of=/dev/sdX bs=1M count=100

Now format the USB stick as EXT4:

  • If using e2fsprogs version < 1.43, do:
$ sudo mkfs.ext4 /dev/sdb
  • If using e2fsprogs version >=1.43, do:
$ sudo mkfs.ext4 -O ^metadata_csum,^64bit /dev/sdb

Mount the USB stick (e.g. to /mnt/usb/) and copy the bootloader image to the newly formatted USB stick:

$ sudo mount /dev/sdb /mnt/usb
$ sudo cp /path/to/bootloader-image.bin /mnt/usb
$ sudo umount /mnt/usb

Unmount the USB stick and plug it in the USB 3.0 port on your ESPRESSObin. In case you are using an SD card, plug it into the micro SD card slot on the ESPRESSObin.

Connect to the board via serial (see section Serial Connection in Quick User Guide). Power on ESPRESSObin, interrupt the autoboot process and have the ESPRESSObin stay in the U-Boot command prompt.

If using a USB stick, run usb start to check if the USB device is being recognized:

Marvell>> usb start
[...]
2 USB Device(s) found
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

Lastly, update the bootloader using the bubt command and passing the right parameters to it (replace flash-image.bin with your image filename):

Marvell>> bubt flash-image.bin spi usb

If you are using a micro SD card, simply replace the source in the command above to mmc:

Marvell>> bubt flash-image.bin spi mmc

After the bootloader update is done, type reset in the U-Boot console or power cycle the ESPRESSObin board. Check the log info of the ATF and bootloader to confirm if the update is successful.

bubt command


For a complete bubt command usage reference, type help bubt in U-Boot to check the parameter definitions.

Marvell>> help bubt
bubt - Burn a u-boot image to flash

Usage:
bubt [file-name] [destination [source]]
        -file-name     The image file name to burn. Default = flash-image.bin
        -destination   Flash to burn to [spi, nor, nand, mmc, spinand]. Default = active boot device
        -source        The source to load image from [tftp, usb, mmc]. Default = tftp
Examples:
        bubt - Burn u-boot.bin from tftp to active boot device
        bubt latest-spi.bin nand - Burn latest-spi.bin from tftp to NAND flash
        bubt backup-nor.bin nor usb - Burn backup-nor.bin from usb to NOR flash

Starting from the armada-17.06 release, the U-Boot version is upgraded from 2015.01 to 2017.03. In order to avoid any possible incompatibility issues, under the new U-Boot version, do env default -a to reset all the environment variables, then set up the desired variables again, and do env save to write them to the non-volatile storage.

Marvell>> env default -a
Marvell>> env save

Recovery


In case you have bricked your board, there are a few available recovery methods: