LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Old driver, new kernel, how to compile? (https://www.linuxquestions.org/questions/linux-software-2/old-driver-new-kernel-how-to-compile-926718/)

dedec0 02-01-2012 01:43 PM

Quote:

Originally Posted by orcaja (Post 4590793)
how did you get that error?

I don't remember exactly... can't look for it now. Try to modify the Makefile as I did. And the script/Configure file too. And maybe (if other errors persist) do a "export BASH=/bin/bash" before doing the "make config".

The error will say the path to create the missing dir.

If its not this, I will have to try and repeat it all, another day.

Side note: who said all errors are bad? :D

orcaja 02-01-2012 03:41 PM

ohh I had misunderstood. I changed the line 117 on Makefile as you said: "/bin/bash scripts/Configure" and now sudo make config works fine. This asks for the card model.
I only selected the card that I have: 1780, and then...
make
for n in kernel lib tools; do make -C $n || exit 1; done
make[1]: Entering directory `/home/flowsensor/Downloads/advdaq-1.10.0001/kernel'
make -C /lib/modules/2.6.32-5-686/build M=/home/flowsensor/Downloads/advdaq-1.10.0001/kernel modules
make[2]: Entering directory `/usr/src/linux-headers-2.6.32-5-686'
Building modules, stage 2.
MODPOST 0 modules


make didn't create the two .ko files needed for the card.

dedec0 02-02-2012 04:53 AM

I can't help you any further.

But, so I could compile it all without "sudoing", I extracted the kernel source code to the home folder.

EDIT: of course, there are times *you will* need to get super user powers; e.g., when installing the compiled driver, for example, by making a "make install". And watch out for wrong paths causing errors.

orcaja 02-02-2012 07:20 AM

Where are the *.ko files?
 
OK! thanks, I really appreciated your help, I think I'm very very close to make it.

I tried without sudoing, and extracted the sources at ~/daq/linux/linux-sources-2.6.32 and also copied the .config file..
make config, make dep and make, all of them fine, finally make install


for n in PCI-1780/ PCI-1784/;\
do cp $n*.ko ../modules; \
done
cp: cannot stat `PCI-1780/*.ko': No such file or directory
cp: cannot stat `PCI-1784/*.ko': No such file or directory
make[1]: *** [install] Error 1

I found the directory kernel/PCI-1780 and it only contains one Make file, files *.c and one with extension .h ... there are no ko files.

Thanks in advance.

EDDY1 02-02-2012 04:37 PM

http://wiki.r1soft.com/display/kb/Co....29+and+higher

dedec0 02-03-2012 05:19 AM

Just in case (some things evaporate quickly)


Debian Bug report logs - #521515
linux-headers-2.6.29-1-amd64: please restore symlinks into -common

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521515

orcaja 02-03-2012 09:18 AM

those links are too advanced for my knowledge, I'm trying to understand.
So far, I think my system is not creating the modules. In make:

make[2]: Entering directory `/usr/src/linux-headers-2.6.32-5-686'
Building modules, stage 2.
MODPOST 0 modules

while executing make, does the line:
for n in kernel lib tools; do make -C $n || exit 1; done
indicates that it will go to the directory kernel and do make, then it will go to lib and tools directories and do make too?. can I run make manually each of them?

I tried this example:
http://www.cyberciti.biz/tips/build-...urce-tree.html
and then ls

hello.c hello.ko hello.mod.c hello.mod.o hello.o Makefile modules.order Module.symvers

This makes me think that I should be able to compile my drivers, but I'm just guessing. :D am I right?

orcaja 02-04-2012 08:17 PM

how to debbug the Make file?
 
I tried in a laptop, I followed the same steps to compile the driver and I get the same results as before:

make
for n in kernel lib tools; do make -C $n || exit 1; done
make[1]: Entering directory `/home/flowsensor/Downloads/advdaq-1.10.0001/kernel'
make -C /lib/modules/2.6.32-5-686/build M=/home/flowsensor/Downloads/advdaq-1.10.0001/kernel modules
make[2]: Entering directory `/usr/src/linux-headers-2.6.32-5-686'
Building modules, stage 2.
MODPOST 0 modules

Can anyone give me an advice to start debbuging this file?
Thanks in advance.

orcaja 02-05-2012 11:25 AM

make warning undefined!
 
1 Attachment(s)
I changed my advinit.c file, i added this
#define pci_module_init pci_register_driver
and also change SA_SHIRQ to IRQF_SHARED

now make gives warnings like this:
WARNING: "advdrv_unregister_driver" [/kernel/PCI-1780/pci1780.ko] undefined!;
I haven't found how to solve that, but at least, it generates the pci1780.ko file, but it still does not generate the advdrv_core.ko file...

I'm attaching the Makefile, just in case somebody could have a look. I'm runnning debian 6, kernel 2.6.32
Thanks in advance.
Joc

orcaja 02-08-2012 02:08 PM

two ko files at least
 
I went to the directory /core/ and type make. This generates the advdrv_core.ko file, however, I got this too:

/home/flowsensor/daq/advdaq-1.10.0001/kernel/core/advk_core.c:1593: warning: passing argument 1 of ‘__constant_memcpy’ discards qualifiers from pointer target type

then I went to the directory /PCI-1780/ and typed make, and I get some messages like this:


WARNING: "advdrv_unregister_driver" [/home/flowsensor/daq/advdaq-1.10.0001/kernel/PCI-1780/pci1780.ko] undefined!

But it generated the pci1780.ko anyway. However it seems that the two modules: advdrv_core.ko and pci1780.ko are related, and the first should provide some functions for the second. Anyway, since I have the two files, I did inserted the two of them with insmod, but for the pci1780.ko file I get this:

insmod: error inserting 'pci1780.ko': -1 Unknown symbol in module

Any advice pleease?

orcaja 02-08-2012 03:14 PM

EXPORT_SYMBOL_GPL,... how to
 
I inserted the advdrv_core.ko before compiling the pci1780.ko file... same results

At the end of the file advdrv_core.c there are some lines like this:
./core/advdrv_core.c:EXPORT_SYMBOL_GPL(advdrv_register_driver);
./core/advdrv_core.c:EXPORT_SYMBOL_GPL(advdrv_unregister_driver);

but still when I compile the pci1780.ko I get:
WARNING: "advdrv_unregister_driver" [/path/PCI-1780/pci1780.ko] undefined!
WARNING: "advdrv_register_driver" [/path/PCI-1780/pci1780.ko] undefined!

orcaja 02-09-2012 10:32 AM

I compile the advdrv_core.ko, then I did this:

1) Copy the advdrv_core.ko file to a location beneath /lib/modules/<version>/kernel
2) Add the exported symbols to /lib/modules/<version>/build/Module.symvers

Then I compiled the pci1780.ko!!!

Then I ran make install, and that creates the major number and other things beyond my knowledge.

Now the driver is compiled, I think!!!
Now I compiled the very first program for this card, no problems reported so far. But
when I run this very first program, I got this:

err msg: System Error!

I guess, I should mark this thread as SOLVED and started a new one somewhere eh?
Thank you everyone.
Joc


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