July 2, 2024

Antminer S9 board - running Bootgen 7-2024

I have built both the fsbl and uboot from source. The game now is to pack them up into a BOOT.BIN image, put them onto an SD card, and see what happens.
I used this for "boot.bif"
all :
{
        [bootloader]fsbl.elf
        u-boot.elf
}
Then ran this command:
bootgen -arch zynq -image boot.bif -o boot.bin

I put it onto an SD card and it does not work. I am having some stupid problem with picocom and my USB to serial adapter -- it exists picocom every time I cycle power, so I miss vital output right as the board comes out of reset.

This may be a picocom bug. I installed screen, tio, and minicom and will now give them all a try. Screen does the same thing.

screen /dev/ttyUSB0 115200
tio -b 115200 /dev/ttyUSB0
tio is nicest. It gives me the following. I get a Disconnected message, but it sticks around and gives me the Connected message.
[18:13:43.773] tio v3.4
[18:13:43.773] Press ctrl-t q to quit
[18:13:43.777] Connected to /dev/ttyUSB0
-- some junk here
[18:13:52.834] Disconnected
[18:13:53.839] Connected to /dev/ttyUSB0
So, we are getting no console messages from the FSBL, which is our first concern. Whether or not U-boot has been loaded is anyones guess. We also wonder (prematurely) about the dtb that U-boot will be looking for.

Try again -- 11-2024

I have a u-boot build in /u1/Projects/Zynq/u-boot-xlnx that I did back in June 18, 2024. In that directory I create zzz.bif as follows:
all :
{
        [bootloader]spl/u-boot-spl
        u-boot
}
I have a bootgen (from June 18) in /home/tom/bin, so I can type:
bootgen -arch zynq -image zzz.bif -o BOOT.BIN
****** Bootgen v2023.2
  **** Build date : Jun 18 2024-13:05:41
    ** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.
    ** Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.
[INFO]   : Bootimage generated successfully
I have a 32G micro SD card that I partitioned and created a fat32 filesystem on. I put it in a card reader, let linux mount it and do this:
cp BOOT.BIN /run/media/tom/1936-F32A
sync
I put the card into a known good Antminer S9 with jumpers set to boot from SD and apply power. It does not work. I get absolutely nothing on the console. I see the green power LED on, but that is all.

I examine the file u-boot.cfg and see:

#define 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"
Somewhere I have notes about how I did this build. What I am wondering about is whether the proper serial port is being used. My notes on the Antminer show that we have ports 0 and 1, and the Antminer uses 1 (the second one).

I look at the Zedboard schematic and the Antminer schematic. Both show the UART coming from MIO pins 48 and 49. Page 52 of the Zynq TRM has the famous "MIO at a glance" diagram. It shows that pins 48 and 49 can only be UART-1, not UART-0.

So, I don't think that my theory of having the wrong UART explains things.

So, this is frustrating and not at all what I expected. I suppose that people would tell me, "why are you doing this, why don't you just use Vitis and accept the big black box that works". Or something like that.

Closing comments

Bootgen can be used to "dump" an existing BOOT.BIN --
bootgen -read BOOT.bin
****** Bootgen v2023.2
  **** Build date : Jun 18 2024-13:05:41
    ** Copyright 1986-2022 Xilinx, Inc. All Rights Reserved.
    ** Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.

--------------------------------------------------------------------------------
   BOOT HEADER
--------------------------------------------------------------------------------
        boot_vectors (0x00) : 0xeafffffeeafffffeeafffffeeafffffeeafffffeeafffffeeafffffeeafffffe
     width_detection (0x20) : 0xaa995566
            image_id (0x24) : 0x584c4e58
 encryption_keystore (0x28) : 0x00000000
      header_version (0x2c) : 0x01010000
   fsbl_sourceoffset (0x30) : 0x00001700
         fsbl_length (0x34) : 0x0001c014
   fsbl_load_address (0x38) : 0x00000000
   fsbl_exec_address (0x3C) : 0x00000000
   fsbl_total_length (0x40) : 0x0001c014
    qspi_config-word (0x44) : 0x00000001
            checksum (0x48) : 0xfc15c518
          iht_offset (0x98) : 0x000008c0
          pht_offset (0x9c) : 0x00000c80
