03-19-2017 10:47 PM
Hi,
I'm trying to develop a very simple Kernel Module on Petalinux 2016.4. I have read some article's and books on the issue and understand the basic requirement. Though I'm missing an organized scheme that dictates the way it is expected from a developer to develop a driver for Petalinux 2016.4 specifically: like where is the border line between the effort that the developer has to provide and the capabilities that the already available tools provide.
Just an example (a very big chance that I do not understand the big picture at this point at all): I do not understand where the insmod function flexibility that the Linux provides vs. the requirement to install the driver in the kernel image as per the UG1144.
I'll appreciate, if someone could elaborate on the issue or provide pointers to material that can support on the matter.
Thanks,
Igal
03-19-2017 11:06 PM
Hi
Here are the very simple steps to develop/add the kernel module in petalinux 16.4:
a) Remove the entire contents of the file and add the following:
SUMMARY = "Example new-module module "
b)
Remove the entire contents of the file and then add the following text:
obj-m += <MODULENAME>.o
03-20-2017 12:20 AM
03-22-2017 06:44 AM
Balkrishan and Shabbir,
thank you both for the reply.
I have tried with https://www.xilinx.com/support/answers/66853.html to enable the debugging info within Kernel but failed the petalinux-Config step(log is attached).
Any support will be appreciated.
Igal
03-22-2017 07:04 AM
Hi Igal
Firstly check the RAM size, it must be more than 4GB for petalinux.
Second thing, run the command: petalinux-build -x clean and petalinux-build -x mrproper
After this try again?
Best Regards
Shabbir
03-22-2017 08:22 AM
03-22-2017 08:25 AM
Hi Igal
I mean to say that, since petalinux-build itself is failing for you, the host on which you are running/creating this images must have RAM of more than 4GB.It is nothing to do with target.
Sorry, if i have confused you.
Regards
Shabbir
03-22-2017 08:35 AM
03-22-2017 08:40 AM
Hi igal
If you are having 16GB then thats fine, then just try giving the clean build once, as I suggested above.
Regards
Shabbir
03-22-2017 09:31 AM
03-29-2017 12:37 AM
Shabbir,
I understood that in order to run a module I need to install the module into the rootfs.
Though I have faced a few issues:
I tried your proposal to prepare a general Makefile and use the *.bb file as the one that summarizes all files (*.c, *.h) in the module. Was that the intention? because when I compile It fails (a log is attached).
It looks like the source files are copied to another directory and compiled there but it is missing files which are in my original directory: /opt/pkg/petalinux/xilinx-zcu102-zu9-es2-rev1.0-2016.4/project-spec/meta-user/recipes-modules/mcdgmodule/mcdgmodule
Temporally, I am using the attached Makefile which is slightly different from your proposal (the file is attached).
when I try to compile:
petalinux-build -c rootfs/mcdgmodule it fails and propose to compile petalinux-build -c mymodule which starts the compilation. Why?
The compilation takes ~5 minutes every time. Is there a way to a build and not a rebuild?
Then I noticed that although I compile the module a new image.ub is not generated unless I run petalinux-build which also takes ~10minutes. Is there a way to shorten it?
Thanks,
Igal
03-29-2017 10:08 PM
03-30-2017 08:10 AM
Hi Igal
Sorry for late reply. And in petalinux we have a standard way to create modules. PFA petalinux user (Refer:Adding Custom Modules), you can get this.
And, petalinux-build -c rootfs/mcdgmodule it fails and propose to compile petalinux-build -c mymodule which starts the compilation. Why?
Yes this is know issue with petalinux 2016.4, you should compile using petalinux-build -c <module_name>, I will check this and update you
For the third question, you will find answer in the attached guide itself (Refer: Building User Applications)
On Petalinux 2016.4, you can speed up execution by going to petalinux-config--->yocto settings ---> You can see num of threads for parallel compilation, there you can put the 4 or 8 depending on the cores
03-30-2017 08:11 AM
04-02-2017 01:34 AM