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
Contributor
Contributor
366 Views
Registered: ‎10-28-2018

where is the original linux kernel source located for petalinux (2017.3 or later) (not the build/tmp one) ?

Jump to solution

Hi,

I have simple question,

where is the linux kernel source code located on the disk after the installation of petalinux tool ? ( aka the exact source code from which the petalinux-build build kernel image )

-----------------

I need to have access to the exact linux kernel code that was built for the image that was generated (even if I cannot build the code if it was edited).

I have searched a lot pages, seems (as I sees) the whole community is avoiding answering this question :(

The engineers either tells the output source code after build ( seems this sould be called dest code :p ) :

https://forums.xilinx.com/t5/Embedded-Linux/Petalinux-where-can-I-find-the-kernel-sources-in-a-Petalinux/td-p/811189

https://forums.xilinx.com/t5/Embedded-Linux/where-is-the-kernel-source-code-located-in-Petalinux2016-4/td-p/877589

or give the xilinx git repo:

https://forums.xilinx.com/t5/Embedded-Linux/Source-code-of-Petalinux-kernel/td-p/419449

or outdated location( $petalinux/components/linux-kernel)

 

or tells to do task in another way:

https://forums.xilinx.com/t5/Embedded-Linux/Making-changes-in-kernel-source-files/td-p/820424

https://forums.xilinx.com/t5/Embedded-Linux/Locating-uboot-amp-Linux-kernel-source-code-for-zc706-board/td-p/870124

or give tons of documents:

https://forums.xilinx.com/t5/Embedded-Linux/Where-is-the-correct-place-to-modify-source-of-the-Petalinux/td-p/724744

or directly ignores the question:

https://forums.xilinx.com/t5/Embedded-Linux/How-to-get-kernel-source-code-from-a-project-of-petalinux-2017-4/td-p/856187

I have searched the $petalinux directory, but seems the keyword "kernel" and "linux" does not filter out the kernel source.

I have filtered .c file but seems the kernel was not flattened into files.

I have filtered .gz and .zip and .7z files but with no luck.

So please tell where is the source code of the used kernel before running petalinux-build ?

 

Regards,
Kang
0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
316 Views
Registered: ‎04-24-2017

Re: where is the original linux kernel source located for petalinux (2017.3 or later) (not the build/tmp one) ?

Jump to solution

Hi @hu_kang,

I think you are asking where is the kernel source before the build. To answer to your question.

In Yocto/PetaLinux kernel source are fetched from recipes(using do_fetch task)

For 2017.3 release kernel commit id in github is https://github.com/xilinx/linux-xlnx/tree/xilinx-v2017.3 (https://github.com/Xilinx/linux-xlnx/commit/f1b1e077d641fc83b54c1b8f168cbb58044fbd4e)

and this commit id is wired up in kernel recipes

https://github.com/Xilinx/meta-xilinx/blob/rel-v2017.3/recipes-kernel/linux/linux-xlnx_4.9.bb#L3

Once you run petalinux-build then you can verify in logs from which location kernel sources are fetched.

The log file you need to check is 

 

<plnx-proj-root>/build/tmp/work/plnx_aarch64-xilinx-linux/linux-xlnx/4.9-xilinx-v2017.3+gitAUTOINC+f1b1e077d6-r0/temp/log.do_fetch

 

 

If you look closely in log 4.9-xilinx-v2017.3+gitAUTOINC+f1b1e077d6-r0 this represents first 10 digit git commit id which matches above recipes.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

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

Re: where is the original linux kernel source located for petalinux (2017.3 or later) (not the build/tmp one) ?

Jump to solution

Can you try <TMP DIR>/work-shared/plnx_aarch64/kernel_source?

TMP DIR can be found in petalinux-config -> yocto settings -> TMPDIR

0 Kudos
Contributor
Contributor
345 Views
Registered: ‎10-28-2018

Re: where is the original linux kernel source located for petalinux (2017.3 or later) (not the build/tmp one) ?

Jump to solution

Hi, @stephenm

I know I can find the source code there, but isn't it the output after the petalinux-build command ?

but where is the origin of  this source code ( aka before executing petalinux-build )?

I need the most original one which is untouched and uncopied from anywhere after the installation of petalinux tool.

Please note the difference.

I'm not looking for the $TMPDIR and anything in it. I know where to find the $TMPDIR.

Thanks

Regards,
Kang
0 Kudos
Moderator
Moderator
317 Views
Registered: ‎04-24-2017

Re: where is the original linux kernel source located for petalinux (2017.3 or later) (not the build/tmp one) ?

Jump to solution

Hi @hu_kang,

I think you are asking where is the kernel source before the build. To answer to your question.

In Yocto/PetaLinux kernel source are fetched from recipes(using do_fetch task)

For 2017.3 release kernel commit id in github is https://github.com/xilinx/linux-xlnx/tree/xilinx-v2017.3 (https://github.com/Xilinx/linux-xlnx/commit/f1b1e077d641fc83b54c1b8f168cbb58044fbd4e)

and this commit id is wired up in kernel recipes

https://github.com/Xilinx/meta-xilinx/blob/rel-v2017.3/recipes-kernel/linux/linux-xlnx_4.9.bb#L3

Once you run petalinux-build then you can verify in logs from which location kernel sources are fetched.

The log file you need to check is 

 

<plnx-proj-root>/build/tmp/work/plnx_aarch64-xilinx-linux/linux-xlnx/4.9-xilinx-v2017.3+gitAUTOINC+f1b1e077d6-r0/temp/log.do_fetch

 

 

If you look closely in log 4.9-xilinx-v2017.3+gitAUTOINC+f1b1e077d6-r0 this represents first 10 digit git commit id which matches above recipes.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Contributor
Contributor
277 Views
Registered: ‎10-28-2018

Re: where is the original linux kernel source located for petalinux (2017.3 or later) (not the build/tmp one) ?

Jump to solution

hi @sandeepg

Thanks, 

I think this is the answer.

In fact I have already found the compressed git repository under

$petalinux/components/yocto/downloads/git2_github.com.Xilinx.linux-xlnx.git.tar.gz ,

by cloning it, I can checkout any version of commits now.

 

Regards,
Kang
0 Kudos