LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-23-2020, 05:41 AM   #1
KernelKombat
LQ Newbie
 
Registered: Oct 2018
Posts: 6

Rep: Reputation: Disabled
Compiling module gives MODPOST Error (Unknown Symbol)


I am trying to work on the IIO driver by doing what is said here, which is a collection of starter tasks for those new to kernel development. Anyway, so I begin by first updating my kernel source, and also selecting the .config options that they require. Then I built the source and am now running Linux version 5.7.0-rc1+ (it wasn't my first choice to build to the latest kernel, but I didn't know how to update my source otherwise). While that all worked fine, I keep receiving errors while trying to compile the modules to build kernel objects (.ko files). For example, when I run
Code:
make drivers/iio/dummy/iio_dummy.ko
. I receive this long list of modpost errors (here is the full output):

Code:
CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  MODPOST 1 modules
ERROR: modpost: "iio_register_sw_device_type" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_trigger_notify_done" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_dummy_evgen_get_regs" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_kfifo_allocate" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_device_unregister" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_get_time_ns" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_triggered_buffer_postenable" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_dummy_evgen_get_irq" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "__iio_device_register" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_device_attach_buffer" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "config_group_init_type_name" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_unregister_sw_device_type" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_device_free" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_device_alloc" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_triggered_buffer_predisable" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_kfifo_free" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_dummy_evgen_release_irq" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_alloc_pollfunc" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_push_to_buffers" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_push_event" [drivers/iio/dummy/iio_dummy.ko] undefined!
ERROR: modpost: "iio_dealloc_pollfunc" [drivers/iio/dummy/iio_dummy.ko] undefined!
scripts/Makefile.modpost:94: recipe for target '__modpost' failed
make[1]: *** [__modpost] Error 1
Makefile:1701: recipe for target 'single_modpost' failed
make: *** [single_modpost] Error 2
By grepping the source for some of these symbols, I found that they are, as expected, all defined somewhere in the
Code:
drivers/iio
subdirectory. AND by grepping my .config file for "IIO", I can see that, these are, in fact selected (not everything in the subsystem is selected, but everything necessary, I presume):

Code:
# CONFIG_SENSORS_IIO_HWMON is not set
CONFIG_IIO=m
CONFIG_IIO_BUFFER=y
CONFIG_IIO_BUFFER_CB=m
CONFIG_IIO_BUFFER_HW_CONSUMER=m
CONFIG_IIO_KFIFO_BUF=m
CONFIG_IIO_CONFIGFS=m
CONFIG_IIO_TRIGGER=y
CONFIG_IIO_CONSUMERS_PER_TRIGGER=2
CONFIG_IIO_SW_DEVICE=m
CONFIG_IIO_SW_TRIGGER=m
# CONFIG_IIO_ST_ACCEL_3AXIS is not set
# Hid Sensor IIO Common
# end of Hid Sensor IIO Common
# IIO dummy driver
CONFIG_IIO_DUMMY_EVGEN=m
CONFIG_IIO_SIMPLE_DUMMY=m
CONFIG_IIO_SIMPLE_DUMMY_EVENTS=y
CONFIG_IIO_SIMPLE_DUMMY_BUFFER=y
# end of IIO dummy driver
# CONFIG_IIO_ST_GYRO_3AXIS is not set
# CONFIG_IIO_ST_LSM6DSX is not set
# CONFIG_IIO_ST_MAGN_3AXIS is not set
# CONFIG_IIO_HRTIMER_TRIGGER is not set
# CONFIG_IIO_INTERRUPT_TRIGGER is not set
# CONFIG_IIO_TIGHTLOOP_TRIGGER is not set
# CONFIG_IIO_SYSFS_TRIGGER is not set
# CONFIG_IIO_ST_PRESS is not set
I looked into what the Modpost step does at https://www.kernel.org/doc/Documenta...ld/modules.txt and found that it essentially dives into the Module.symvers file to look through its recorded symbols, none of which are the ones the output says is missing (I grepped Module.symvers for "iio" and received no results).

Unfortunately, I'm at a loss for how to fix this. Could it be that I did not build the kernel properly with these settings? How else do I check? Most importantly, how do I export these symbols to the kernel so it knows to find them.

One final remark that may have some relevance is that I am unable to run
Code:
sudo apt-get install linux-headers-$(uname -r)
because it can't find the headers for my kernel version (5.7.0-rc1+).
 
Old 04-23-2020, 07:28 AM   #2
jem777
LQ Newbie
 
Registered: Apr 2020
Distribution: Ubuntu, Debian, Devuan, Raspbian, Armbian, Parrot OS
Posts: 11

Rep: Reputation: Disabled
Hard to say what the issue is because you provided no description of your build environment used to compile your new kernel. From your last remarks, I gather you downloaded raw kernel sources (i.e. didn't download them through apt)?
In that case, it might simply be that your build environment is looking in the wrong location (i.e. outside of the sources you donwloaded). Check your environment.
 
Old 04-23-2020, 07:51 AM   #3
KernelKombat
LQ Newbie
 
Registered: Oct 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
Yes, I just downloaded the raw source and updated it with "git pull" (I don't know if this is necessary, but I thought if you wanted to contribute patches, it should be to the latest codebase).
Other than that, I also tried to build using the "Make -C" option (so it will build it from the kernel specific directory):
Code:
sudo make -C /lib/modules/$(uname -r)/build M=drivers/iio/dummy
But I still receive the same errors.

However, I'm not quite sure how to describe my current build environment, since I don't know where to look for the details and specifications. Therefore, I'm also not able to know how to point my build environment towards the source I downloaded.

Last edited by KernelKombat; 04-23-2020 at 07:53 AM.
 
Old 04-24-2020, 04:24 PM   #4
KernelKombat
LQ Newbie
 
Registered: Oct 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
Alright, I think I've figured out what went wrong. Essentially, I needed to run 'make modules' and also 'make modules_install' (I believe especially the latter was important to make sure that the modules were in the kernel's 'modules' directory). From there
Code:
sudo M=drivers/iio/dummy
was able to find the binaries and symbols.
 
Old 04-26-2020, 12:52 PM   #5
jem777
LQ Newbie
 
Registered: Apr 2020
Distribution: Ubuntu, Debian, Devuan, Raspbian, Armbian, Parrot OS
Posts: 11

Rep: Reputation: Disabled
Great you figured it out! Happy building!
 
  


Reply

Tags
headers, module, symbols


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
What are the differences between the normal symbol table, the dynamic symbol table, and the debugging symbol table? watchintv Linux - Software 5 10-22-2016 08:38 AM
Problem with MODPOST while compiling external layer2_module.ko abjgupta Linux - Kernel 0 02-01-2013 10:44 AM
Kernel module problem - unknown symbol in module mlangdn Slackware 3 08-30-2010 11:10 PM
MODPOST 0 modules while compiling kernel Unit03 Slackware 3 04-03-2010 05:38 AM
initrd error - "error inserting'/lib/uhci-hcd.ko' : -1 Unknown symbol in module" os.techie Fedora 2 02-04-2009 11:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:36 PM.

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