Post Go back to editing

Bad FIT image format and MSD mounting errors in firmware built for Sidekiq Z2

Category: Software
Product Number: SidekiqZ2
Software Version: tag: v0.34

Hello everyone,

The setup:

I'm building the firmware for the Sidekiq Z2 using the ADI's plutosdr-fw repo. I'm working with the commit a1c2ce7 which is 5 commits ahead the v0.34 tag. In order to build it, I'm using the following commands:

export CROSS_COMPILE=arm-linux-gnueabihf-
export PATH=$PATH:/opt/Xilinx/SDK/2019.1/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin
export VIVADO_SETTINGS=/opt/Xilinx/Vivado/2019.1/settings64.sh
make TARGET=sidekiqz2

The build process runs smoothly, and I've not changed any functionality (in consecuence, the repo is as cloned) except from the line 119 of the makefile for:  

make -C buildroot ARCH=arm zynq_$(TARGET)_vivado_2019_1_defconfig

As the 2019.1 Vivado version is what I use and have installed.

I've used the built firmware .dfu files for many weeks now, but I realized that something was wrong last week when I needed to access the 'config.txt' file in one of the boards that had the home-built firmware loaded and the file didn't exist.

The problem:

I am trying to solve the message "Bad FIT image format!" appearing when booting a Sidekiq Z2 with the firmware built by me. The boot logs are obtained by connecting the serial console and reseting the boards.

What strikes me as extremely odd, is that almost everything works, except for some specific features like the mounting of the filesystem for the USB drive (line 106 from the boot log attached), which prevents me from seeing the 'config.txt' file, necessary for my application. That is why I been using the custom builds for a while now without realizing about this error. It is worth mentioning that the FPGA transiever funcionality and most of the OS work fine, I've been ssh'ing to the board connected via USB whenever the OS was already up (obviously) and that is also the reason I've never got to see the "bad FIT image file format" message.

Also, the config.txt file exists and I can access it in /opt/config.txt, so I infer that the S40network script is working just fine.

I've also gone through the .dts files and various configuration files. Although I'm not an embedded linux building expert, I've some experience, but I can not see anything that stands out as strange.  If you need the built firmware (.frm, .dfu) I'd be happy to give it to you.

I am really lost in this one, specially for this weird not-copmpletely-broken behaviour, so any help would be appreciated.

Below, I'm attaching the boot logs for both cases. Whenever I try to run S45msd inside the Linux, it just prints the same error messages that prints when booting.

Default firmware:

U-Boot PlutoSDR v0.20-PlutoSDR-00053-g89d07540f9 (Jan 23 2019 - 12:37:40 -0600), Build: jenkins-Sidekiq-sidekiq-z2-bsp-adi-2

I2C:   ready
DRAM:  ECC disabled 512 MiB
SF: Detected N25Q1024A with page size 256 Bytes, erase size 4 KiB, total 128 MiB
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Zynq Sidekiq Z2 Board
Hit any key to stop autoboot:  0 
200
gpio: pin 48 (gpio 48) value is 1
Booting from QSPI
Booting silently
SF: Detected N25Q1024A with page size 256 Bytes, erase size 4 KiB, total 128 MiB
device 0 offset 0x200000, size 0x9526b7
SF: 9774775 bytes @ 0x200000 Read: OK

## Checking Image at 02080000 ...
   FIT image found
   FIT description: Configuration to load fpga before Kernel
    Image 0 (fdt@1)
     Description:  zynq-sidekiqz2
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x020800f4
     Data Size:    20446 Bytes = 20 KiB
     Architecture: ARM
    Image 1 (fdt@2)
     Description:  zynq-sidekiqz2-revb
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x02085148
     Data Size:    20446 Bytes = 20 KiB
     Architecture: ARM
    Image 2 (fdt@3)
     Description:  zynq-sidekiqz2-revc
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x0208a19c
     Data Size:    20446 Bytes = 20 KiB
     Architecture: ARM
    Image 3 (fpga@1)
     Description:  FPGA
     Type:         FPGA Image
     Compression:  uncompressed
     Data Start:   0x0208f1e4
     Data Size:    963140 Bytes = 940.6 KiB
     Load Address: 0x0f000000
     Hash algo:    md5
     Hash value:   3bb49eefc2d7f579911746a0f11c0694
    Image 4 (linux_kernel@1)
     Description:  Linux
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x0217a4e4
     Data Size:    3459288 Bytes = 3.3 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x00008000
     Entry Point:  0x00008000
     Hash algo:    md5
     Hash value:   31a3cb4322675a2e3ae7601474d830ee
    Image 5 (ramdisk@1)
     Description:  Ramdisk
     Type:         RAMDisk Image
     Compression:  gzip compressed
     Data Start:   0x024c6e98
     Data Size:    5287151 Bytes = 5 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: unavailable
     Entry Point:  unavailable
     Hash algo:    md5
     Hash value:   d0b4b27afe5e107f6a0fc0b3dc9031f7
    Default Configuration: 'config@0'
    Configuration 0 (config@0)
     Description:  Linux with fpga RevA
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@1
     FPGA:         fpga@1
    Configuration 1 (config@1)
     Description:  Linux with fpga RevB
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@2
     FPGA:         fpga@1
    Configuration 2 (config@2)
     Description:  Linux with fpga RevB
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@2
     FPGA:         fpga@1
    Configuration 3 (config@3)
     Description:  Linux with fpga RevB
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@2
     FPGA:         fpga@1
    Configuration 4 (config@4)
     Description:  Linux with fpga RevB
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@2
     FPGA:         fpga@1
    Configuration 5 (config@5)
     Description:  Linux with fpga RevB
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@2
     FPGA:         fpga@1
    Configuration 6 (config@6)
     Description:  Linux with fpga RevB
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@2
     FPGA:         fpga@1
    Configuration 7 (config@7)
     Description:  Linux with fpga RevB
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@2
     FPGA:         fpga@1
    Configuration 8 (config@8)
     Description:  Linux with fpga RevC
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@3
     FPGA:         fpga@1
    Configuration 9 (config@9)
     Description:  Linux with fpga RevB
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@2
     FPGA:         fpga@1
    Configuration 10 (config@10)
     Description:  Linux with fpga RevB
     Kernel:       linux_kernel@1
     Init Ramdisk: ramdisk@1
     FDT:          fdt@2
     FPGA:         fpga@1
## Checking hash(es) for FIT Image at 02080000 ...
   Hash(es) for Image 0 (fdt@1): 
   Hash(es) for Image 1 (fdt@2): 
   Hash(es) for Image 2 (fdt@3): 
   Hash(es) for Image 3 (fpga@1): md5+ 
   Hash(es) for Image 4 (linux_kernel@1): md5+ 
   Hash(es) for Image 5 (ramdisk@1): md5+ 
## Loading kernel from FIT Image at 02080000 ...
   Using 'config@2' configuration
   Verifying Hash Integrity ... OK
   Trying 'linux_kernel@1' kernel subimage
     Description:  Linux
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x0217a4e4
     Data Size:    3459288 Bytes = 3.3 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x00008000
     Entry Point:  0x00008000
     Hash algo:    md5
     Hash value:   31a3cb4322675a2e3ae7601474d830ee
   Verifying Hash Integrity ... md5+ OK
## Loading ramdisk from FIT Image at 02080000 ...
   Using 'config@2' configuration
   Trying 'ramdisk@1' ramdisk subimage
     Description:  Ramdisk
     Type:         RAMDisk Image
     Compression:  gzip compressed
     Data Start:   0x024c6e98
     Data Size:    5287151 Bytes = 5 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: unavailable
     Entry Point:  unavailable
     Hash algo:    md5
     Hash value:   d0b4b27afe5e107f6a0fc0b3dc9031f7
   Verifying Hash Integrity ... md5+ OK
## Loading fdt from FIT Image at 02080000 ...
   Using 'config@2' configuration
   Trying 'fdt@2' fdt subimage
     Description:  zynq-sidekiqz2-revb
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x02085148
     Data Size:    20446 Bytes = 20 KiB
     Architecture: ARM
   Verifying Hash Integrity ... OK
   Booting using the fdt blob at 0x2085148
## Loading fpga from FIT Image at 02080000 ...
   Trying 'fpga@1' fpga subimage
     Description:  FPGA
     Type:         FPGA Image
     Compression:  uncompressed
     Data Start:   0x0208f1e4
     Data Size:    963140 Bytes = 940.6 KiB
     Load Address: 0x0f000000
     Hash algo:    md5
     Hash value:   3bb49eefc2d7f579911746a0f11c0694
   Verifying Hash Integrity ... md5+ OK
   Loading fpga from 0x0208f1e4 to 0x0f000000
  design filename = "system_top;UserID=0XFFFFFFFF;COMPRESS=TRUE;Version=2018.2"
  part number = "7z010clg225"
  date = "2019/01/23"
  time = "12:36:37"
  bytes in bitstream = 963020
zynq_align_dma_buffer: Align buffer at f000078 to f000000(swap 1)
   Programming full bitstream... OK
   Loading Kernel Image ... OK
   Loading Ramdisk to 1e61e000, end 1eb28cef ... OK
   Loading Device Tree to 1e616000, end 1e61dfdd ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Starting logging: OK
Starting mdev: OK
Starting watchdog: OK
Starting initializing random number generator: OK
Starting miscellaneous setup: OK
Starting UDC Gadgets: OK
Starting system message bus: done
Starting network: OK
Starting dhcpd Daemon & httpd Server: OK
Starting MSD Daemon: OK
Starting dropbear sshd: OK
Starting input-event-daemon: done

Welcome to Sidekiq Z2
sidekiqz2 login: 

Custom-built firmware:

U-Boot PlutoSDR v0.20-PlutoSDR-00065-ga2c2013a86 (Jul 27 2023 - 12:49:44 -0300)

I2C:   ready
DRAM:  ECC disabled 512 MiB
SF: Detected N25Q1024A with page size 256 Bytes, erase size 4 KiB, total 128 MiB
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000
Model: Zynq Sidekiq Z2 Board
Hit any key to stop autoboot:  0 
205
gpio: pin 48 (gpio 48) value is 1
Booting from QSPI
Booting silently
SF: Detected N25Q1024A with page size 256 Bytes, erase size 4 KiB, total 128 MiB
device 0 offset 0x200000, size 0x900000
SF: 9437184 bytes @ 0x200000 Read: OK

## Checking Image at 02080000 ...
   FIT image found
Bad FIT image format!
device 0 offset 0x200000, size 0x1e00000
SF: 31457280 bytes @ 0x200000 Read: OK
## Loading kernel from FIT Image at 02080000 ...
   Using 'config@2' configuration
   Verifying Hash Integrity ... OK
   Trying 'linux_kernel@1' kernel subimage
     Description:  Linux
     Type:         Kernel Image
     Compression:  uncompressed
     Data Start:   0x0228d6fc
     Data Size:    3933080 Bytes = 3.8 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x00008000
     Entry Point:  0x00008000
     Hash algo:    md5
     Hash value:   929d87a26671fe4c5a1d0e9262626608
   Verifying Hash Integrity ... md5+ OK
## Loading ramdisk from FIT Image at 02080000 ...
   Using 'config@2' configuration
   Trying 'ramdisk@1' ramdisk subimage
     Description:  Ramdisk
     Type:         RAMDisk Image
     Compression:  gzip compressed
     Data Start:   0x0264db70
     Data Size:    18049519 Bytes = 17.2 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: unavailable
     Entry Point:  unavailable
     Hash algo:    md5
     Hash value:   7ef612ea8d9a482e3881352716938027
   Verifying Hash Integrity ... md5+ OK
## Loading fdt from FIT Image at 02080000 ...
   Using 'config@2' configuration
   Trying 'fdt@2' fdt subimage
     Description:  zynq-sidekiqz2-revb
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x02085964
     Data Size:    22523 Bytes = 22 KiB
     Architecture: ARM
   Verifying Hash Integrity ... OK
   Booting using the fdt blob at 0x2085964
## Loading fpga from FIT Image at 02080000 ...
   Trying 'fpga@1' fpga subimage
     Description:  FPGA
     Type:         FPGA Image
     Compression:  uncompressed
     Data Start:   0x02090a38
     Data Size:    2083846 Bytes = 2 MiB
     Load Address: 0x0f000000
     Hash algo:    md5
     Hash value:   b6a4a5eb709912af7a55ad5af52ffd53
   Verifying Hash Integrity ... md5+ OK
   Loading fpga from 0x02090a38 to 0x0f000000
  design filename = "system_top;UserID=0XFFFFFFFF;Version=2019.1"
  part number = "7z010clg225"
  date = "2022/11/09"
  time = "14:36:16"
  bytes in bitstream = 2083740
zynq_align_dma_buffer: Align buffer at f00006a to f000000(swap 1)
   Programming full bitstream... OK
   Loading Kernel Image ... OK
   Loading Ramdisk to 1d9f3000, end 1eb299ef ... OK
   Loading Device Tree to 1d9ea000, end 1d9f27fa ... OK

Starting kernel ...

gpio gpiochip0: (zynq_gpio): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
gpio gpiochip0: (zynq_gpio): unable to lock HW IRQ 14 for IRQ
genirq: Failed to request resources for Button (irq 57) on irqchip zynq-gpio
gpio-keys gpio_keys: Unable to claim irq 57; error -5
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Starting mdev: OK
Starting watchdog: OK
Starting initializing random number generator: OK
Starting miscellaneous setup: OK
Starting UDC Gadgets: OK
Starting system message bus: done
Starting network: OK
Starting dhcpd Daemon & httpd Server: OK
Starting MSD Daemon: mount: mounting /dev/loop7 on /mnt/msd failed: No such file or directory
md5sum: can't open '/mnt/msd/config.txt': Not a directory
cp: can't stat '/mnt/msd/img': Not a directory
cp: can't stat '/mnt/msd/index.html': Not a directory
mv: can't stat '/mnt/msd/info.html': Not a directory
umount: can't unmount /mnt/msd: Invalid argument
OK
Starting dropbear sshd: OK
Starting input-event-daemon: input-event-daemon: open(/dev/input/event0): No such file or directory
done

Welcome to Sidekiq Z2
sidekiqz2 login: 

Thanks in advance.



I'm adding a more descriptive title.
[edited by: zoqueton99 at 4:57 PM (GMT -4) on 15 Aug 2023]
Parents
  • I am trying to solve the message "Bad FIT image format!" appearing when booting a Sidekiq Z2 with the firmware built by me. The boot logs are obtained by connecting the serial console and reseting the boards.

    These two things are unrelated.

    The Bad FIT image format, comes from the fact that the fit_size uboot variable is not set correctly.

    In this case the u-boot script will do a SF read of the entire SPI flash to the end.

    In case this wouldn't work you would not boot into Linux.

    Regarding the msd issue, I would start debugging here:

    https://github.com/analogdevicesinc/buildroot/blob/master/board/pluto/post-build.sh#L39

    The original vfat image is created on the build host. Maybe it's not working on your end?

    -Michael

  • Thanks for your response Michael,

    These two things are unrelated.

    This will help me target the issues separately.

    The Bad FIT image format, comes from the fact that the fit_size uboot variable is not set correctly.

    I see. This leads to another question that is: why could this be happening?

    I see that the u-boot default enviroment declares fit_size as 0x900000 in 'u-boot-xlnx/include/configs/zynq_zc70x_sidekiqz2.h'.  From my understanding this number should be alright or automatically updated.

    I've some reference firmware that works correctly and I've compared the FIT files with hexdumps and strings and at least the uboot-env.dfu is identical (the fit_size is set as default as 0x900000).

    What I couldn't do is find out where the fit_size is set to the correct value in the u-boot environment.

    Should I look for something else? Should I change the value manually? (The second one I don't think)

    The original vfat image is created on the build host. Maybe it's not working on your end?

    I'll take a look and ask here again if I reach a dead end.

    This is beyond helpful, thanks again.

Reply
  • Thanks for your response Michael,

    These two things are unrelated.

    This will help me target the issues separately.

    The Bad FIT image format, comes from the fact that the fit_size uboot variable is not set correctly.

    I see. This leads to another question that is: why could this be happening?

    I see that the u-boot default enviroment declares fit_size as 0x900000 in 'u-boot-xlnx/include/configs/zynq_zc70x_sidekiqz2.h'.  From my understanding this number should be alright or automatically updated.

    I've some reference firmware that works correctly and I've compared the FIT files with hexdumps and strings and at least the uboot-env.dfu is identical (the fit_size is set as default as 0x900000).

    What I couldn't do is find out where the fit_size is set to the correct value in the u-boot environment.

    Should I look for something else? Should I change the value manually? (The second one I don't think)

    The original vfat image is created on the build host. Maybe it's not working on your end?

    I'll take a look and ask here again if I reach a dead end.

    This is beyond helpful, thanks again.

Children