Update U-Boot from Linux

NOTE: Incorrect procedure or power loss during this process can render your board unusable - please be careful.

NOTE: If you are able to boot into Linux, then please follow this guide, and avoid updating from U-Boot.

If you are unable to boot into Linux, then it is possible to update U-Boot from within U-Boot.

This guide will not cover getting the update binary onto your 4Kopen board - use the network (SCP / TFTP) or a USB memory stick.

The current bootloader image is 4KOpen-flash-v1.0.0.bin (MD5: 371f11a16f1fbd6994e2489efa98993a).

Verify MTD Partitioning

If the SPI flash is partitioned incorrectly, then do not attempt to flash an update using this method without rectifying it.

If the content of /proc/mtd is not as below then you can use the procedure for updating U-Boot from U-Boot instead.

root@board:~$ cat /proc/mtd
dev: size erasesize name
mtd0: 02000000 00010000 "boot"

Insert the MAC Address

Write your MAC address into the update image.

If eth0 does not have the correct MAC address already, then please see fixing MAC address from userspace.

root@board:~$ printf "ethaddr=%s\0" $(cat /sys/class/net/eth0/address) | dd of=${UPDATE_BINARY} seek=208 bs=4k conv=notrunc
0+1 records in
0+1 records out

Write the Update to Flash

Once the file is available from the 4Kopen board, run the following command.

root@board:~$ dd if=${UPDATE_BINARY} of=/dev/mtdblock0 bs=4k
8192+0 records in
8192+0 records out

Verify Update

Verify. If any issues present, re-run from "Write Update to Flash". If there are no differences, then diff will not output anything, and will return with return code 0.

root@board:~$ diff ${UPDATE_BINARY} /dev/mtdblock0
root@board:~$ echo $?