Booting helios4 or ClearFog from SPI

Helios4 is a NAS device made by Kobol Innovations, it is a mvebu device and based on the same SoM(System on Module) from SolidRun as is used in their ClearFog devices. While some of the early ClearFog devices do not have SPI flash all recent ones and all Helios4 devices have an onboard SPI flash that can be used to boot from.

Recently Fedora added SPI and UART u-boot images for the Kobol helios4 and SolidRun ClearFog. Getting your device to boot from SPI is fairly straightforward. There are two things that you need to do, put u-boot on the SPI flash and set the jumpers so the system will boot from SPI.

There are two ways to initially install u-boot onto the SPI flash, the first is to boot from a sdcard, the second is to boot from uart.

The simplest way to get started is to use a sdcard, to date, the ones I have used had a vfat partition in the first partition ext4 should also work. On any fedora, system install arm-image-installer and uboot-images-armv7 as this provides the necessary bits

$ sudo dnf install arm-image-installer uboot-images-armv7

With the packages installed we then need to set up the card so that we can put u-boot into the SPI flash. U-Boot in Fedora puts all of the images into /usr/share/uboot/ for the mvebu devices that have SPI flash there is a directory that contains the sdcard version of u-boot and one ending in -spi and another with -uart containing images for the target boot types.

$ sudo update-uboot --target helios4 --media=/dev/XXX
$ sudo cp /usr/share/uboot/helios4-spi/u-boot-spl.kwb /mnt/point/of/sdcard/
$ sudo eject /dev/XXX

Then insert the sdcard to your ClearFog or Helios4 connecting to the serial console and power on. When u-boot shows its output it is simplest to interrupt the boot process and proceed with flashing u-boot to SPI. We use a tool in u-boot called bubt to do the hard work for us. bubt takes the filename as the first argument the destination device type as the second and the source device type as the third argument. The source device has to be one of mmc, usb, or tftp, which in the case of using a ClearFog or Helios4 solely from HDD upgrades will need network or another device.

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

bubt [file-name] [destination [source]]
        -file-name     The image file name to burn. Default = flash-image.bin
        -destination   Flash to burn to [spi, nand, mmc]. Default = spi
        -source        The source to load image from [tftp, usb, mmc]. Default = tftp
        bubt - Burn flash-image.bin from tftp to active boot device
        bubt flash-image-new.bin nand - Burn flash-image-new.bin from tftp to NAND flash
        bubt backup-flash-image.bin mmc usb - Burn backup-flash-image.bin from usb to MMC

=> bubt u-boot-spl.kwb spi mmc
Burning U-Boot image "u-boot-spl.kwb" from "mmc" to "spi"
Image checksum…OK!
SF: Detected w25q32 with page size 256 Bytes, erase size 4 KiB, total 4 MiB
Erasing 561152 bytes (137 blocks) at offset 0 …Done!
Writing 561072 bytes from 0x800000 to offset 0 …Done!

Once we have installed u-boot onto the SPI flash there is one more step, change the settings to tell the SoC where to boot from. lists the settings for the ClearFog devices and lists the settings for the Helios4

After setting the dip switches correctly to boot from SPI you can go and install using one of the many supported options, PXE, sdcard, or USB. Without any working u-boot the SoC will fall back to booting from uart. If you want to go down this path you can use kwboot from the uboot-tools package, it is also a good recovery method.

$ sudo yum install uboot-tools
$ sudo /usr/bin/kwboot -t -b /usr/share/uboot/helios4-uart/u-boot-spl.kwb -B 115200 /dev/ttyUSBX

You will then get access to a mini terminal to run u-boot commands to flash to SPI, note that you will need a supported source to use for bubt to flash to SPI. To update you will need to be attached to the serial console and follow the same process, as noted earlier if you are using a m.2 SSD or a sata drive you will need to put the u-boot binary on a supported media, either a sdcard or a USB stick, Interrupting the boot process and writing the new image. If you boot from a sdcard you can on the running system run a simple command to put u-boot in place and reboot

sudo cp /usr/share/uboot/helios4-spi/u-boot-spl.kwb /boot/efi/

All the examples are using the helios4, the process works for all supported devices currently: ClearFog, helios4, and turris_omnia, for the ClearFog both the Base and Pro versions work. Please note that some early versions of the ClearFog did not have a SPI flash on the SOM and if you have one of those you will get an error trying to initialise the SPI flash as it does not exist, in that case, you have to boot from a sdcard.

, ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.