June 17, 2024

Antminer S9 board - Build U-boot from source

There may be more than one place to start. I chose this: And I did:
cd /u1/Projects/Zynq
git clone https://github.com/Xilinx/u-boot-xlnx.git
This produced "u-boot-xlnx" as a working directory on my linux system.

How do we build it?

I have been down this road before with U-boot, but it has been several years. The first thing is to look in the configs directory and select a config file. There are a number of xilinx_zynq* files, but the only one that looks close is:
xilinx_zynq_virt_defconfig
It contains a suggestive line:
CONFIG_OF_LIST="zynq-zc702 zynq-zc706 zynq-zc770-xm010 zynq-zc770-xm011 zynq-zc770-xm011-x16 zynq-zc770-xm012
zynq-zc770-xm013 zynq-cc108 zynq-microzed zynq-minized zynq-picozed
zynq-zed zynq-zturn zynq-zturn-v5 zynq-zybo zynq-zybo-z7 zynq-dlc20-rev1.0"
Around 2020 they merged a bunch of different defconfig files together into this one. Different boards are differentiated by their device trees. Look at arch/arm/dts ...
zynq-picozed.dts
zynq-zc702.dts
zynq-zed.dts
zynq-zybo.dts
zynq-zybo-z7.dts
...
Some things to check are whether the console is set up on uart0 or uart1 and if there is support for the fsbl on nand. It may be necessary to copy one of these files and make a specific dts (device tree) for the Antminer.

Just build it

We will learn a lot just by getting in motion. The first stop is the Makefile. This is "the mother of all Makefiles" at 2489 lines and growing every day. We don't need to tangle with the whole thing. The first steps are the same for any target:
make distclean
make xilinx_zynq_virt_defconfig
After this we need to choose a device tree and then build. Just for fun, I will chose the zybo rather than "zed".
export DEVICE_TREE="zynq-zybo"
make

Trouble with mkeficapsule

This is in the tools directory. We don't need it. It won't build right and the best thing to do is just to skip building it altogether, which can be done by editting the file "tools/Makefile" and commenting out this line:
# hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += mkeficapsule
If you care (and I don't know why you would), you can read about my struggles here:

The build finishes

After getting mkeficapsule out of our hair, the build moves right along. It finishes with the following lines displayed:
  LD      spl/u-boot-spl
  OBJCOPY spl/u-boot-spl-nodtb.bin
mkdir -p spl/dts/
  FDTGREP spl/dts/dt-spl.dtb
  COPY    spl/u-boot-spl.dtb
  CAT     spl/u-boot-spl-dtb.bin
  COPY    spl/u-boot-spl.bin
  SYM     spl/u-boot-spl.sym
  MKIMAGE spl/boot.bin
  MKIMAGE u-boot.img
  COPY    u-boot.dtb
  MKIMAGE u-boot-dtb.img
  LDS     u-boot-elf.lds
  LD      u-boot.elf
  OFCHK   .config

Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]