UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Newbie fkluger
Newbie
25,806 Views
Registered: ‎05-29-2015

Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

Hello,

 

I have a TE0720 (with a Zynq 7020 SoC) that is connected to a custom (though designed/made not by myself) carrier board that does not support an SD card. JTAG, UART and USB are the only peripheral connections available at the moment. Thus, I'm trying to bring Petalinux onto the TE0720's onboard SPI flash via JTAG.

 

I followed the Petalinux Board Bringup Guide (UG980), changed all "image storage media" options from "primary sd" to "primary flash" and --- after building the system image with petalinux-build --- created a boot image with:

petalinux-package --boot --fsbl /path/to/petalinux-project/images/linux/zynq_fsbl.elf --uboot --kernel

Then I programmed the resulting BOOT.BIN file onto the TE0720's flash via JTAG with the Xilinx SDK (Xilinx Tools --> Program Flash).

When I restart the board afterwards, I get the following output on the serial console:

U-Boot 2014.07 (May 28 2015 - 11:35:44)

DRAM:  ECC disabled 1 GiB
MMC:   zynq_sdhci: 0
SF: Detected W25Q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   Gem.e000b000
U-BOOT for HelloLinux

Gem.e000b000 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Gem.e000b000: No link.
Hit any key to stop autoboot:  0 
SF: Detected W25Q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
SF: 11010048 bytes @ 0x520000 Read: OK
Wrong Image Format for bootm command
ERROR: can't get kernel image!
U-Boot-PetaLinux> 

From here on, I'm kinda lost. It seems that the kernel image is either broken or loaded from an incorrect position but I don't know why and where to start troubleshooting.

Most of the advice I found so far was targeted at people trying to boot the kernel image from an SD card, which is not an option here unfortunately.

Can anybody help me? Thanks in advance!

 

(Using Petalinux 2014.4 and Xilinx SDK/Vivado 2014.4 on CentOS 6.6 32-bit)

0 Kudos
1 Solution

Accepted Solutions
Newbie fkluger
Newbie
43,904 Views
Registered: ‎05-29-2015

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

I figured out a solution by myself:

 

The Kernel image was not read from the correct position in the QSPI flash. In order to find out which is the correct address to read from, I modified the .bif-file (./build/bootgen.bif)  that was generated by petalinux-package:

the_ROM_image:
{
	[bootloader] ./images/linux/zynq_fsbl.elf
	./images/linux/u-boot.elf
	./images/linux/image.ub
}

Then I executed:

bootgen -image newbif.bif -o test.bin -debug -w

The -debug is important here. This gave me:

[...]

*** After Link 
-- Dump of Binary cache ----
00000000 Len: 000008a0 Res: 00000000 "BootHeader"
000008c0 Len: 00000014 Res: 00000000 "ImageHeaderTable"
00000900 Len: 00000024 Res: 00000000 "ImageHeader zynq_fsbl.elf"
00000940 Len: 00000020 Res: 00000000 "ImageHeader u-boot.elf"
00000980 Len: 00000020 Res: 00000300 "ImageHeader image.ub"
00000c80 Len: 00000040 Res: 00000000 "PartitionHeader zynq_fsbl.elf.0"
00000cc0 Len: 00000040 Res: 00000000 "PartitionHeader u-boot.elf.0"
00000d00 Len: 00000040 Res: 00000000 "PartitionHeader image.ub.0"
00000d40 Len: 00000040 Res: 000009c0 "PartitionHeader Null"
00001700 Len: 0001800c Res: 00000000 "zynq_fsbl.elf.0"
00019740 Len: 00043054 Res: 00000000 "u-boot.elf.0"
0005c7c0 Len: 00691ac0 Res: 00000000 "image.ub.0"
-- End of Dump

Here we see that the Kernel image is to be found at an offset of 0x0005c7c0 and has a length of 0x00691ac0.

The image can therefore be booted in u-boot by doing:

U-Boot-PetaLinux> sf read $netstart 0005c7c0 00691ac0
SF: 6888128 bytes @ 0x5c7c0 Read: OK
U-Boot-PetaLinux> bootm $netstart 

This loads and successfully boots the kernel, finally presenting me a login prompt.

 

Hope this helps someone in the future. 

19 Replies
Newbie fkluger
Newbie
43,905 Views
Registered: ‎05-29-2015

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

I figured out a solution by myself:

 

The Kernel image was not read from the correct position in the QSPI flash. In order to find out which is the correct address to read from, I modified the .bif-file (./build/bootgen.bif)  that was generated by petalinux-package:

the_ROM_image:
{
	[bootloader] ./images/linux/zynq_fsbl.elf
	./images/linux/u-boot.elf
	./images/linux/image.ub
}

Then I executed:

bootgen -image newbif.bif -o test.bin -debug -w

The -debug is important here. This gave me:

[...]

