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: 
Observer dnovick
Observer
11,514 Views
Registered: ‎06-16-2016

How to enable FSBL customization in petalinux

So, I'm getting used to Petalinux, and understand how to patch things like the linux kernel and u-boot.

 

However, I also need to customzie the FSBL build. For example, I want to add some more debug messages, turn on debug logging (which depends on a #define), and also do a debug build.

 

On the first two items, I had hoped that it would be a similar process as with the kernel and u-boot...i.e. make code changes in the git clone, create the patches, make changes to the appropriate bbappend file, yada yada.

 

However, I can't seem to do this with the fsbl, as unless I'm missing something, it doesn't use a local git repository. It appears to fetch the files...but not in a way that allows patching.

 

How do I 1) patch the source code to my liking and 2) Actually build in debug mode?

 

I know I could always create an FSBL in the Xilinx SDK, shuttle it over to my images directory, and petalinx-image against it...but it seems like petalinux should allow me to do as I describe. If I'm going to use petalinux, I'd prefer to use it for everything.

 

In fact as far as building in debug mode, I'm not sure exactly how to do that for Linux or u-boot. Is this possible within petalinux? If so, how?

 

 

Thanks,

Dave

 

Tags (3)
16 Replies
Xilinx Employee
Xilinx Employee
11,468 Views
Registered: ‎08-01-2012

Re: How to enable FSBL customization in petalinux

Please check whether any of the below Answer Record is useful for you

https://www.xilinx.com/support/answers/66853.html 

https://www.xilinx.com/support/answers/68057.html

________________________________________________

Please mark this post as an "Accept as solution" in case if it helped to resolve your query. So that it will help to other forum users to directly refer to the answer.

Give kudos to this post in case if you think the information is useful and reply oriented.

0 Kudos
Observer dnovick
Observer
11,432 Views
Registered: ‎06-16-2016

Re: How to enable FSBL customization in petalinux

Ummmm....I'm not sure these are pointing to what you intended.

 

The first one seems to point to nowhere, as I end up at the support home page. The second are the release notes for petalinux 2016.3. 

 

Is that what you meant to do? Am I missing something?

 

Dave

0 Kudos
Adventurer
Adventurer
11,414 Views
Registered: ‎05-09-2016

Re: How to enable FSBL customization in petalinux

I have the exact same issue with the inconsistency.

 

You can use the "older" method:  Creating a New Zynq FSBL.

And modify the source there and build.

 

Then add it to your boot image using: 

petalinux-package  --boot --u-boot --fsbl directory/to/fsbl.elf 

 

You'd probably need to add the FSBL as an "application" to allow it to compile with the rest of the project - a bit of of a manual process. Hope it helps.

0 Kudos
Highlighted
Moderator
Moderator
11,404 Views
Registered: ‎04-17-2011

Re: How to enable FSBL customization in petalinux

You can create the customized FSBL in SDK and then copy it over to the images/linux folder of Petalinux and run the petalinux-package command
OR
Just use Bootgen to generate the BOOT.BIN file.
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Newbie sherman_hsu
Newbie
9,943 Views
Registered: ‎09-21-2017

Re: How to enable FSBL customization in petalinux

Hi

 

If your Petalinux equal or later than 2017.1, the following solution should work for you

Working with a user space Yocto layer-How to patch FSBL in v2017.1 PetaLinux Project

 

I have worked with this solution on Petalinux 2017.2

 

Regards,

Sherman 

Scholar ronnywebers
Scholar
9,453 Views
Registered: ‎10-10-2014

Re: How to enable FSBL customization in petalinux

thanks @sherman_hsu, that's a great tip!

 

I'm just wondering how to create such a patch file.

 

Let's say I want to enable the debug info output of the FSBL on the COM port. In SDK, this could be done as follows : 

  • open fsbl_debug.h
  • add #define FSBL_DEBUG_INFO    1

Now if I understand you correctly, this can be somehow done from Petalinux too, using some patch file. 

 

Now I'm wondering how to create such patch file?

Also, can the actual FSBL source be seen somewhere in a petalinux project? Like in the build folder?

 

** kudo if the answer was helpful. Accept as solution if your question is answered **
0 Kudos
Explorer
Explorer
9,438 Views
Registered: ‎10-04-2017

Re: How to enable FSBL customization in petalinux

I haven't worked with the FSBL very much in the Yocto builds but you can find the source after building in the build dir, something like this:

 

build/tmp/work/zcu102_zynqmpnapa-poky-linux/fsbl/2017.2+gitAUTOINC+122565ec40-r0/git/lib/sw_apps/zynq_fsbl/src

 

and it gets the source from, https://github.com/Xilinx/embeddedsw.git.  the rule is in meta-xilinx-tools/recipes-bsp/fsbl

 

The other way I used to do it was generate the build using the hdf and the hsi tool.  I'm not really sure where this source came from but once it was generated I could just manually modify it and build it with make.  It's probably better to figure out the Yocto method at this point.

 

jeff

Moderator
Moderator
9,417 Views
Registered: ‎04-24-2017

