Trenz Electronic Products > Trenz Electronic FPGA Modules
Howto make PetaLinux module header available to an app?
(1/1)
bigguiness:
I have created a custom Linux driver (basically a miscdevice) for my hardware using:
--- Code: ---$ petalinux-create -t modules--name myip --enable
--- End code ---
The driver consists of a myip.c file and a myip.h header with the IOCTL definitions and other uapi stuff.
The driver compiles fine and is getting loaded with no issues during the kernel boot.
I'm now trying to write a test app for the driver. I created the app with:
--- Code: ---$ petalinux-create -t apps -n test_myip --template install --enable
--- End code ---
This app just has a test_myip.c file but it needs the myip.h header.
If I #ifdef out all the stuff provided by myip.h the test app compiles and is installed to the rootfs. And it runs fine when the system is booted.
But if I try to include the myip.h I get a compile error. I have tried a number of paths ("myip.h", <myip.h>, <linux/myip.h>, etc.) but no luck.
I tried searching the <plnx-proj-root> for the myip.h file and it is only found at project-spec/meta-user/recipes-modules/myip/files/myip.h.
What do I need to do to get the myip.h header installed in the build tree so that the test_myip.c file can include it?
Thanks
JH:
Hi,
you can ask this question here, but this is completely independent from our modules.
It's better to ask here: https://support.xilinx.com/s/topic/0TO2E000000YKXXWA4/embedded-linux?language=en_US
AMD/Xilinx community is much bigger. So you will get faster an answer there.
br
John
bigguiness:
John,
I have looked in the AMD/Xilinx forums already.
The only answer I found there was to create a symbolic link in the apps files directory to the header in the modules files directory.
That would probably work but doesn't seem like the proper way to do this.
I was hoping someone in this forum has had to do this and knows the "right" way.
It seems many of the AMD/Xilinx answers just say "read this doc"...
bigguiness:
Answering this myself in case anyone else has the same issue...
I finally found an old yoctoproject message about this and figured it out.
In the recipe for the "app" you need to add something like this:
--- Code: ---DEPENDS = "myip"
--- End code ---
Then in the recipe for the "module" add something like this:
--- Code: ---do_install_append() {
install -d ${D}/usr/include/myip
install -m 0755 ${S}/myip.h ${D}/usr/include/myip/
}
--- End code ---
This makes the "app" depend on the "module" and the "module" install the header to /usr/include/myip/.
Then in the "app" the header can be simply included with:
--- Code: ---#include <myip/myip.h>
--- End code ---
Hartley
JH:
Hi,
thanks for sharing this information here.
Have a nice weekend!
br
John
Navigation
[0] Message Index
Go to full version