--------------------------------------------------------------------------------
   IMAGE HEADER TABLE
--------------------------------------------------------------------------------
             version (0x00) : 0x01020000        total_images (0x04) : 0x00000003
          pht_offset (0x08) : 0x00000c80           ih_offset (0x0c) : 0x00000900
       hdr_ac_offset (0x10) : 0x00000000
--------------------------------------------------------------------------------
   IMAGE HEADER (Zynq7010_BTC.elf)
--------------------------------------------------------------------------------
          next_ih(W) (0x00) : 0x00000250
         next_pht(W) (0x04) : 0x00000320
    total_partitions (0x0c) : 0x00000001
                name (0x10) : Zynq7010_BTC.elf
--------------------------------------------------------------------------------
   IMAGE HEADER (bm_btccv_fpga.bit)
--------------------------------------------------------------------------------
          next_ih(W) (0x00) : 0x00000260
         next_pht(W) (0x04) : 0x00000330
    total_partitions (0x0c) : 0x00000001
                name (0x10) : bm_btccv_fpga.bit
--------------------------------------------------------------------------------
   IMAGE HEADER (u-boot.elf)
--------------------------------------------------------------------------------
          next_ih(W) (0x00) : 0x00000000
         next_pht(W) (0x04) : 0x00000340
    total_partitions (0x0c) : 0x00000001
                name (0x10) : u-boot.elf
--------------------------------------------------------------------------------
   PARTITION HEADER TABLE (Zynq7010_BTC.elf.0)
--------------------------------------------------------------------------------
    encrypted_length (0x00) : 0x00007005  unencrypted_length (0x04) : 0x00007005
        total_length (0x08) : 0x00007005           load_addr (0x0c) : 0x00000000
           exec_addr (0x10) : 0x00000000    partition_offset (0x14) : 0x000005c0
          attributes (0x18) : 0x00000010       section_count (0x1C) : 0x00000001
     checksum_offset (0x20) : 0x00000000          iht_offset (0x24) : 0x00000240
           ac_offset (0x28) : 0x00000000            checksum (0x3c) : 0xfffea7df
 attribute list -
               trustzone [non-secure]            el [el-0]
              exec_state [aarch-32]     dest_device [none]
              encryption [no]                  core [none]
--------------------------------------------------------------------------------
   PARTITION HEADER TABLE (bm_btccv_fpga.bit.0)
--------------------------------------------------------------------------------
    encrypted_length (0x00) : 0x0007f2e8  unencrypted_length (0x04) : 0x0007f2e8
        total_length (0x08) : 0x0007f2e8           load_addr (0x0c) : 0x00000000
           exec_addr (0x10) : 0x00000000    partition_offset (0x14) : 0x000075d0
          attributes (0x18) : 0x00000020       section_count (0x1C) : 0x00000001
     checksum_offset (0x20) : 0x00000000          iht_offset (0x24) : 0x00000250
           ac_offset (0x28) : 0x00000000            checksum (0x3c) : 0xffe7af06
 attribute list -
               trustzone [non-secure]            el [el-0]
              exec_state [el-0]         dest_device [none]
              encryption [no]                  core [none]
--------------------------------------------------------------------------------
   PARTITION HEADER TABLE (u-boot.elf.0)
--------------------------------------------------------------------------------
    encrypted_length (0x00) : 0x00015b20  unencrypted_length (0x04) : 0x00015b20
        total_length (0x08) : 0x00015b20           load_addr (0x0c) : 0x04000000
           exec_addr (0x10) : 0x04000000    partition_offset (0x14) : 0x000868c0
          attributes (0x18) : 0x00000010       section_count (0x1C) : 0x00000001
     checksum_offset (0x20) : 0x00000000          iht_offset (0x24) : 0x00000260
           ac_offset (0x28) : 0x00000000            checksum (0x3c) : 0xf7f3836e
 attribute list -
               trustzone [non-secure]            el [el-0]
              exec_state [aarch-32]     dest_device [none]
              encryption [no]                  core [none]
--------------------------------------------------------------------------------

Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]