LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   How to add extra dependencies to kernel modules (https://www.linuxquestions.org/questions/linux-kernel-70/how-to-add-extra-dependencies-to-kernel-modules-4175532806/)

bogdanul2003 02-02-2015 08:32 AM

How to add extra dependencies to kernel modules
 
I'm trying to add fbtft kernel module as an external package in openwrt by copying all necessary files in /package/fbtft directory like this guy did https://github.com/GBert/openwrt-misc/tree/master/fbtft

The problem is that fbtft is compiled using -DCONFIG_FB_DEFERRED_IO=1 . This define is used by some framebuffer structures like fb_info from fb.h. If CONFIG_FB_DEFERRED_IO is defined then the structure has a different size. Now linux frame buffer files like fbsysfs.c, which uses this fb_info strucure, are not compiled with this CONFIG_FB_DEFERRED_IO flag which causes fb_info to have a different size. Fbtft uses fbsysfs.c to allocate memory for fb_info structure but the size is different between the two because they are not compiled with the same flags.

I tried to add FB_BROADSHEET and FB_AUO_K190X (which depend on FB_DEFERRED_IO) from "make kernel_menuconfig" but fbsysfs.c and other framebuffer files are still not compiled with the required flag (i can see this by looking at .fbsysfs.o.cmd file). How can I add -DCONFIG_FB_DEFERRED_IO=1 flag at compile time for all linux framebuffer files so they all have the correct fb_info structure ?

Thanks

smallpond 02-02-2015 08:47 AM

Edit the .config file in the root of the kernel source. Change
Code:

# CONFIG_FB_DEFERRED_IO is not set
to
Code:

CONFIG_FB_DEFERRED_IO=y
then recompile the kernel.

bogdanul2003 02-02-2015 09:11 AM

2 Attachment(s)
I've attached the .config (renamed to config.txt) and the .o.cmd file after compilation.
It seems CONFIG_FB_DEFERRED_IO is set to y but if you look at the .o.cmd file you'll see that fbsysfs.c was not compiled with -DCONFIG_FB_DEFERRED_IO=1.
After I modified the .config file I ran make V=s in the root of openwrt source tree so I compiled not only the kernel.

Shouldn't I modify framebuffer Makefile and manually add -DCONFIG_FB_DEFERRED_IO=1 ?

smallpond 02-02-2015 10:41 AM

If your build tools are not including .config in the compilation, then most modules will not work.

bogdanul2003 02-02-2015 11:43 AM

How can I know for sure if the .config file is used by the build tools ?

bogdanul2003 02-03-2015 02:42 AM

One more question: if CONFIG_FB_DEFERRED_IO=y in .config file all files should be compiled with -DCONFIG_FB_DEFERRED_IO=1 ? How does the build tool choose what files are compiled with what define flags ?


All times are GMT -5. The time now is 06:17 AM.