LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Makefile confused about kernel version that's running - Failed Module Insertion (https://www.linuxquestions.org/questions/linux-newbie-8/makefile-confused-about-kernel-version-thats-running-failed-module-insertion-4175690004/)

MTCAT 02-06-2021 11:58 AM

Makefile confused about kernel version that's running - Failed Module Insertion
 
3 Attachment(s)
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.

shruggy 02-06-2021 01:31 PM

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


MTCAT 02-06-2021 01:46 PM

1 Attachment(s)
Hi, thanks for the help.

Is there a way I can check this ?

I did also find the following message, see attached.

shruggy 02-06-2021 01:54 PM

Try to provide KERNELDIR explicitly as an argument to make:
Code:

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

MTCAT 02-06-2021 02:43 PM

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.

shruggy 02-06-2021 03:05 PM

Quote:

Originally Posted by MTCAT (Post 6217091)
./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"

MTCAT 02-06-2021 03:44 PM

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.

MTCAT 02-06-2021 04:04 PM

2 Attachment(s)
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.

Emerson 02-06-2021 04:15 PM

Run 'dmesg -W' in another terminal and then try insmod again, what do you see?

MTCAT 02-06-2021 04:17 PM

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

MTCAT 02-06-2021 04:26 PM

1 Attachment(s)
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.

Emerson 02-06-2021 04:57 PM

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.

MTCAT 02-06-2021 05:21 PM

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

???

Emerson 02-06-2021 05:28 PM

Code:

CFLAGS="-march=i486"
Try this in your command line.

MTCAT 02-06-2021 07:04 PM

Unfortunately no luck still, same error, unable to load module, invalid module format.


All times are GMT -5. The time now is 11:29 PM.