cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
1,233 Views
Registered: ‎05-12-2020

Unable to boot from QSPI using Petalinux 2020.1 (Upgrading from Petalinux 2019.2)

Jump to solution

Hello -

I've tried to upgrade my Petalinux 2019.2 to the newest Petalinux release that is 2020.1 to generate BOOT.BIN and image.ub to boot from QSPI but unfortunatly with Petalinux 2020.1 it failed to boot from QSPI, here are the steps I used with Petalinux 2019.2 which worked and same steps failed on Petalinux 2020.1

[ cd/Petalinux ]   // Petalinux 2020.1 root directory 

[ source settings.sh ]  // configure the terminal environment

[ petalinux-create -t project -n myLinux --template zynqMP ]  // we using ZYNQ Ultrascale+

[ cd /myLinux ] // Now I'm in the new Petalinux project

[ Petalinux-config --get-hw-description ../ ] // Configure the flash and some other minor configurations but here we mainly focus on the flash configuration

Primary Flash (psu_qspi_0) ---> 
[ ] Advanced Flash Auto Configuration
 *** partition 0 ***
 (boot) name
(0x2000000) size
*** partition 1 ***
 (bootenv) name
 (0x80000) size
*** partition 2 ***
(kernel) name
 (0x2000000) size
 *** partition 3 ***
 () name

[ Petalinux-build ]  // Build the project

[ petalinux-package --boot --fsbl --fpga --pmufw --u-boot --force ]  // Generate BOOT.BIN

Then proceed to write the BOOT.BIN in QSPI address 0x0 and image.bin in address 0x2080000 using Lab Edition.

 

With Petalinux 2019.2 it successfully boots and here are the first lines of the UART message during the boot stage:

SF: Detected n25q1024a with page size 256 Bytes, erase size 64 KiB, total 128 MiB
device 0 offset 0x2080000, size 0x2000000
SF: 33554432 bytes @ 0x2080000 Read: OK
## Loading kernel from FIT Image at 10000000 ...
Using 'conf@system-top.dtb' configuration
Trying 'kernel@1' kernel subimage
Description: Linux kernel
Type: Kernel Image

With Petalinux 2020.1 it fails to boots and here are the first lines of the UART message during the boot stage:

SF: Detected n25q00a with page size 256 Bytes, erase size 64 KiB, total 128 MiB
device 0 offset 0x3e80000, size 0x80000
SF: 524288 bytes @ 0x3e80000 Read: OK
## Executing script at 20000000
Wrong image format for "source" command
SCRIPT FAILED: continuing...

 

furthermore, I noticed that it tries to pick the kernel image from 0x3e80000 with a size of 0x80000, and this is not what I configure in the Petalinux-config stage. Further investigation, I noticed that the u-boot autoconfig feature is deprecated. Hence, I turned it off and proceed to configure u-boot using [ Petalinux-config -c u-boot ]  [ ARM architecture --> Boot script offset set to 0x2080000 ] and tried booting the QSPI again; here are the UART messages:


SF: Detected n25q00a with page size 256 Bytes, erase size 64 KiB, total 128 MiB
device 0 offset 0x2080000, size 0x80000
SF: 524288 bytes @ 0x2080000 Read: OK
## Executing script at 20000000
Bad FIT image format
SCRIPT FAILED: continuing...

Can someone please explain to me what I am doing wrong here? Moreover, I couldn't find a way to change the boot script size in the u-boot configuration; how do I change it?

I attached some of the u-boot files that located in /Petalinux/myLinux/project-spec/meta-user/recipes-bsp/u-boot/

 

Thank you 

-Matthew
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Visitor
Visitor
1,094 Views
Registered: ‎05-12-2020

Below are the steps I took to solve this issue thanks to @patocarr 

  • [ cd/Petalinux ]   // Petalinux 2020.1 root directory 
  • [ source settings.sh ]  // configure the terminal environment
  • [ petalinux-create -t project -n myLinux --template zynqMP ]  // we using ZYNQ Ultrascale+
  • [ cd /myLinux ] // Now I'm in the new Petalinux project
  • [ Petalinux-config --get-hw-description ../ ] // Configure the flash and some other configurations if needed
  • Add new partition in flash configuration for the boot script.

#
# partition 0
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART0_NAME="boot"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART0_SIZE=0x1000000

#
# partition 1
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART1_NAME="bootenv"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART1_SIZE=0x80000

#
# partition 2
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART2_NAME="kernel"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART2_SIZE=0x2000000

#
# partition 3
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART3_NAME="bootscr"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART3_SIZE=0x8000

  • changed the boot script offset inside u-boot configuration to 0x3080000 [ petalinux-config -c u-boot ] [ ARM architecture --> Boot script offset set to 0x3080000 ]
  • open the file located in /project-spec/meta-user/recipes-bsp/u-boot/u-boot-zynq-scr.bbappend and change the following:
    • QSPI_KERNEL_OFFSET to 0x1080000
    • QSPI_FIT_IMAGE_SIZE to 0x2000000  //size of my kernel partition
    • QSPI_KERNEL_OFFSET_versal to 0x1080000   //Needed?
  • build the project [ petalinux-build -c u-boot ] and then again [ petalinux-build ]
  • package the boot.bin [ petalinux-package --boot --fsbl --fpga --pmufw --u-boot --force ]
  • {BOOT.BIN size is 13.6MB} {image.ub renamed to image.bin and size is 16.4MB} {boot.scr renamed to bootscr.bin size is 2KB}
  • using Vivado Lab Edition to write BOOT.BIN to offset 0x0 then image.bin to offset 0x1080000 and finally bootscr.bin to offset 0x3080000

 

hope that helps.

-Matthew

View solution in original post

6 Replies
Highlighted
Advisor
Advisor
1,183 Views
Registered: ‎01-28-2008

Hi @Mathieeo 

  The U-Boot 2020.1 version uses a different approach called "distro boot" where it loads a "boot.scr" script that is sourced and contains instructions regarding where to load the next stage, i.e. the kernel.

  In the default configuration, this script is expected to be at 0x3e80000, so your QSPI programming is expected to burn it there. This file is generated under ./images/linux along with other binaries. You've correctly changed the boot.scr script offset to 0x2080000, so that's where U-Boot will expect it (and not the kernel). You may need to define a new partition where to burn the boot.scr in your QSPI layout.

  Once U-Boot runs (i.e. sources) the boot.scr, it will contain instructions where to pick up the kernel next, which should be defined in the boot.cmd.default, which hopefully the Petalinux tools modified based on the petalinux-config command.

 

Hope that helps.

Thanks,

-Pat

 

 

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

Highlighted
Visitor
Visitor
1,160 Views
Registered: ‎05-12-2020

Hello @patocarr 

Thanks, here are the steps that I performed:

  • [petalinux-config] create a new partition for bootscr right after the 'kernel' partition, my config file looks like this:

#
# Flash Settings
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_SELECT=y
# CONFIG_SUBSYSTEM_FLASH_MANUAL_SELECT is not set
# CONFIG_SUBSYSTEM_FLASH__ADVANCED_AUTOCONFIG is not set

#
# partition 0
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART0_NAME="boot"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART0_SIZE=0x1000000

#
# partition 1
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART1_NAME="bootenv"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART1_SIZE=0x80000

#
# partition 2
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART2_NAME="kernel"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART2_SIZE=0x2000000

#
# partition 3
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART3_NAME="bootscr"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART3_SIZE=0x8000

#
# partition 4
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART4_NAME=""
CONFIG_SUBSYSTEM_FLASH_IP_NAME="psu_qspi_0"

  • changed the boot script offset from u-boot configuration to 0x3080000
  • build the project [ petalinux-build -c u-boot ] and then again [ petalinux-build ]
  • package the boot.bin [ petalinux-package --boot --fsbl --fpga --pmufw --u-boot --force ]
  • {BOOT.BIN size is 13.6MB} {image.ub renamed to image.bin and size is 16.4MB} {boot.scr renamed to bootscr.bin size is 2KB}
  • using Vivado Lab Edition to write BOOT.BIN to offset 0x0 then image.bin to offset 0x1080000 and finally bootscr.bin to offset 0x3080000
  • booting the petalinux failed with the messages below:

SF: Detected n25q00a with page size 256 Bytes, erase size 64 KiB, total 128 MiB
device 0 offset 0x3080000, size 0x80000
SF: 524288 bytes @ 0x3080000 Read: OK
## Executing script at 20000000
SF: Detected n25q00a with page size 256 Bytes, erase size 64 KiB, total 128 MiB
device 0 offset 0xf00000, size 0x6400000
SF: 104857600 bytes @ 0xf00000 Read: OK
Wrong Image Format for bootm command
ERROR: can't get kernel image!
SCRIPT FAILED: continuing...
switch to partitions #0, OK

 

what did I do wrong here? Maybe I miss understood one or more steps because I'm new in this topic and I apologize.

Thank you in advance.

-Matthew
0 Kudos
Highlighted
Advisor
Advisor
1,149 Views
Registered: ‎01-28-2008

Hi @Mathieeo 

  That's progress. According to the log, U-Boot is picking up the boot.scr script at QSPI offset 0x3080000 and running it successfully. Then it tries to load the kernel from 0xF00000 and fails, because it resides at offset 0x1800000 in QSPI, from your QSPI partitioning.

  It seems that modifying the u-boot-zynq-scr.bbappend where QSPI_KERNEL_OFFSET is set should be changed to 0x1800000.

  This u-boot-zynq-scr.bbappend runs and reads the template u-boot-zynq-src/boot.cmd.default.initrd, and replaces them with a sed command, generating the boot.cmd.default in the same directory. This file will then be packaged (mkimage) by the build into boot.scr.

  In my opinion, there is a disconnect in 2020.1 regarding U-Boot and flash partitioning. As far as I can tell, these partitions need to be manually set using the u-boot-zynq-scr, as opposed to how 2019.2 did it: by transparently copying the settings in petalinux-config -> Subsystem AUTO hardware settings -> Flash Settings to the U-Boot configuration.

 

Thanks,

-Pat

 

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

Highlighted
Visitor
Visitor
1,125 Views
Registered: ‎05-12-2020

After changing the QSPI_KERNEL_OFFSET to 0x1080000 and the QSPI_FIT_IMAGE_SIZE to 0x1000000 I was able to successfully boot the Petalinux.
Thanks a lot @patocarr 

-Matthew
Highlighted
Advisor
Advisor
1,099 Views
Registered: ‎01-28-2008

Glad it worked, @Mathieeo !

 

Thanks for the update,

-Pat

 

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

Highlighted
Visitor
Visitor
1,095 Views
Registered: ‎05-12-2020

Below are the steps I took to solve this issue thanks to @patocarr 

  • [ cd/Petalinux ]   // Petalinux 2020.1 root directory 
  • [ source settings.sh ]  // configure the terminal environment
  • [ petalinux-create -t project -n myLinux --template zynqMP ]  // we using ZYNQ Ultrascale+
  • [ cd /myLinux ] // Now I'm in the new Petalinux project
  • [ Petalinux-config --get-hw-description ../ ] // Configure the flash and some other configurations if needed
  • Add new partition in flash configuration for the boot script.

#
# partition 0
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART0_NAME="boot"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART0_SIZE=0x1000000

#
# partition 1
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART1_NAME="bootenv"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART1_SIZE=0x80000

#
# partition 2
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART2_NAME="kernel"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART2_SIZE=0x2000000

#
# partition 3
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART3_NAME="bootscr"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART3_SIZE=0x8000

  • changed the boot script offset inside u-boot configuration to 0x3080000 [ petalinux-config -c u-boot ] [ ARM architecture --> Boot script offset set to 0x3080000 ]
  • open the file located in /project-spec/meta-user/recipes-bsp/u-boot/u-boot-zynq-scr.bbappend and change the following:
    • QSPI_KERNEL_OFFSET to 0x1080000
    • QSPI_FIT_IMAGE_SIZE to 0x2000000  //size of my kernel partition
    • QSPI_KERNEL_OFFSET_versal to 0x1080000   //Needed?
  • build the project [ petalinux-build -c u-boot ] and then again [ petalinux-build ]
  • package the boot.bin [ petalinux-package --boot --fsbl --fpga --pmufw --u-boot --force ]
  • {BOOT.BIN size is 13.6MB} {image.ub renamed to image.bin and size is 16.4MB} {boot.scr renamed to bootscr.bin size is 2KB}
  • using Vivado Lab Edition to write BOOT.BIN to offset 0x0 then image.bin to offset 0x1080000 and finally bootscr.bin to offset 0x3080000

 

hope that helps.

-Matthew

View solution in original post