Re: How to enable FSBL customization in petalinux

Hi @ronnywebers,

 

Refer http://www.wiki.xilinx.com/PetaLinux+Yocto+Tips I have added some steps to enable the debugs in FSBL and PMUFW.

 

Also here the steps to create the git patch.

 

$ git clone https://github.xilinx.com/embeddedsw/embeddedsw.git
$ git checkout tags/xilinx-v2017.2
$ git branch myembsw_2017.2
$ git checkout myembsw_2017.2
$ vim lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_em.c //Modify the source
$ git add lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_em.c
$ git commit -s 
$ git format-patch -1
Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
Scholar vanmierlo
Scholar
8,072 Views
Registered: ‎06-10-2008

Re: How to enable FSBL customization in petalinux

@sandeepg,

I must be stupid, but I still don't get it. Just like the people above I want the FSBL to be more verbose. I cannot believe I have to create a patch file for that. A simple -DFSBL_DEBUG compiler flag should be enough. So using petalinux 2017.4 I tried:

$ mkdir -p <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl

I don't think I need a files dir,  but if I do, please explain.

 

$ vim <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/fsbl_%.bbappend

 

#Enable appropriate FSBL debug flags
YAML_COMPILER_FLAGS_append = " -DFSBL_DEBUG"

 Why would this fail? It builds alright, but I get no verbose output.

0 Kudos
Moderator
Moderator
6,237 Views
Registered: ‎04-24-2017

Re: How to enable FSBL customization in petalinux

Hi @vanmierlo,

 

After you enable the debug flags run this following commands. Refer http://www.wiki.xilinx.com/PetaLinux+Yocto+Tips 

 

$ petalinux-build -x mrproper
$ rm -rf <plnx-proj-root>/components/plnx_workspace
$ petalinux-build  

 

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Moderator
Moderator
6,213 Views
Registered: ‎09-12-2007

Re: How to enable FSBL customization in petalinux

You can just create a fsbl_%.bbappend and add the
YAML_COMPILER_FLAGS_append = "Insert compiler flag”

In a fsbl recipe in the recipes-bsp in your petalinux project.

Have you tried this? Does it work?
0 Kudos
Scholar vanmierlo
Scholar
6,153 Views
Registered: ‎06-10-2008

Re: How to enable FSBL customization in petalinux

Well, I had tried that and it seemed not to work. That was why I was asking here in the first place.

 

But now I see that it does work. I'm beginning to think that maybe the FSBL was writing to one of my other UARTs which are implemented in the PL.

 

Thanks for sticking with me.

0 Kudos
Visitor wicky_waka
Visitor
2,423 Views
Registered: ‎04-15-2019

Re: How to enable FSBL customization in petalinux

Just for enabling debug messages below procedure worked for me:

mkdir -p <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl
nano <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/fsbl_%.bbappend

Then Add the following to the file:

#Enable appropriate FSBL debug flags  
YAML_COMPILER_FLAGS_append = " -DFSBL_DEBUG"

Now, do the following to build the new FSBL.

petalinux-build -x mrproper
rm -rf <plnx-proj-root>/components/plnx_workspace
petalinux-build
Now you can find the newly compiled fsbl in your images/linux directory. Now use the following command to make the BOOT.BIN file.
petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/<fpga>.bit --u-boot
Now copy the generated BOOT.BIN to the FAT partition of your SDCard and boot the board(ZedBoard for me) in SD-card boot mode.
 
For demonstration, I made a video tutorial you can watch it below:
Contributor
Contributor
807 Views
Registered: ‎05-31-2019

Re: How to enable FSBL customization in petalinux

Hi @stephenm @sandeepg @wicky_waka  ,

The debug flag as below is not working for me.

#Enable appropriate FSBL debug flags
YAML_COMPILER_FLAGS_append = " -DFSBL_DEBUG"

 I looked at http://www.wiki.xilinx.com/PetaLinux+Yocto+Tips, but did not find a similar flag. I am assuming the flag has been modified to:

#Add debug for FSBL
XSCTH_BUILD_DEBUG = "1"

Is this correct?

0 Kudos
Moderator
Moderator
704 Views
Registered: ‎04-24-2017

Re: How to enable FSBL customization in petalinux

Hi @maju42 

There is not such flags called -DFSBL_DEBUG you need to fill this content with appropriate flags such as 

#Add debug for FSBL
XSCTH_BUILD_DEBUG = "1"

YAML_COMPILER_FLAGS_append = " -DXPS_BOARD_ZCU102 -DFSBL_PROT_BYPASS_EXCLUDE"

For more details refer https://github.com/Xilinx/embeddedsw/blob/master/lib/sw_apps/zynqmp_fsbl/src/xfsbl_config.h

Make sure you checkout the right release version in above link.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Scholar vanmierlo
Scholar
674 Views
Registered: ‎06-10-2008

Re: How to enable FSBL customization in petalinux


@sandeepg wrote:

There is not such flags called -DFSBL_DEBUG


This is wrong as general as it is written here. This is exactly the right flag for Zynq.

But for ZynqMP things could be different.

0 Kudos