cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor
4,334 Views
Registered: ‎01-27-2015

How to build kernel Headers with Petalinux

Jump to solution

Hi to all,


I need to use the function dma_alloc_coherent() contained in linux/dma-mapping.h, I have seen that this file is contained in the linux header in my computer. To include all dependences I think is better to include kernel sources in the petalinux build so I can find it in eg: /usr/include/linux and
/usr/include/asm . After I can extract it to a folder, include the path in the XSDK and do an

 

#include <linux/dma-mapping.h>

 

to use the function I need. As I do with other libraries (Opencv,ffmpeg)
Is there a command to include the kernel source in the build?

Maybe a file like conf.bb to modify in some Yocto layer?

Many thanks in advance!

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Contributor
Contributor
4,809 Views
Registered: ‎01-27-2015

Hi to All, After a some hard days I have found a solution that I going to share.

First Modify the file petalinux-image.bbappend that you can find in the following path:

<plnx-proj-root>/project-spec/meta-user/recipes-core/images/

 

add the following line:

 

 

IMAGE_INSTALL_append = "kernel-devsrc"

 

 

Launch petalinux-config -c rootfs

 

select the kernel source in the following menu:

 

user packages --> [*] kernel-devsrc

 

save and launch petalinux-build

 

If no error occurs, It's done!!

 

 

I had the following error: Computing transaction...error: Can't install kernel-devsrc-1.0-r0@plnx_arm: no package provides /bin/awk

It create the rpm package but cannot install it. It's a bug I hope will be patched in next releases

https://patchwork.openembedded.org/patch/136699/

In my opinion that package is provided by busybox and the installer doesn't find it.

 

Below follow a possible Workaround that I used to install the package.

 

launch petalinux-config -c rootfs

 

add the rpm tool, yo can find it in the following position:

 

Filesystem Packages  --> misc  --> rpm --> [*]rpm

 

remove the kernel source added before:

 

user packages --> [ ] kernel-devsrc

 

launch petalinux-build and flash the new distribution on your SD card.

 

copy the package kernel-devsrc-1.0-r0.plnx_arm.rpm from

<plnx-proj-root>/build/tmp/deploy/rpm/plnx_arm to a position in your SD card.

 

Start your system and install it using the following command:

 

rpm -ivh --nodeps kernel-devsrc-1.0-r0.plnx_arm.rpm

 

the --nodeps avoid if is following not finding the dependences.

Done!

 

  

 

 

 

 

View solution in original post

4 Replies
Highlighted
Contributor
Contributor
4,810 Views
Registered: ‎01-27-2015

Hi to All, After a some hard days I have found a solution that I going to share.

First Modify the file petalinux-image.bbappend that you can find in the following path:

<plnx-proj-root>/project-spec/meta-user/recipes-core/images/

 

add the following line:

 

 

IMAGE_INSTALL_append = "kernel-devsrc"

 

 

Launch petalinux-config -c rootfs

 

select the kernel source in the following menu:

 

user packages --> [*] kernel-devsrc

 

save and launch petalinux-build

 

If no error occurs, It's done!!

 

 

I had the following error: Computing transaction...error: Can't install kernel-devsrc-1.0-r0@plnx_arm: no package provides /bin/awk

It create the rpm package but cannot install it. It's a bug I hope will be patched in next releases

https://patchwork.openembedded.org/patch/136699/

In my opinion that package is provided by busybox and the installer doesn't find it.

 

Below follow a possible Workaround that I used to install the package.

 

launch petalinux-config -c rootfs

 

add the rpm tool, yo can find it in the following position:

 

Filesystem Packages  --> misc  --> rpm --> [*]rpm

 

remove the kernel source added before:

 

user packages --> [ ] kernel-devsrc

 

launch petalinux-build and flash the new distribution on your SD card.

 

copy the package kernel-devsrc-1.0-r0.plnx_arm.rpm from

<plnx-proj-root>/build/tmp/deploy/rpm/plnx_arm to a position in your SD card.

 

Start your system and install it using the following command:

 

rpm -ivh --nodeps kernel-devsrc-1.0-r0.plnx_arm.rpm

 

the --nodeps avoid if is following not finding the dependences.

Done!

 

  

 

 

 

 

View solution in original post

Highlighted
Observer
Observer
3,042 Views
Registered: ‎09-06-2018

Hi I'm using Petalinux 2018.2.

Once I build my solution I cannot inlucde linux/interrupt.h. I think that this library is included in the kernel header and I tried to install tham adding the string "IMAGE_INSTALL_append = "kernel-devsrc" " and adding the package in the rootfs configuration as you said.

I encountered an error about the pythn library, so I added it in the rootfs configuration and the I could build the solution successfully.

But I cannot find again linux/interrupt.h in the generate sysroot.

Any suggestions?

Thank you

Highlighted
2,773 Views
Registered: ‎07-05-2018

after you finished config your kernel <petalinux-config -c kernel>

you must save your kernel setting by specifying save file path which is 

<plnx-proj-root>/project-spec/meta-plnx-generated/recipes-kernel/linux/configs/plnx_kernel.cfg

check plnx_kernel.cfg and see whether the setting you wish has been enabled before petalinux-build

 

0 Kudos
Highlighted
Visitor
Visitor
2,653 Views
Registered: ‎05-17-2019
rpm -ivh --nodeps kernel-devsrc-1.0-r0.plnx_zynqmp.rpm

when i run the above command i amgetting this error:

rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing...
Preparing... ################################# [100%]
package kernel-devsrc-1.0-r0.plnx_zynqmp is intended for a different architecture

please help me with this

Regards
Rahul

0 Kudos