LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 08-05-2008, 08:42 PM   #1
tachwali
LQ Newbie
 
Registered: Aug 2008
Posts: 5

Rep: Reputation: 0
modpost warnings when building a driver... please help


Hello folks,

I have a problems in building a driver for a module that I have, the kernel in my machine is 2.6.9 and upon building the driver, I got the following warning:
*** Warning: "unregister_hdlc_device" [path to ko file] undefined!
*** Warning: "hdlc_ioctl" [path to ko file] undefined!
*** Warning: "hdlc_open" [path to ko file] undefined!
*** Warning: "register_hdlc_device" [path to ko file] undefined!
*** Warning: "hdlc_close" [path to ko file] undefined!
*** Warning: "alloc_hdlcdev" [path to ko file] undefined!

After that, I could not load the driver... upon using insmod, I get:
insmod: error inserting 'ko file': -1 Unknown symbol in module

If anybody has any clue or suggestions on the cause of this problem, I would appreciate alot the help.

Thank you

Last edited by tachwali; 08-05-2008 at 08:57 PM.
 
Old 08-06-2008, 08:19 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,671
Blog Entries: 54

Rep: Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953
Quote:
Originally Posted by tachwali View Post
*** Warning: "unregister_hdlc_device" [path to ko file] undefined! (..) After that, I could not load the driver... upon using insmod, I get: insmod: error inserting 'ko file': -1 Unknown symbol in module
Warnings are not there to ignore. When you have a warning at the previous stage then you can be sure the next stage will fail as well, no sense in continuing. Grep your /kernel/source/.config for anything that provides '.*HDCL.*' and check if it's either built-in or is available as module. If some aren't then you may need to clean up your source (could try without cleaning but I don't know how it affects dependencies), reconfigure and try building again.
 
Old 08-06-2008, 11:47 AM   #3
tachwali
LQ Newbie
 
Registered: Aug 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Warnings are not there to ignore. When you have a warning at the previous stage then you can be sure the next stage will fail as well, no sense in continuing. Grep your /kernel/source/.config for anything that provides '.*HDCL.*' and check if it's either built-in or is available as module. If some aren't then you may need to clean up your source (could try without cleaning but I don't know how it affects dependencies), reconfigure and try building again.
THank you very much for the clue about the .config. I found the following upon grepping on hdlc:

# CONFIG_HDLC is not set
CONFIG_HISAX_HDLC=y
CONFIG_N_HDLC=m

so it might be that I need to set CONFIG_HDLC. How can I decide whether I need to set it to y (kernel) or m (module)? Also, upon doing this mod, I need to rebuild the kernel. If I wanna avoid rebuilding kernel, is it an option to download an RPM for HDLC rather than setting .config file or not..

Thank you again for your help
 
Old 08-06-2008, 04:57 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,671
Blog Entries: 54

Rep: Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953
Quote:
Originally Posted by tachwali View Post
How can I decide whether I need to set it to y (kernel) or m (module)?
Some options affect others, some are simple booleans, others are tri-states, so unless you're familiar with those dependencies and are comfortable editing the .config by hand I'd suggest using any form of 'make menuconfig'.


Quote:
Originally Posted by tachwali View Post
If I wanna avoid rebuilding kernel, is it an option to download an RPM for HDLC rather than setting .config file or not..
If there's an RPM for HDLC then it should fit some specific distribution kernel version. If yours is a custom built kernel it may or may not work.
 
Old 08-07-2008, 03:03 AM   #5
tachwali
LQ Newbie
 
Registered: Aug 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Some options affect others, some are simple booleans, others are tri-states, so unless you're familiar with those dependencies and are comfortable editing the .config by hand I'd suggest using any form of 'make menuconfig'.



If there's an RPM for HDLC then it should fit some specific distribution kernel version. If yours is a custom built kernel it may or may not work.
Thanks alot of the clarification. In fact, I went to menuconfig to add the required HDLC support. However, after finishing and saving my changes. I have tried to rebuild by typing make at the kernel path and I got the following error:

[root@localhost 2.6.9-42.EL-i686]# make
CHK include/linux/version.h
CHK include/asm-i386/asm_offsets.h
/bin/sh: arch/i386/kernel/asm-offsets.s: No such file or directory
UPD include/asm-i386/asm_offsets.h
mv: cannot stat `include/asm-i386/asm_offsets.h.tmp': No such file or directory
make: *** [include/asm-i386/asm_offsets.h] Error 1


I am using CentOS with kernel 2.6.9 as you can see. I found this problem discussed alot in the group community but I got so confused with the formal way of addressing this problem. Would you please lead me to the appropriate solution to this problem. I would appreciate alot your help.
 
Old 08-07-2008, 07:23 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,671
Blog Entries: 54

Rep: Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953Reputation: 2953
May be due to building a kernel before? Try 'make clean' before you 'make'. If that fails you can 'make mrproper' but please copy your .config out of the main kernel directory before doing that because it nukes the source good, then copy it back in after which you should be able to 'make oldconfig && make'.
 
Old 08-10-2008, 06:26 PM   #7
tachwali
LQ Newbie
 
Registered: Aug 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
May be due to building a kernel before? Try 'make clean' before you 'make'. If that fails you can 'make mrproper' but please copy your .config out of the main kernel directory before doing that because it nukes the source good, then copy it back in after which you should be able to 'make oldconfig && make'.
Thank you for the heads up on this. I have tried these commands above but I still get the same messages. I have tried many times in the last days to get a complete source code for a 2.6.9 kernel since I guess the problem that I could not "make" in my current kernel is because I do not have the complete source tree. I have followed the procedure in howto at wiki.centos.org website to install a new kernel using RPM packages but I ended up with the following :
-----------------------------------------------------
[root@localhost i686]# rpm -ivh kernel-*.rpm
Preparing... ########################################### [100%]
package kernel-2.6.9-67.0.22.EL is already installed
package kernel-devel-2.6.9-67.0.22.EL is already installed
package kernel-hugemem-devel-2.6.9-67.0.22.EL is already installed
package kernel-smp-devel-2.6.9-67.0.22.EL is already installed
file /boot/System.map-2.6.9-67.0.22.EL from install of kernel-2.6.9-67.0.22.EL conflicts with file from package kernel-2.6.9-67.0.22.EL
file /boot/config-2.6.9-67.0.22.EL from install of kernel-2.6.9-67.0.22.EL conflicts with file from package kernel-2.6.9-67.0.22.EL
file /boot/symvers-2.6.9-67.0.22.EL.gz from install of kernel-2.6.9-67.0.22.EL conflicts with file from package kernel-2.6.9-67.0.22.EL
file /boot/vmlinuz-2.6.9-67.0.22.EL from install of kernel-2.6.9-67.0.22.EL conflicts with file from package kernel-2.6.9-67.0.22.EL
------------------------------------------------------------

However, I was able to reboot with the new kernel but still I can not find o files for my HDLC in the kernel path under driver/net/wan. I am listing below the steps that I did to install a new customized kernel starting from fresh installation of CentOS 4.4 with kernel 2.6.9-42

1- getting the kernel:
1.1 access as root
1.2 yum install rpm-build redhat-rpm-config
1.3 su user
1.4 cd
1.5 mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
1.6 echo "%_topdir %(echo $HOME)/rpmbuild" > .rpmmacros
1.7 rpm -i http://mirror.centos.org/centos/4/up....22.EL.src.rpm 2> /dev/null
1.8 cd ~/rpmbuild/SPECS
1.9 rpmbuild -bp --target=`uname -m` kernel-2.6.spec 2> prep-err.log | tee prep-out.log

These so far sound fine. but then I guess there might be a mistake or missing step in my procdure to build the new kernel:

2- building a new kernel:
2.1 access as root
2.2 rpmbuild -bp --target=`uname -m` kernel-2.6.spec 2> prep-err.log | tee prep-out.log
2.3 su user
2.4 cd ~/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.`uname -m`
2.5 cp configs/kernel-2.6.18-i686.config .config
2.6 make oldconfig
2.7 make menuconfig {here I left it as is and did not do any modification since I am planning to include HDLC as a module after build a complete custom kernel}
2.8 [user@host SPECS]$ rpmbuild -bb --target=`uname -m` kernel-2.6.spec 2> build-err.log | tee build-out.log
2.9 su
2.10/ rpm -ivh kernel-*.rpm

and after the last command I have got the conflict warning above. What is wrong in my installation procedure! Please help.


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 08-11-2008, 01:57 AM   #8
tachwali
LQ Newbie
 
Registered: Aug 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by tachwali View Post
Thank you for the heads up on this. I have tried these commands above but I still get the same messages. I have tried many times in the last days to get a complete source code for a 2.6.9 kernel since I guess the problem that I could not "make" in my current kernel is because I do not have the complete source tree. I have followed the procedure in howto at wiki.centos.org website to install a new kernel using RPM packages but I ended up with the following :
-----------------------------------------------------
[root@localhost i686]# rpm -ivh kernel-*.rpm
Preparing... ########################################### [100%]
package kernel-2.6.9-67.0.22.EL is already installed
package kernel-devel-2.6.9-67.0.22.EL is already installed
package kernel-hugemem-devel-2.6.9-67.0.22.EL is already installed
package kernel-smp-devel-2.6.9-67.0.22.EL is already installed
file /boot/System.map-2.6.9-67.0.22.EL from install of kernel-2.6.9-67.0.22.EL conflicts with file from package kernel-2.6.9-67.0.22.EL
file /boot/config-2.6.9-67.0.22.EL from install of kernel-2.6.9-67.0.22.EL conflicts with file from package kernel-2.6.9-67.0.22.EL
file /boot/symvers-2.6.9-67.0.22.EL.gz from install of kernel-2.6.9-67.0.22.EL conflicts with file from package kernel-2.6.9-67.0.22.EL
file /boot/vmlinuz-2.6.9-67.0.22.EL from install of kernel-2.6.9-67.0.22.EL conflicts with file from package kernel-2.6.9-67.0.22.EL
------------------------------------------------------------

However, I was able to reboot with the new kernel but still I can not find o files for my HDLC in the kernel path under driver/net/wan. I am listing below the steps that I did to install a new customized kernel starting from fresh installation of CentOS 4.4 with kernel 2.6.9-42

1- getting the kernel:
1.1 access as root
1.2 yum install rpm-build redhat-rpm-config
1.3 su user
1.4 cd
1.5 mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
1.6 echo "%_topdir %(echo $HOME)/rpmbuild" > .rpmmacros
1.7 rpm -i http://mirror.centos.org/centos/4/up....22.EL.src.rpm 2> /dev/null
1.8 cd ~/rpmbuild/SPECS
1.9 rpmbuild -bp --target=`uname -m` kernel-2.6.spec 2> prep-err.log | tee prep-out.log

These so far sound fine. but then I guess there might be a mistake or missing step in my procdure to build the new kernel:

2- building a new kernel:
2.1 access as root
2.2 rpmbuild -bp --target=`uname -m` kernel-2.6.spec 2> prep-err.log | tee prep-out.log
2.3 su user
2.4 cd ~/rpmbuild/BUILD/kernel-2.6.18/linux-2.6.18.`uname -m`
2.5 cp configs/kernel-2.6.18-i686.config .config
2.6 make oldconfig
2.7 make menuconfig {here I left it as is and did not do any modification since I am planning to include HDLC as a module after build a complete custom kernel}
2.8 [user@host SPECS]$ rpmbuild -bb --target=`uname -m` kernel-2.6.spec 2> build-err.log | tee build-out.log
2.9 su
2.10/ rpm -ivh kernel-*.rpm

and after the last command I have got the conflict warning above. What is wrong in my installation procedure! Please help.


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

I figured out what I am missing and I got the driver built and working now. In my procedure posted above, I was missing to define buildid in kernel-2.6.spec. In fact what should be done before 2.8 is to :
-vi kernel-2.6.spec
-add in line 69: %define buildid .your_identifier
This will avoid a conflict with my currently installed kernel.

I am still wondering if what I did is an overkill to get the module loaded. I had the CentOS 4.4 with kernel 2.6.9.42 before installing this 2.6.9.67 kernel. Is there a way to get the HDLC module built and installed with minimal steps rather than going into a complete fresh kernel rebuilt?
As mentioned in the posts above, "make" and "make install" after editing the config file should be all what I need. But unfortunately that did not work in my original kernel, and that is why I decided to get a fresh kernel to experiment on.
If I can really get HDLC built and load without kernel build or download another kernel source. What could be missing in my original 2.6.9.42 kernel that prevents me from doing make and make install after editing the config file?

Thank you to all of you for providing help and explanations.
 
  


Reply


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
Building lan driver help exallon Linux - Newbie 4 03-18-2007 06:24 AM
Gentoo 2006.1 - Cisco vpnclient install problem (no Makefile.modpost)) deadeyes Linux - Distributions 7 03-07-2007 05:46 AM
Modpost Error when Emerging x11-drm nisgar2k Linux - Software 4 01-21-2007 06:27 AM
new forum: driver building mcconnaughey LQ Suggestions & Feedback 3 07-15-2005 05:22 PM
building nvidia driver xemophora Linux - Hardware 4 05-09-2004 01:10 AM


All times are GMT -5. The time now is 08:57 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration