June 17, 2024

Antminer S9 board - setup for diskless boot

It is fairly simple to get root access to the linux system on one of these boards. I turns out to be less easy to reconfigure U-Boot to do a diskless (network) boot of arbitary images.

It ought to be easy. It is easy for many ARM based single board computers. You change and augment various U-boot environment variables, then you type "saveenv" and the board will do a network boot every time you power it on.

I did the following experiment. I interrupted U-boot by typing a character. I used printenv to look at the environment variables. Then I did this:

set zork test
saveenv
U-boot responded with:
zynq-uboot> saveenv
Saving Environment to NAND...
Erasing NAND...
Erasing at 0xe0000 -- 100% complete.
Writing to NAND... OK
But when I cycle power, it no longer launches U-Boot. It runs the FSBL, which gives a bunch of messages which I append to this page.

Analysis

In a nutshell, saveenv is not implemented properly and is bricking the system. The easiest path to getting this board back online is probably to boot from an SD card and reflash the corrupted NAND memory.

Once this is done, we are back to where we started, namely trying to reconfiure U-Boot to do a network boot. I did this before for the EBAZ-4205. That board simply refused to even attempt a saveenv (which honestly is better than doing some broken and buggy implementation). For that board I analyzed the NAND image and figured out a way to patch the U-Boot config that was on the board. And I still have the tools I used to do that.

Another approach would be to build and reinstall U-boot. This would allow the configuration to be made whatever might be desired. It might even be possible to fix saveenv so that it worked properly. This would have the advantage (if you want to call it that) of getting me familiar with U-Boot for the Zynq.

There is yet another possibility. Generate a bootable SD card, then see if the U-boot on SD card has a working saveenv. It would be considerably easier to experiment with U-Boot on an SD card that on NAND flash, if playing games with U-boot needs to be pushed beyond the obvious.


I'll make a few comments of what is below. First of all PCAP is a mechanism for loading a bitstream into the PL (FPGA). Why the first stage boot loader needs to do anything at all with the FPGA is lost on me.

The chatter from the FSBL ends with: "FSBL Status = 0xA00B". This is (as it says) "PARTITION_MOVE_FAIL".

The Messages

Xilinx First Stage Boot Loader
Release 2015.4	Mar 29 2018-17:25:31
Devcfg driver initialized
Silicon Version 3.1
Boot mode is NAND
                 InitNand: Geometry = 0x8
Nand driver initialized
NAND Init Done
Flash Base Address: 0xE1000000
Reboot status register: 0x60400000
Multiboot Register: 0x0000C000
Image Start Address: 0x00000000
Partition Header Offset:0x00000C80
Partition Count: 3
Partition Number: 1
Header Dump
Image Word Len: 0x0007F2E8
Data Word Len: 0x0007F2E8
Partition Word Len:0x0007F2E8
Load Addr: 0x00000000
Exec Addr: 0x00000000
Partition Start: 0x000075D0
Partition Attr: 0x00000020
Partition Checksum Offset: 0x00000000
Section Count: 0x00000001
Checksum: 0xFFE7AF06
Bitstream
In FsblHookBeforeBitstreamDload function
PCAP:StatusReg = 0x40000A30
PCAP:device ready
PCAP:Clear done
Level Shifter Value = 0xA
Devcfg Status register = 0x40000A30
PCAP:Fabric is Initialized done
PCAP register dump:
PCAP CTRL 0xF8007000: 0x4C00E07F
PCAP LOCK 0xF8007004: 0x0000001A
PCAP CONFIG 0xF8007008: 0x00000508
PCAP ISR 0xF800700C: 0x0802000B
PCAP IMR 0xF8007010: 0xFFFFFFFF
PCAP STATUS 0xF8007014: 0x50000A20
PCAP DMA SRC ADDR 0xF8007018: 0x00100001
PCAP DMA DEST ADDR 0xF800701C: 0xFFFFFFFF
PCAP DMA SRC LEN 0xF8007020: 0x0007F2E8
PCAP DMA DEST LEN 0xF8007024: 0x0007F2E8
PCAP ROM SHADOW CTRL 0xF8007028: 0xFFFFFFFF
PCAP MBOOT 0xF800702C: 0x0000C000
PCAP SW ID 0xF8007030: 0x00000000
PCAP UNLOCK 0xF8007034: 0x757BDF0D
PCAP MCTRL 0xF8007080: 0x30800100

DMA Done !
...................................................................................................PCAP transfer timed out
PCAP_FPGA_DONE_FAIL
PCAP Bitstream Download Failed
PARTITION_MOVE_FAIL
FSBL Status = 0xA00B

Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]