Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lemmi/7c5bec47ba3766563a654c08eb1f3c91 to your computer and use it in GitHub Desktop.
Save lemmi/7c5bec47ba3766563a654c08eb1f3c91 to your computer and use it in GitHub Desktop.
Booting Debian on SolidRun ClearFog CN9130 Base and ClearFog CN9130 Pro

Booting Debian on SolidRun ClearFog CN9130 Base and CN9130 ClearFog CN9130 Pro

SolidRun provides different pre-baked images to get started with their ClearFog CN9130 devices. Most interesting is the Debian image, since it works with upstream kernels. The only real addition SolidRun made to the distribution are the device tree binaries, that have yet to find their way into mainline Linux.

Still, both devices aren't able to boot the image out of the box at the time of writing in mid July 2022.

Beginning with devices produced April 2022 or later, the units ship with a pre-programmed u-boot boot loader on the SPI flash. The devices are also selected to use this boot method and the boot loader is prepared to look on all other media for something bootable. This is convenient, since you can just plug in a microSD card and boot the thing, move the image onto the embedded eMMC and it will fallback to that.

ClearFog CN9130 Base

TL;DR

  • The boards carry the same boot loader and environment
  • u-boot reads the part number from an EEPROM on the carrier board
  • u-boot chooses the dtb according to the part number
  • SolidRun ships a different part number format than u-boot expects
  • By default, the dtb for the ClearFog CN9130 Pro model is chosen
  • Linux gets the wrong device tree and fails to boot
  • In this case you can either
    1. Overwrite the EEPROM with the expected value (see below), or
    2. Set the u-boot fallback the the correct dtb
      • setenv fdtfile marvell/cn9130-cf-base.dtb
      • saveenv to make it permanent

The slightly longer version

The devices seem to share the same boot loader and configuration, but are equipped with access to 2 other EEPROMs. One sits on the the SOM, the other on the carrier board. They can be accessed within u-boot via the tlv_eeprom command.

To read out both memory contents use:

tlv_eeprom read

Display the content on the carrier memory (dev 0):

tlv_eeprom dev 0
tlv_eeprom

Display the content on the SOM memory (dev 1):

tlv_eeprom dev 1
tlv_eeprom

The ONIE Specification describes the all the available values and encoding, but the interesting bit the Part Number (TLV_CODE_PART_NUMBER). It's used to disambiguate the two boards by looking at couple of bytes within the string

As it happens my device came with the long SKU SRS9130S64D04GE008V11C0 programmed in. For the carrier to be identified as a Base model, the code expects to read CFCB, but sees S913.

SolidRun's EEPROM documentation suggests to use SRCFCB9130IV14.

The annoying bit is that in order to change a single value, the whole EEPROM needs to be wiped and then correctly repopulated.

tlv_eeprom dev 0
tlv_eeprom erase
tlv_eeprom set 0x21 'Clearfog Base'        # Product Name
tlv_eeprom set 0x22 SRCFCB9130IV14         # CORRECTED Part Number
tlv_eeprom set 0x23 XXXXXXXXXXXXXXXX       # Serial Number
tlv_eeprom set 0x25 '01/20/2022 13:37:00'  # Manufacture Date (note the Format Oo) 
tlv_eeprom set 0x26 YY                     # Device Version
tlv_eeprom set 0x2B ZZZZZZZZZZZZZZ         # Manufacturer
tlv_eeprom set 0x2C CC                     # Country Code
tlv_eeprom set 0x2D SolidRun               # Vendor Name
tlv_eeprom write

In case the fdtfile environment variable has been set before, it has to be reset, or it will overwrite the decision made via the part number.

env default -f fdtfile
env save
reset

Easy.

ClearFog CN9130 Pro

This issue might also concern the Base model, though this isn't confirmed.

Using the provided image, u-boot hands off correctly to kernel. Little later the kernel will hang at about this point:

...
[    1.650191] Warning: unable to open an initial console.
[    1.657921] Freeing unused kernel memory: 5440K
[    1.695366] Checked W+X mappings: passed, no W+X pages found
[    1.701191] Run /init as init process

Curiously the kernel complains about being unable to open a console, yet there already is output on the serial console.

A little earlier the kernel reports:

Kernel command line: console=console=ttyS0,115200 earlycon=uart8250,mmio32,0xf0512000 log_level=7 net.ifnames=0

Removing console=console=ttyS0,115200 earlycon=uart8250,mmio32,0xf0512000 fixes the issue and the kernel boots correctly.

TL;DR

The way to achieve this is to remove the console environment variable in u-boot. The bootscript /boot/boot.scr will otherwise append this variable to the command line.

To remove it:

env delete console

Again, to make it permanent:

env save

Then:

reset

Profit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment