LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 02-06-2021, 11:58 AM   #1
MTCAT
Member
 
Registered: Jan 2021
Posts: 32

Rep: Reputation: Disabled
Makefile confused about kernel version that's running - Failed Module Insertion


Hi everyone,

I'm trying to install a driver for an analog-to-digital converter, everything compiles just fine but I get an insertion error.

I'm running the non-smp kernel when doing this but the Makefile for the A-D seems to think I'm running the smp kernel, I think this is why the module is not being inserted or loaded properly ?

Attached some screenshots.

snapshot1 - the failed insertion.
snapshot2 - verified proper gcc version.
snapshot5 - output of modinfo

Any ideas why the Makefile would be "confused" about the kernel version that is running ?

Typing "uname -r" returns 2.6.21.5, not the smp kernel !

Thanks.
Attached Thumbnails
Click image for larger version

Name:	snapshot1.png
Views:	16
Size:	121.4 KB
ID:	35510   Click image for larger version

Name:	snapshot2.png
Views:	15
Size:	90.2 KB
ID:	35511   Click image for larger version

Name:	snapshot5.png
Views:	17
Size:	112.1 KB
ID:	35512  
 
Old 02-06-2021, 01:31 PM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
Strange indeed. Are you sure the kernel sources/headers you're building against are for your running kernel?

This is what the Makefile essentially does:
Code:
KERNELVER       = $(shell uname -r | cut -d . -f1-2 )
KERNELMAJOR     = $(shell uname -r | cut -d . -f1 )
RELEASE_RM      = ${OBJ_FILES} .tmp* .*.o.cmd .*.ko.cmd .*.mod.cmd .*.ko.*.cmd *.ko.unsigned *.mod.* *.mod Modules*
...
ifeq ("${KERNELVER}","2.6")

${TARGET}-objs  = ${OBJ_FILES}
KERNELDIR               = /lib/modules/$(shell uname -r)/build
MODULE_NAME             = ${TARGET}.ko
obj-m                   = ${TARGET}.o
PWD                             = $(shell pwd)
RELEASE_RM              += ${TARGET}.o Module.symvers

${MODULE_NAME}: $(shell ls ${GSC_DEV_DIR}/*.[ch])
        @-chmod +rw ${DEP_FILE}
        @-echo -n > ${DEP_FILE}
        @make -C ${KERNELDIR} SUBDIRS=${PWD} modules
        @strip -d --strip-unneeded $@
        @rm -f *.mod.c
endif
 
Old 02-06-2021, 01:46 PM   #3
MTCAT
Member
 
Registered: Jan 2021
Posts: 32

Original Poster
Rep: Reputation: Disabled
Hi, thanks for the help.

Is there a way I can check this ?

I did also find the following message, see attached.
Attached Thumbnails
Click image for larger version

Name:	snapshot10.png
Views:	10
Size:	83.2 KB
ID:	35516  
 
Old 02-06-2021, 01:54 PM   #4
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
Try to provide KERNELDIR explicitly as an argument to make:
Code:
make -C driver KERNELDIR="/lib/modules/$(uname -r)/build"
 
Old 02-06-2021, 02:43 PM   #5
MTCAT
Member
 
Registered: Jan 2021
Posts: 32

Original Poster
Rep: Reputation: Disabled
Unfortunately this didn't work 100 percent, the make_all script ran very quickly with the following command

./make_all -C driver KERNELDIR="/lib/modules/$(uname -r)/build"

and still didn't install the module ?

I then removed the 24dsi12 directory completely, and then re-unpacked the tar file (so as to start from scratch), and still the same effect, the new command ran very quickly and didn't seem to be doing anything ?,

when I ran just ./make_all, then the Vortex had to work for a minute or so compiling, etc., but again the module wasn't inserted, with the apparent result being the makefile is compiling against the smp kernel.

I may try installing Lubuntu 10.04 (2.6.32.21) which DOES properly see both Vortex cores (with the generic kernel) and then try installing the ADC driver in Lubuntu ?

Thanks.
 
Old 02-06-2021, 03:05 PM   #6
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,677

Rep: Reputation: Disabled
Quote:
Originally Posted by MTCAT View Post
./make_all -C driver KERNELDIR="/lib/modules/$(uname -r)/build"
I didn't mean to run make_all, but
Code:
make -C driver KERNELDIR="/lib/modules/$(uname -r)/build"
Or, if running make_all then
Code:
./make_all KERNELDIR="/lib/modules/$(uname -r)/build"
 
Old 02-06-2021, 03:44 PM   #7
MTCAT
Member
 
Registered: Jan 2021
Posts: 32

Original Poster
Rep: Reputation: Disabled
Oh, sorry about that, I'll re-try with the new ./make_all syntax, have got Lubuntu 10.04 booted up, no gcc installed at all ! Back to Slack12 and will try the new ./make_all command.
 
Old 02-06-2021, 04:04 PM   #8
MTCAT
Member
 
Registered: Jan 2021
Posts: 32

Original Poster
Rep: Reputation: Disabled
Darn-it, still no luck, the ./make_all process definitely did all the work it was supposed to, but the module still fails to insert, modinfo 24dsi12_pll.ko returns 2.6.21.5-smp.

Attached some screen-shots of the build process.
Attached Thumbnails
Click image for larger version

Name:	snapshot11.png
Views:	9
Size:	107.0 KB
ID:	35523   Click image for larger version

Name:	snapshot12.png
Views:	8
Size:	77.5 KB
ID:	35524  
 
Old 02-06-2021, 04:15 PM   #9
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Run 'dmesg -W' in another terminal and then try insmod again, what do you see?
 
Old 02-06-2021, 04:17 PM   #10
MTCAT
Member
 
Registered: Jan 2021
Posts: 32

Original Poster
Rep: Reputation: Disabled
Unrelated question maybe, but, when typing the following

ls /lib/modules/`uname-r`/kernel/drivers

There's no directory here for the 24dsi12_pll.

Is the 24dsi12_pll.ko supposed to "live" in the location shown above ?, presumably inside a 24dsi12_pll directory ?

Presently, the only place the kernel-object file is located (that I know of) is

/usr/src/linux-2.6.21.5-generic/drivers/24dsi12_pll/driver
 
Old 02-06-2021, 04:26 PM   #11
MTCAT
Member
 
Registered: Jan 2021
Posts: 32

Original Poster
Rep: Reputation: Disabled
Hi, I tried dmesg -W but this didn't work for me ? SO I just tried dmesg, and I saw the same info as obtained when typing

dmesg | grep -i 24dsi

Attached that screenshot here.

Thanks for the help.
Attached Thumbnails
Click image for larger version

Name:	snapshot10.png
Views:	11
Size:	83.2 KB
ID:	35525  
 
Old 02-06-2021, 04:57 PM   #12
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
You have some CHOST conflict there, your Vortex probably is an i586 or even i486, but you are building for i686. Even if your Vortex is an i686 your kernel is not. You need to build for -march=i486 to match your kernel.
 
Old 02-06-2021, 05:21 PM   #13
MTCAT
Member
 
Registered: Jan 2021
Posts: 32

Original Poster
Rep: Reputation: Disabled
Can I pass the compiler option -march=i486 to the makefile from the command line ?

./make_all KERNELDIR="/lib/modules/$(uname -r)/build" -march=i486

???
 
Old 02-06-2021, 05:28 PM   #14
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Code:
CFLAGS="-march=i486"
Try this in your command line.
 
Old 02-06-2021, 07:04 PM   #15
MTCAT
Member
 
Registered: Jan 2021
Posts: 32

Original Poster
Rep: Reputation: Disabled
Unfortunately no luck still, same error, unable to load module, invalid module format.
 
  


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
Is it mandatory to have the name of the makefile as 'Makefile' for kernal module comp narender.d Linux - Kernel 3 05-29-2009 06:26 AM
automake, makefile, makefile.in and makefile.am Fond_of_Opensource Linux - Newbie 1 09-12-2006 08:35 PM
what is the meaning of Makefile,Makefile.am,Makefile.in cynthia_thomas Linux - General 3 12-08-2005 05:00 AM
2.6.11 kernel compile - sound module insertion errors dibblethewrecke Linux - Hardware 3 03-17-2005 11:50 PM
kernel module insertion using insmod on kernel 2.4.20-8, rh 9.0 gooner Red Hat 1 05-27-2004 05:31 AM

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

All times are GMT -5. The time now is 07:23 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