*** After Link 
-- Dump of Binary cache ----
00000000 Len: 000008a0 Res: 00000000 "BootHeader"
000008c0 Len: 00000014 Res: 00000000 "ImageHeaderTable"
00000900 Len: 00000024 Res: 00000000 "ImageHeader zynq_fsbl.elf"
00000940 Len: 00000020 Res: 00000000 "ImageHeader u-boot.elf"
00000980 Len: 00000020 Res: 00000300 "ImageHeader image.ub"
00000c80 Len: 00000040 Res: 00000000 "PartitionHeader zynq_fsbl.elf.0"
00000cc0 Len: 00000040 Res: 00000000 "PartitionHeader u-boot.elf.0"
00000d00 Len: 00000040 Res: 00000000 "PartitionHeader image.ub.0"
00000d40 Len: 00000040 Res: 000009c0 "PartitionHeader Null"
00001700 Len: 0001800c Res: 00000000 "zynq_fsbl.elf.0"
00019740 Len: 00043054 Res: 00000000 "u-boot.elf.0"
0005c7c0 Len: 00691ac0 Res: 00000000 "image.ub.0"
-- End of Dump

Here we see that the Kernel image is to be found at an offset of 0x0005c7c0 and has a length of 0x00691ac0.

The image can therefore be booted in u-boot by doing:

U-Boot-PetaLinux> sf read $netstart 0005c7c0 00691ac0
SF: 6888128 bytes @ 0x5c7c0 Read: OK
U-Boot-PetaLinux> bootm $netstart 

This loads and successfully boots the kernel, finally presenting me a login prompt.

 

Hope this helps someone in the future. 

Observer engll
Observer
25,543 Views
Registered: ‎03-05-2015

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

Yes, it sure does! I ran into the same problem on a different board and your solution also works for me!  Thanks!

0 Kudos
Visitor hoople
Visitor
25,275 Views
Registered: ‎11-05-2014

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

Can you explain in more detail what you did for this:  "changed all "image storage media" options from "primary sd" to "primary flash""?

0 Kudos
Explorer
Explorer
25,261 Views
Registered: ‎07-17-2014

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

It's in the "petalinux-config" command that sets up the project.

 

 

0 Kudos
Explorer
Explorer
25,260 Views
Registered: ‎07-17-2014

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

to better add:

 

 

petalinux-config

 

 

then go to:

 subsystem auto hardware settings

 

then

 advanced bootable images storage settings

 

 

0 Kudos
Visitor assiro
Visitor
24,172 Views
Registered: ‎11-20-2015

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

Hi bkamen,

can you explain what better config you mean? the partitions address?

this is the menu

Cattura.JPG

 

thanks a lot

 

0 Kudos
Visitor assiro
Visitor
24,146 Views
Registered: ‎11-20-2015

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

Hi bkamen,

can you explain what better config you mean? the partitions address?

 

thankyou

0 Kudos
Explorer
Explorer
24,143 Views
Registered: ‎07-17-2014

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

I wasn't talking about address -- I was talking about changing the project from using microSD or QSPI Flash.

It sounds like you are asking a different question.

 -Ben

0 Kudos
Observer icyman
Observer
23,208 Views
Registered: ‎12-27-2015

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

At first time, when you want to make the mcs file with using petalinux-package, as below 

 

petalinux-package --force --format MCS --flash-size 256 --flash-intf SPIx4 --boot --fpga ~/project/wrapper.bit --u-boot --kernel

 

you can be faced to the error of Flash Boot Partition Size.

 

You need to change the size of the partition of the flash set in the menuconfig as below.

 

petalinux-config

Subsystem AUTO Hardware Settings --->, Flash Settings --->

 

There is partition size option.

 

 

0 Kudos
Newbie bikashbag
Newbie
15,480 Views
Registered: ‎01-21-2016

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

Hi,

 

I am new to xilinx development platform.

Can anyone please help me that how can I flash my compiled images along with rootfs to the board, the board has nand only.

0 Kudos
Adventurer
Adventurer
15,467 Views
Registered: ‎09-19-2014

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

You don't really need to do the -debug option with bootgen to tell you the partition offsets.. you can actually specify them yourself in the .bif file.

 

It's a bit of an artform getting the QSPI flash sorted. Other questions give example .bif files and give hints.

https://forums.xilinx.com/t5/Embedded-Linux/change-u-boot-on-flash-mtd-with-flashcp/td-p/344895

 

And this one is important too:

https://forums.xilinx.com/t5/Embedded-Linux/Where-does-U-Boot-saveenv-to/m-p/556802#M11041

0 Kudos
Visitor cheng6
Visitor
15,259 Views
Registered: ‎02-03-2016

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

I'm having the same problem with petalinux 2015.4 and XSDK 2015.4.

 

It seems petalinux-package doesn't follow build/bootgen.bif created by itself. My bootgen.bif is a little different from fkluger's:

[, load=0x520000, partition_owner=uboot] /tmp/tmp.ESaD9pXOcu/image.ub

The offset 0x520000 matches the settings of petalinux-config and platform-auto.h. However, the "bootgen -image newbif.bif -o test.bin -debug -w" command shows a different offset for image.ub, e.g. 0x5c7c0. I tried adding an option "--offset 0x520000" for the kernel in petalinux-package command, but it doesn't change anything.

 

My current workaround is: Find out kernel's offset with fkluger's solution, then run petalinux-config and change the size of boot partition, so I can get a correct "kernelstart=0x5c7c0\0" in platform-auto.h. Then rebuild u-boot and run petalinux-package again. In this way I get a BOOT.BIN which can automatically load the kernel. It's inconvenient, but fortunately I don't have to do it often.

 

Thank you fkluger for sharing your solution. It really helps.

0 Kudos
Adventurer
Adventurer
15,181 Views
Registered: ‎09-19-2014

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

It's not entirely clear to me what you're trying to do.. (and part of that is from me not being familiar with petalinux).

Anyway, you've specified a "load" parameter, which says that partition should be loaded into memory at that address. Did you mean to specify "offset", which says that partition should have that particular offset within the BOOT.bin image?

There's a list of BIF file parameters here on page 57:

http://www.xilinx.com/support/documentation/user_guides/ug821-zynq-7000-swdev.pdf

 

Also, here are some examples of loading using FSBL and loading using U-Boot.

http://www.wiki.xilinx.com/Prepare+boot+image

Visitor cheng6
Visitor
14,796 Views
Registered: ‎02-03-2016

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

Thanks to sam_jaeschke, finally I have a decent solution. The two links you posted are very useful.

 

I suspect petalinux-package somehow doesn't create the bin file properly, so I created my own bootgen.bif and use bootgen to create the image, and it fixed the problem.

 

Still there is something tricky: If I use "offset=xx", bootgen puts it exactly at the address instructed. But if I use "load=xx", bootgen still tries to "pack" it, and I always get a much smaller address. I'm now using "offset=xx" for dtb, and "load=xx" for kernel. To prevent bootgen from moving the kernel around, I put kernel partition at a nice aligned address and use "alignment=" in bootgen.bif for kernel.

0 Kudos
Visitor kmadhu85
Visitor
9,332 Views
Registered: ‎05-31-2017

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

Hi,

Even I am using same technique to work on our custom board.

But I having problem with loading rootfs.jffs2 which is flashed on nand. I don't want initramfs which comes along kernel.

I get error when kernel try to mount rootfs from nand and it  hangs.

Please find the attached log.

 

Note : I removed ramfs from image.ub.

using : petalinux v2016.4

xilinx SDK v2016.4 for program_flash utility.

0 Kudos
Visitor ray110
Visitor
7,411 Views
Registered: ‎10-30-2017

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

Hi, I have a similar issue, I am trying to boot from a squash fs from flash, but the kernel is not picking it up and it leads to a kernel panic.

Anyone knows what the bootargs should be? root=/dev/mtd4?

 

Thanks for your time, I'm really struggling with that one.

0 Kudos
Visitor patholden
Visitor
7,067 Views
Registered: ‎03-08-2018

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

I'm trying to follow the directions in "http://www.wiki.xilinx.com/Prepare+boot+image" using 2016.4, in particular the section for generating Linux BIF file:

 

image :
{
[bootloader]Zynq_FSBL1.elf
topblock_wrapper.bit
u-boot.elf

[offset=<dt_offset>]system.dtb
[offset=<ramdisk_offset>]rootfs.cpio.gz
[offset=<umige_offset>]mage.ub
}

 

When I run "bootgen -image MY-PROJ.bif -o BOOT.BIN", I get BOOTGEN syntax errors for dt-offset, ramdisk-offset, and uimage-offset.  I tried using "-" instead of "_" for offset names, got same BOOTGEN syntax errors.  Also with 2016.4, it doesn't seem that PetaLinux creates the ramdisk image, but does create the rootfs file, so I added that instead of the uramdisk.image.gz that is in this WIKI.  Is there a new way to use the default offsets for 2016.4 PetaLinux & XSDK?

 

As a side-note, is there any way that application notes can be updated to reflect the newer versions of SDK, Vivado, and PetaLinux?

0 Kudos
Explorer
Explorer
5,132 Views
Registered: ‎10-09-2017

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

I'll try it.

I want to boot petalinux from qspi.

0 Kudos
Participant nturner
Participant
3,653 Views
Registered: ‎07-06-2018

Re: Petalinux boot from QSPI flash without SD card on TE0720 (Zynq 7020)

Jump to solution

I'm having a similar problem as fkluger, except when I can't connect over serial at all after flashing.

I followed UG980, up until creating the boot image, where I used the command fkluger used. I'm still trying to get familiar with the process and tools, so the hw files I'm using are just from the TE test_board reference design. All the Xilinx tools I'm using are 2016.4 on Ubuntu 16.04 and the TE0720 is connected using a TE0701.

Since I'm still learning a lot of the ropes I suspect I'm missing an obvious step that just wasn't made explicit anywhere, or that was explicit and I just overlooked because I didn't recognize its significance.

EDIT: I forgot to add that the LED pattern on the TE0720 indicates that it is still trying to boot from SPI (Red blinking fast, near green off, far green on).

0 Kudos