* [Buildroot] Multi-File Kernel Module Build Fails @ 2016-04-26 18:44 Stephen Beckwith 2016-04-26 19:49 ` Thomas Petazzoni 0 siblings, 1 reply; 7+ messages in thread From: Stephen Beckwith @ 2016-04-26 18:44 UTC (permalink / raw) To: buildroot Greetings, I posted this same issue last week and received no response. After some more investigation and trying several different options, I am still STUCK and cannot move forward. Problem: - if a kernel module has more than 1 source file, Buildroot does NOT pass in the MAKE_OPTS defined (path for header files). Compile fails due to "file not found". With a single source file, no problems. In the .mk file: KMOD_MEM_MODULE_MAKE_OPTS = NETAPP_DIR=$(BR2_EXTERNAL)/netapp The "Makefile" in the directory: #inform the kernel that a module needs to be build obj-m := hwdd_memory.o hwdd_memory-objs := hwdd_mem.o hwdd_memalgo.o hwdd_cache_algos.o # Global Includes here GBL_INCLUDES = $(NETAPP_DIR)/include KNL_INCLUDES = $(NETAPP_DIR)/include/kernel #Add here the CFLAGS to pass in to get the Defined Symbol CFLAGS_hwdd_memory.o := -DCONFIG_NETAPP_HWDD -I$(GBL_INCLUDES) -I$(KNL_INCLUDES) Failure: In file included from /home/sbeckwith/HBE-1/hwdd/output/build/kmod_mem-0.1.0/./hwdd_memalgo.c:11:0: /home/sbeckwith/HBE-1/hwdd/output/build/kmod_mem-0.1.0/./hwdd_mem.h:12:26: fatal error: hwdd_klogger.h: No such file or directory compilation terminated. The .mk setup uses: $(eval $(kernel-module)) $(eval $(generic-package)) Are multi-file inputs NOT supported in this scheme? These are custom kernel modules, referencing unique hardware on the target. Can someone please verify that multi-file kernel modules work using this setup? Thanks! Stephen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160426/515eca24/attachment.html> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Multi-File Kernel Module Build Fails 2016-04-26 18:44 [Buildroot] Multi-File Kernel Module Build Fails Stephen Beckwith @ 2016-04-26 19:49 ` Thomas Petazzoni [not found] ` <CAN34foyVVDZTtB06iWVW_g=OrcPy+8g2wiiTPqDwWNqT1cXTAg@mail.gmail.com> 2016-04-28 19:23 ` Peter Korsgaard 0 siblings, 2 replies; 7+ messages in thread From: Thomas Petazzoni @ 2016-04-26 19:49 UTC (permalink / raw) To: buildroot Hello, On Tue, 26 Apr 2016 14:44:28 -0400, Stephen Beckwith wrote: > I posted this same issue last week and received no response. After some > more investigation and trying several different options, I am still STUCK > and cannot move forward. Since you didn't post your entire code, we're not able to reproduce the exact same situation. However, to show how things can work, I've created a minimal example of a kernel module with two C files and one header file (to mimic your use case) and then the corresponding Buildroot package. See: http://thomas.enix.org/example-kernel-module.html for all the files, both the kernel module itself and the Buildroot packaging. Let me know if that works for you. Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <CAN34foyVVDZTtB06iWVW_g=OrcPy+8g2wiiTPqDwWNqT1cXTAg@mail.gmail.com>]
* [Buildroot] Multi-File Kernel Module Build Fails [not found] ` <CAN34foyVVDZTtB06iWVW_g=OrcPy+8g2wiiTPqDwWNqT1cXTAg@mail.gmail.com> @ 2016-04-26 20:25 ` Thomas Petazzoni 2016-04-26 21:00 ` Stephen Beckwith 0 siblings, 1 reply; 7+ messages in thread From: Thomas Petazzoni @ 2016-04-26 20:25 UTC (permalink / raw) To: buildroot Hello, (Resending with the Buildroot mailing list in Cc. Please always keep the list in Cc. Thanks!) On Tue, 26 Apr 2016 16:20:17 -0400, Stephen Beckwith wrote: > KMOD_MEM_MODULE_MAKE_OPTS = NETAPP_DIR=$(BR2_EXTERNAL)/netapp Get rid of this. > #inform the kernel that a module needs to be build > obj-m := hwdd_memory.o > hwdd_memory-objs := hwdd_mem.o hwdd_memalgo.o hwdd_cache_algos.o > > # Global Includes here > GBL_INCLUDES = $(NETAPP_DIR)/include > KNL_INCLUDES = $(NETAPP_DIR)/include/kernel And those two variable definitions. > #Add here the CFLAGS to pass in to get the Defined Symbol > CFLAGS_hwdd_memory.o := -DCONFIG_NETAPP_HWDD -I$(GBL_INCLUDES) > -I$(KNL_INCLUDES) And replace this by: ccflags-y := -DCONFIG_NETAPP_HWDD -I$(src)/include -I$(src)/include/kernel Again, I've spent time creating an example that I've tested. Since I can't reproduce your test case, please try my example, which you can test as I'm providing the entire source code :) Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Multi-File Kernel Module Build Fails 2016-04-26 20:25 ` Thomas Petazzoni @ 2016-04-26 21:00 ` Stephen Beckwith 2016-04-27 16:01 ` Stephen Beckwith 0 siblings, 1 reply; 7+ messages in thread From: Stephen Beckwith @ 2016-04-26 21:00 UTC (permalink / raw) To: buildroot Hi Thomas, The MAKE_OPTS and 2 variables are necessary, as the include directory does NOT get copied into the output/build directory. I see what you did, using $(src) - but that's not where the includes are. I have ~ 40 modules/drivers/apps that reference these includes, they are common across these various software components. Your suggestion failed, due to the includes not being: -DCONFIG_NETAPP_HWDD -I/home/sbeckwith/HBE-1/hwdd/ *output/build/kmod_mem-0.1.0*/./include -I/home/sbeckwith/HBE-1/hwdd/output/build/kmod_mem-0.1.0/./include/kernel Again, IF I have a single source file module, the setup I have works perfectly, the include directory outside of the output/build tree gets referenced and the build is OK. Only when I have more than one source file involved does build root not seem to pass the MAKE_OPTS through. Question: - is it allowed in buildroot to access common include header files outside of the build directory? Or should these be somehow copied (via rsync) as a separate config like item? Regards, Stephen On Tue, Apr 26, 2016 at 4:25 PM, Thomas Petazzoni < thomas.petazzoni@free-electrons.com> wrote: > Hello, > > (Resending with the Buildroot mailing list in Cc. Please always keep > the list in Cc. Thanks!) > > On Tue, 26 Apr 2016 16:20:17 -0400, Stephen Beckwith wrote: > > > KMOD_MEM_MODULE_MAKE_OPTS = NETAPP_DIR=$(BR2_EXTERNAL)/netapp > > Get rid of this. > > > #inform the kernel that a module needs to be build > > obj-m := hwdd_memory.o > > hwdd_memory-objs := hwdd_mem.o hwdd_memalgo.o hwdd_cache_algos.o > > > > # Global Includes here > > GBL_INCLUDES = $(NETAPP_DIR)/include > > KNL_INCLUDES = $(NETAPP_DIR)/include/kernel > > And those two variable definitions. > > > #Add here the CFLAGS to pass in to get the Defined Symbol > > CFLAGS_hwdd_memory.o := -DCONFIG_NETAPP_HWDD -I$(GBL_INCLUDES) > > -I$(KNL_INCLUDES) > > And replace this by: > > ccflags-y := -DCONFIG_NETAPP_HWDD -I$(src)/include -I$(src)/include/kernel > > Again, I've spent time creating an example that I've tested. Since I > can't reproduce your test case, please try my example, which you can > test as I'm providing the entire source code :) > > Best regards, > > Thomas > -- > Thomas Petazzoni, CTO, Free Electrons > Embedded Linux, Kernel and Android engineering > http://free-electrons.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160426/827c8050/attachment.html> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Multi-File Kernel Module Build Fails 2016-04-26 21:00 ` Stephen Beckwith @ 2016-04-27 16:01 ` Stephen Beckwith 0 siblings, 0 replies; 7+ messages in thread From: Stephen Beckwith @ 2016-04-27 16:01 UTC (permalink / raw) To: buildroot Hi Thomas, Problem is now solved! Thank you for your hints, they helped me push this boulder over the hill. Regards, Stephen Beckwith On Tue, Apr 26, 2016 at 5:00 PM, Stephen Beckwith <embeddedsteve@gmail.com> wrote: > Hi Thomas, > The MAKE_OPTS and 2 variables are necessary, as the include directory > does NOT get copied into the output/build directory. I see what you did, > using $(src) - but that's not where the includes are. > I have ~ 40 modules/drivers/apps that reference these includes, they > are common across these various software components. > Your suggestion failed, due to the includes not being: > -DCONFIG_NETAPP_HWDD -I/home/sbeckwith/HBE-1/hwdd/ > *output/build/kmod_mem-0.1.0*/./include > -I/home/sbeckwith/HBE-1/hwdd/output/build/kmod_mem-0.1.0/./include/kernel > > Again, IF I have a single source file module, the setup I have works > perfectly, the include directory outside of the output/build tree gets > referenced and the build is OK. Only when I have more than one source file > involved does build root not seem to pass the MAKE_OPTS through. > > Question: > - is it allowed in buildroot to access common include header files > outside of the build directory? Or should these be somehow copied (via > rsync) as a separate config like item? > > Regards, > Stephen > > On Tue, Apr 26, 2016 at 4:25 PM, Thomas Petazzoni < > thomas.petazzoni at free-electrons.com> wrote: > >> Hello, >> >> (Resending with the Buildroot mailing list in Cc. Please always keep >> the list in Cc. Thanks!) >> >> On Tue, 26 Apr 2016 16:20:17 -0400, Stephen Beckwith wrote: >> >> > KMOD_MEM_MODULE_MAKE_OPTS = NETAPP_DIR=$(BR2_EXTERNAL)/netapp >> >> Get rid of this. >> >> > #inform the kernel that a module needs to be build >> > obj-m := hwdd_memory.o >> > hwdd_memory-objs := hwdd_mem.o hwdd_memalgo.o hwdd_cache_algos.o >> > >> > # Global Includes here >> > GBL_INCLUDES = $(NETAPP_DIR)/include >> > KNL_INCLUDES = $(NETAPP_DIR)/include/kernel >> >> And those two variable definitions. >> >> > #Add here the CFLAGS to pass in to get the Defined Symbol >> > CFLAGS_hwdd_memory.o := -DCONFIG_NETAPP_HWDD -I$(GBL_INCLUDES) >> > -I$(KNL_INCLUDES) >> >> And replace this by: >> >> ccflags-y := -DCONFIG_NETAPP_HWDD -I$(src)/include -I$(src)/include/kernel >> >> Again, I've spent time creating an example that I've tested. Since I >> can't reproduce your test case, please try my example, which you can >> test as I'm providing the entire source code :) >> >> Best regards, >> >> Thomas >> -- >> Thomas Petazzoni, CTO, Free Electrons >> Embedded Linux, Kernel and Android engineering >> http://free-electrons.com >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160427/f30844ef/attachment.html> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Multi-File Kernel Module Build Fails 2016-04-26 19:49 ` Thomas Petazzoni [not found] ` <CAN34foyVVDZTtB06iWVW_g=OrcPy+8g2wiiTPqDwWNqT1cXTAg@mail.gmail.com> @ 2016-04-28 19:23 ` Peter Korsgaard 2016-04-28 20:00 ` Thomas Petazzoni 1 sibling, 1 reply; 7+ messages in thread From: Peter Korsgaard @ 2016-04-28 19:23 UTC (permalink / raw) To: buildroot >>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes: > Hello, > On Tue, 26 Apr 2016 14:44:28 -0400, Stephen Beckwith wrote: >> I posted this same issue last week and received no response. After some >> more investigation and trying several different options, I am still STUCK >> and cannot move forward. > Since you didn't post your entire code, we're not able to reproduce the > exact same situation. However, to show how things can work, I've > created a minimal example of a kernel module with two C files and one > header file (to mimic your use case) and then the corresponding > Buildroot package. > See: > http://thomas.enix.org/example-kernel-module.html > for all the files, both the kernel module itself and the Buildroot > packaging. Nice! Notice that the browser ate the <> in your include statements of mymod-test1.c. I believe you need to use > / < even within <pre> tags. -- Bye, Peter Korsgaard ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] Multi-File Kernel Module Build Fails 2016-04-28 19:23 ` Peter Korsgaard @ 2016-04-28 20:00 ` Thomas Petazzoni 0 siblings, 0 replies; 7+ messages in thread From: Thomas Petazzoni @ 2016-04-28 20:00 UTC (permalink / raw) To: buildroot Hello, On Thu, 28 Apr 2016 21:23:00 +0200, Peter Korsgaard wrote: > Nice! Notice that the browser ate the <> in your include statements of > mymod-test1.c. I believe you need to use > / < even within <pre> > tags. Fixed, thanks! Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-04-28 20:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-26 18:44 [Buildroot] Multi-File Kernel Module Build Fails Stephen Beckwith
2016-04-26 19:49 ` Thomas Petazzoni
[not found] ` <CAN34foyVVDZTtB06iWVW_g=OrcPy+8g2wiiTPqDwWNqT1cXTAg@mail.gmail.com>
2016-04-26 20:25 ` Thomas Petazzoni
2016-04-26 21:00 ` Stephen Beckwith
2016-04-27 16:01 ` Stephen Beckwith
2016-04-28 19:23 ` Peter Korsgaard
2016-04-28 20:00 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox