January 21, 2025

Antminer S9 board - U-boot - plan B watchdog

I look at the defconfig and find:
CONFIG_WDT=y
CONFIG_WDT_CDNS=y
This looks like a watchdog to me, so I comment them out. While I am at it, I play with the prompt.
CONFIG_SYS_PROMPT="antminer (kyu)> "
Making these take effect will involve "make defconfig" which will probably overwrite my environment hacking, so I make a backup file for that. I skip the "make distclean" and just do:
make zztom_antminer_s9_defconfig
#
# configuration written to .config
#
Now I edit the config_distro_bootcmd.h and change the bootaddr to 0x10000000. This will require me to relink Kyu, but will allow me to test TFTP at that address. And then we run "make". It skips the stuff in tools saving some time and avoids a bunch of warnings flying past.

This build does work. It does the tftp boot and is happy to load to 0x10000000. Kyu does not run when loaded there of course, but there is no fault or complaint, just silence. My new prompt is there:

antminer (kyu)>
I am now happily waiting to see if the watchdog has been done away with. And yes, it seems to have been! Nice.
Not a bad idea mind you for a production board. Let it reset and boot over and over until it has success. Something to consider. Someday. Maybe.

Get brave

Let's revisit this ENV in FAT business. I search for that in configs, hoping to copy the setup for some other board. For no particular reason, I pick iot_devkit_defconfig and see:
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
#CONFIG_CMD_FAT=y
#CONFIG_CMD_MMC=y
#?#CONFIG_MMC=y
In the above, I comment out the two CMD things that I already have and decide that I probably don't need the last command, but I copy the first 3 to my defconfig and comment out the NAND line like so:
#CONFIG_ENV_IS_IN_NAND=y
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
I redo the build as follows:
make zztom_antminer_s9_defconfig
make
It goes very fast.
It doesn't ask me any questions about anything.

It boots up just fine, and look at this:

Hit any key to stop autoboot:  0
antminer (kyu)> saveenv
Saving Environment to FAT... OK
antminer (kyu)>
I pull the SD card and put it back into the card reader and I see:
-rw-r--r-- 1 tom tom  53180 Jan 21 22:44 BOOT.BIN
-rw-r--r-- 1 tom tom 131072 Dec 31  1979 uboot.env
-rw-r--r-- 1 tom tom 480589 Jan 21 22:44 u-boot.img
So there we go!! It saved the env settings to uboot.env!!! This file is just a binary dump, not some tidy thing you could edit with a text editor, but this is perfect and something I have wished for for about 2 years when my broken U-boot was writing them to NAND in some place it shouldn't have been.

I might make this my official SD card image for use with Kyu. I'll have to change the Kyu link address, which is easy enough to do, and if I get new ideas about that, I don't have to rebuild U-boot now, I can just change the value and do saveenv.

Time to call it a day. The full set of boot messages now looks like this. Notice that it reads the environment from FAT. Apparently it looks for uboot.env, doesn't mind not finding it, but uses it if it is there.

U-Boot SPL 2020.04 (Jan 21 2025 - 22:42:17 -0700)
mmc boot
Trying to boot from MMC1

U-Boot 2020.04 (Jan 21 2025 - 22:42:17 -0700)

Model: Bitmain Antminer S9 Board
DRAM:  ECC disabled 512 MiB
NAND:  0 MiB
MMC:   mmc@e0100000: 0
Loading Environment from FAT... OK
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Net:   ZYNQ GEM: e000b000, phyaddr 1, interface rgmii-id

Warning: ethernet@e000b000 (eth0) using random MAC address - 4a:d3:c5:9c:ed:ca
eth0: ethernet@e000b000
Hit any key to stop autoboot:  0
Booting Kyu via tftp
ethernet@e000b000 Waiting for PHY auto negotiation to complete.. done
Using ethernet@e000b000 device
TFTP from server 192.168.0.5; our IP address is 192.168.0.144
Filename 'bitcoin.bin'.
Load address: 0x10000000
Loading: ####################
	 6.8 MiB/s
done
Bytes transferred = 290456 (46e98 hex)
## Starting application at 0x10000000 ...

Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org