LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-20-2019, 08:16 AM   #1
yoro
LQ Newbie
 
Registered: Feb 2019
Posts: 7

Rep: Reputation: Disabled
Cannot build new image with loadable kernel modules


Hi,

I am trying to build an image using kernel version socfpga-4.14.73-ltsi from altera to put on my SOC and using Buildroot 2018.02.10 but I am getting an error when I include my loadable kernel driver modules as shown below;

Code:
>>> fpga-alg-kernel-module 1.0 Configuring
>>> fpga-alg-kernel-module 1.0 Building
>>> fpga-alg-kernel-module 1.0 Building kernel module(s)
PATH="/home/deva/master_build/buildroot/output/host/bin:/home/deva/master_build/buildroot/output/host/sbin:/home/deva/bin:/home/deva/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" BR_BINARIES_DIR=/home/deva/master_build/buildroot/output/images /usr/bin/make -j5 -C /home/deva/master_build/buildroot/output/build/linux-socfpga-4.20 HOSTCC="/usr/bin/gcc -O2 -I/home/deva/master_build/buildroot/output/host/include -L/home/deva/master_build/buildroot/output/host/lib -Wl,-rpath,/home/deva/master_build/buildroot/output/host/lib" ARCH=arm INSTALL_MOD_PATH=/home/deva/master_build/buildroot/output/target CROSS_COMPILE="/home/deva/master_build/buildroot/output/host/bin/arm-buildroot-linux-uclibcgnueabi-" DEPMOD=/home/deva/master_build/buildroot/output/host/sbin/depmod INSTALL_MOD_STRIP=1  PWD=/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/. M=/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/. modules
  CC [M]  /home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.o
In file included from ./include/linux/module.h:10:0,
                 from /home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.c:2:
./include/linux/stat.h:11:18: error: expected ‘)’ before ‘(’ token
 #define S_IRUGO  (S_IRUSR|S_IRGRP|S_IROTH)
                  ^
/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.c:111:39: note: in expansion of macro ‘S_IRUGO’
 static DRIVER_ATTR(fpga_alg_a_kernel, S_IRUGO | S_IWUSR, fpga_alg_a_kernel_show, fpga_alg_a_kernel_store); //everyone has read access
                                       ^~~~~~~
/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.c: In function ‘fpga_alg_a_kernel_init’:
/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.c:122:55: error: ‘driver_attr_fpga_alg_a_kernel’ undeclared (first use in this function)
  ret = driver_create_file(&fpga_alg_a_kernel_driver, &driver_attr_fpga_alg_a_kernel);
                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.c:122:55: note: each undeclared identifier is reported only once for each function it appears in
/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.c: In function ‘fpga_alg_a_kernel_exit’:
/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.c:191:49: error: ‘driver_attr_fpga_alg_a_kernel’ undeclared (first use in this function)
  driver_remove_file(&fpga_alg_a_kernel_driver, &driver_attr_fpga_alg_a_kernel);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.c:102:16: warning: ‘fpga_alg_a_kernel_store’ defined but not used [-Wunused-function]
 static ssize_t fpga_alg_a_kernel_store(struct device_driver *drv, const char *buf, size_t count)
                ^~~~~~~~~~~~~~~~~~~~~~~
/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.c:76:16: warning: ‘fpga_alg_a_kernel_show’ defined but not used [-Wunused-function]
 static ssize_t fpga_alg_a_kernel_show(struct device_driver *drv, char *buf)
                ^~~~~~~~~~~~~~~~~~~~~~
scripts/Makefile.build:297: recipe for target '/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.o' failed
make[3]: *** [/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/./fpga_alg_a_kernel.o] Error 1
Makefile:1563: recipe for target '_module_/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/.' failed
make[2]: *** [_module_/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/.] Error 2
package/pkg-generic.mk:238: recipe for target '/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/.stamp_built' failed
make[1]: *** [/home/deva/master_build/buildroot/output/build/fpga-alg-kernel-module-1.0/.stamp_built] Error 2
Makefile:84: recipe for target '_all' failed
make: *** [_all] Error 2
My previous images using socfpga-3.10-ltsi and 4.9.78-ltsi were both successful but I am getting this issue with the 4.14.73-ltsi version and that’s why I think that the errors reported by the compiler might not exactly be the source of my problem but more likely that a change from 4.9 to 4.14 is preventing me from using the files as I have right now. I have compared the header files and I could not find any obvious reasons why this is happenning.

I am not sure if it is the right place to ask this but I would appreciate any kind of pointer. Thank you
 
Old 02-20-2019, 01:51 PM   #2
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
Asking the obvious: does it work without your module on 4.13?
 
Old 02-21-2019, 06:35 AM   #3
yoro
LQ Newbie
 
Registered: Feb 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
I can only pull from the branches; 4.9.78, 4.14.73, 4.19, 4.20.

Basically it doesn't compile as from 4.14.

If I remove the loadable kernel modules I can compile the image successfully no matter the version.
 
Old 02-21-2019, 11:05 AM   #4
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
Again I am thinking out loud:

Is it failing on the loadable kernel module you added?
Were any macros removed?
Do you use the same toolchain?
Different compiler options?
 
Old 02-22-2019, 06:57 AM   #5
yoro
LQ Newbie
 
Registered: Feb 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Found the solution. DRIVER_ATTR is not used anymore
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Kernel Newbie Corner: Loadable Kernel Modules, Coming and Going LXer Syndicated Linux News 0 07-08-2009 08:00 PM
Need help creating a Loadable Kernel Modules jacatone Linux - Newbie 12 05-08-2008 05:23 PM
Loadable Kernel Modules and registering with SCSI shayes_enigmads Programming 0 05-25-2006 09:27 AM
Loadable Kernel Modules jbrashear Debian 7 04-03-2005 05:11 PM
loadable modules vs built-in modules nuzzy Linux - Hardware 1 07-21-2003 04:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration