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
Observer keyshavmor2611
Observer
382 Views
Registered: ‎06-07-2018

U-Boot and Kernel Source codes in PetaLinux

Hi,

 

I have been using the PetaLinux tools for quite some time and enjoy using it. I was wondering if the PetaLinux downloads the U-Boot and Kernel source code from the gir repository during installation/configuration/building process in order to generate the boot images. I want to have a look at the source code and play with it a little for my project. Does anybody know in which path the u-boot and kernel source codes are located?

 

(I know I can download it from GitHub, but that is not my question. My question is specific to the U-Boot and Kernel source code which comes with PetaLinux installation.)

 

Regards,

Keyshav

0 Kudos
3 Replies
Xilinx Employee
Xilinx Employee
357 Views
Registered: ‎05-15-2018

Re: U-Boot and Kernel Source codes in PetaLinux

Hi @keyshavmor2611 

The source code for the linux kernel and u-boot does not get installed/downloaded on your local host as part of the petalinux installation. When petalinux-build is invoked, it automatically pulls the source code from the relevant tags located in Xilinx's github repositories. These source files (along with other build artifacts) are stored in the 'tmp' directory (whose location is specified in the petalinux-config menu), and are purged when the build process completes. This is done automatically to conserve disk space on the host machine. 

The recommended way to provide your own custom source code for these components is by cloning them from Xilinx's github repo, and then pointing Petalinux to use these external sources. You can then modify the cloned source files as you wish, and those changes will be captured in images built by Petalinux. The steps to do this are outlined on p. 107 of https://www.xilinx.com/support/documentation/sw_manuals/xilinx2019_1/ug1144-petalinux-tools-reference-guide.pdf

Hope that helps.

Best,

Shiril

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
Observer keyshavmor2611
Observer
329 Views
Registered: ‎06-07-2018

Re: U-Boot and Kernel Source codes in PetaLinux

Hi shirlit,

 

Thank you for the clarification. However, there still remains one question. When you do a broad search for 'u-boot' or 'linux-xlnx' in the project directory created by PetaLinux, you come across the same tar.gz repositories in the 'build' folder of the project. These are the same as the tar.gz repositories in the components/yocto/downloads folder. On further investigation, it is found that the repositories are virtually empty, except the 'objects' folder, which contains a 'pack' folder which contains a '.pack' archive/file which weighs around 170 MB.

A quick google search shows that this .pack archive has something to do with Git and that it contains the git tree structure. I am unable to extract this archive on Linux. Can you clarify on what is this archive and how to open it on Linux. Also does this archive contain the source code? Because if going by your answer, the 'tmp' folder is deleted after build is over, then why is this tar.gz repository still present in the project folder? It does not make sense. Please clarify.

 

Regards,

Keyshav

0 Kudos
Xilinx Employee
Xilinx Employee
306 Views
Registered: ‎05-15-2018

Re: U-Boot and Kernel Source codes in PetaLinux

Hi @keyshavmor2611 

The .git.tar.gz files in the build folder of a petalinux project are symbolic links to the zipped git repos in the components/yocto/downloads folder. However, these .git.tar.gz files are internally used by Petalinux and git to yield the source files in the tmp directory, prior to compiling various components like ATF, PMUFW, u-boot, and linux-xlnx. That said, the actual source files still only temporarily exist in the tmp directory during the build process. Also keep in mind that it is not recommended to make changes to files in the build directory, since it's contents are cleared/refreshed during every invocation of petalinux-build.

The .pack files are again meant for intermediate use by git during the petalinux-build process. These files contain objects of the git repo compressed using the zlib format, which are used by the git filesystem to reconstruct the original sources in the tmp directory. Hence, the .pack files cannot be extracted using unzip/untar to yield source files and make modifications to them. 

All of the above is done with the aim of conserving space on the host machine when a petalinux-build is performed. This also explains why the .git.tar.gz files exist only as symbolic links rather than actual files within the petalinux project. If this was not done, one can quickly start exhausting disk space by having multiple copies of the same repos in each petalinux project, which does not make sense. 

In summary, the tried-and-tested way to customize source files is to clone the requisite repos, make changes to it, and point petalinux to use that repo, instead of the default versions. In case you don't want to clone a repo to customize source files, but have a patch file instead, an alternate technique is described in https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842475/PetaLinux+Yocto+Tips#PetaLinuxYoctoTips-PatchingtheLinuxKernelofaPetaLinuxProject. Personally, I find this slightly more cumbersome since it involves manually copying patch files and editing .bbappend files for each patch.

Best,

Shiril 

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos