LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-28-2007, 11:23 AM   #1
doctorcisco
Member
 
Registered: Nov 2003
Posts: 70

Rep: Reputation: 17
Problems Building Driver


All,

I'm trying to build a driver for my wireless card from the source at http://castet.matthieu.free.fr/airo/. I put the airo.c file and the Makefile in /usr/src/airo. When I use the make command, I get:

Building modules, stage 2. MODPOST 1 modules.
WARNING: "crypto_digest_init" [usr/src/airo/airo.ko] undefined!

And the same warning message for crypto_digest_setkey, crypto_digest_final, try_to_freeze, and crypto_digest_update.

I then do make install and make clean, but the resulting module won't load ("Unknown symbol in module"). dmesg indicates the unknown symbols are the 5 listed above.

I'm running Ubuntu, and using a 2.6.20 kernel I compiled with the ck patches, and a few tweaks in the menuconfig that had nothing to do with crypto.

My question is: What do I need to install/do differently/change to build the module correctly? I tried apt-get install libcrypto++-dev, but that didn't help.

Thanks,
doc
 
Old 03-28-2007, 12:07 PM   #2
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Couldn't it be a kernel-heades issue considering you're running a custom kernel?
 
Old 03-28-2007, 01:22 PM   #3
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Your problem is that your kernel is too new for your driver (or more bluntly, your module uses kernel functions that have been removed in the latest kernel). The fix is simple, though (crypto_digest functions have been replaced by crypto_hash functions). Just apply the following patch to airo.c and you should be fine.
Code:
--- airo.c.old
+++ airo.c
@@ -2261,6 +2261,8 @@
 
 	//XXX dont lock the card
 	if (tfm_michael && tx_key [0]) {
+		struct crypto_hash *hash = crypto_hash_cast(tfm_michael);
+		struct hash_desc desc = { .tfm = hash, .flags = tfm_michael->crt_flags };
 		struct scatterlist sg[3];
 		char *pPacket = skb->data;
 
@@ -2276,14 +2278,14 @@
 		sg[2].page = virt_to_page(pPacket + sizeof(etherHead));
 		sg[2].offset = offset_in_page(pPacket + sizeof(etherHead));
 		sg[2].length = len - sizeof(etherHead);
-		crypto_digest_init(tfm_michael);
+		crypto_hash_init(&desc);
 
 		if (test_bit(FLAG_ADHOC, &priv->flags) && (pPacket[0] & 0x1))
-			crypto_digest_setkey(tfm_michael, tx_keym, 8);
+			tfm_michael->crt_hash.setkey(hash, tx_keym, 8);
 		else
-			crypto_digest_setkey(tfm_michael, tx_key, 8);
+			tfm_michael->crt_hash.setkey(hash, tx_key, 8);
-		crypto_digest_update(tfm_michael, sg, 3);
+		crypto_hash_update(&desc, sg, sg[0].length + sg[1].length + sg[2].length);
-		crypto_digest_final(tfm_michael, priv->xmit.mic);
+		crypto_hash_final(&desc, priv->xmit.mic);
 	}
You might want to pass this upstream.

Last edited by osor; 03-29-2007 at 10:41 AM. Reason: Original error in copying spaces vs. tabs
 
Old 03-28-2007, 09:21 PM   #4
doctorcisco
Member
 
Registered: Nov 2003
Posts: 70

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by osor
Your problem is that your kernel is too new for your driver (or more bluntly, your module uses kernel functions that have been removed in the latest kernel). ]
Well, that would explain a thing or two. ;-)

Quote:
Originally Posted by osor
The fix is simple, though (crypto_digest functions have been replaced by crypto_hash functions). Just apply the following patch to airo.c and you should be fine.
Well, either I don't patch correctly, or the patch has a problem of some sort.

root@lapdog:/usr/src/airo# patch -p1 -o newairo.c airo.patch airo.c.old
patching file airo.c.old
Hunk #1 FAILED at 2261.
patch: **** unexpected end of file in patch

Leave it to a WAN Engineer/Linux Student to not figure this out! :-)

doc
 
Old 03-29-2007, 10:55 AM   #5
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by doctorcisco
Well, either I don't patch correctly, or the patch has a problem of some sort.
Sorry ’bout that, I believe there was an error on my part with tabs being replaced by spaces in the post. It should work now (this is what I typed, just to make sure):
Code:
$ wget http://castet.matthieu.free.fr/airo/airo.c
$ patch
--- airo.c.old
+++ airo.c
@@ -2261,6 +2261,8 @@
 
 	//XXX dont lock the card
 	if (tfm_michael && tx_key [0]) {
+		struct crypto_hash *hash = crypto_hash_cast(tfm_michael);
+		struct hash_desc desc = { .tfm = hash, .flags = tfm_michael->crt_flags };
 		struct scatterlist sg[3];
 		char *pPacket = skb->data;
 
@@ -2276,14 +2278,14 @@
 		sg[2].page = virt_to_page(pPacket + sizeof(etherHead));
 		sg[2].offset = offset_in_page(pPacket + sizeof(etherHead));
 		sg[2].length = len - sizeof(etherHead);
-		crypto_digest_init(tfm_michael);
+		crypto_hash_init(&desc);
 
 		if (test_bit(FLAG_ADHOC, &priv->flags) && (pPacket[0] & 0x1))
-			crypto_digest_setkey(tfm_michael, tx_keym, 8);
+			tfm_michael->crt_hash.setkey(hash, tx_keym, 8);
 		else
-			crypto_digest_setkey(tfm_michael, tx_key, 8);
+			tfm_michael->crt_hash.setkey(hash, tx_key, 8);
-		crypto_digest_update(tfm_michael, sg, 3);
+		crypto_hash_update(&desc, sg, sg[0].length + sg[1].length + sg[2].length);
-		crypto_digest_final(tfm_michael, priv->xmit.mic);
+		crypto_hash_final(&desc, priv->xmit.mic);
 	}

^D^D
patching file airo.c
Hope that helps (also fixed the OP).
Quote:
Originally Posted by doctorcisco
Leave it to a WAN Engineer/Linux Student to not figure this out! :-)
My fault for not being careful when copying and pasting.
 
Old 03-29-2007, 04:25 PM   #6
doctorcisco
Member
 
Registered: Nov 2003
Posts: 70

Original Poster
Rep: Reputation: 17
That did indeed help. patch -i patch.new now comes up with a patched airo.c. Alas ... apparently another kernel change has happened. One item in the list above, try_to_freeze, still causes the module to bomb out.

Also, if I remove the 1 line of code that uses that symbol, I then hit additional version errors with 3 driver-specific symbols, undoubtedly due to my newer kernel and the older source code the original file is using.

If you are excited to keep patching, I'll happily upload my new errors. Otherwise, it probably makes more sense to go with an older kernel that's happy with this source, or else wait for someone to come up with a better fix for WPA functions on this goofy wireless card.

Many Thanks,
doc
 
Old 03-29-2007, 05:14 PM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by doctorcisco
That did indeed help. patch -i patch.new now comes up with a patched airo.c. Alas ... apparently another kernel change has happened. One item in the list above, try_to_freeze, still causes the module to bomb out.

Also, if I remove the 1 line of code that uses that symbol, I then hit additional version errors with 3 driver-specific symbols, undoubtedly due to my newer kernel and the older source code the original file is using.

If you are excited to keep patching, I'll happily upload my new errors. Otherwise, it probably makes more sense to go with an older kernel that's happy with this source, or else wait for someone to come up with a better fix for WPA functions on this goofy wireless card.

Many Thanks,
doc
That’s very strange… For try_to_freeze(), try adding “#include <linux/freezer.h>” to the beginning of airo.c. What are the other problems you are having? Can you post the full make output, the insmod output, and the relevant dmesg output.
 
Old 03-29-2007, 10:01 PM   #8
doctorcisco
Member
 
Registered: Nov 2003
Posts: 70

Original Poster
Rep: Reputation: 17
1) The make process throws an error on try_to_freeze:

<snip>
Building modules, stage 2.
MODPOST 1 modules
WARNING: "try_to_freeze" [/usr/src/aironet/airo.ko] undefined!
CC /usr/src/aironet/airo.mod.o
LD [M] /usr/src/aironet/airo.ko
make[1]: Leaving directory `/usr/src/linux-2.6.20'
root@lapdog:/usr/src/aironet# modprobe airo
root@lapdog:/usr/src/aironet#

It then fails to load with the same error I described above (undefined symbol). I'll try adding the line you recommend and report back with a result.


2) There's a second driver file, airo_cs, which I believe is used to get to the card on the PCMCIA bus. It now has version conflicts with the airo piece:

root@lapdog:/usr/src/aironet# modprobe airo
root@lapdog:/usr/src/aironet# modprobe airo_cs
FATAL: Error inserting airo_cs (/lib/modules/2.6.20-ck1/kernel/drivers/net/wireless/airo_cs.ko): Unknown symbol in module, or unknown parameter (see dmesg)

dmesg stuff:
[ 296.862000] airo_cs: disagrees about version of symbol init_airo_card
[ 296.862000] airo_cs: Unknown symbol init_airo_card
[ 296.864000] airo_cs: disagrees about version of symbol stop_airo_card
[ 296.864000] airo_cs: Unknown symbol stop_airo_card
[ 296.864000] airo_cs: disagrees about version of symbol reset_airo_card
[ 296.864000] airo_cs: Unknown symbol reset_airo_card

So to get this working, I'd need to know which source version was originally used to make the hacked up airo.c, get the same version of airo_cs.c, and then make it under this kernel. Or, alternately, get the original diff file used to create the airo.c in the first place. Or, ???

All this because Cisco never released an updated Linux driver with WPA in it. Sigh.

Thanks Again,
doc

Last edited by doctorcisco; 03-29-2007 at 10:58 PM.
 
Old 03-30-2007, 09:46 AM   #9
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by doctorcisco
2) There's a second driver file, airo_cs, which I believe is used to get to the card on the PCMCIA bus. It now has version conflicts with the airo piece:

So to get this working, I'd need to know which source version was originally used to make the hacked up airo.c, get the same version of airo_cs.c, and then make it under this kernel. Or, alternately, get the original diff file used to create the airo.c in the first place. Or, ???

All this because Cisco never released an updated Linux driver with WPA in it. Sigh.

Thanks Again,
doc
Hello. I think the fix here is to rebuild your airo_cs module so it looks for the symbols in the correct place. The easiest method would be to replace the vanilla airo.c file:
Code:
$ cp airo.c "/lib/modules/$(uname -r)/build/drivers/net/wireless" # where airo.c is from Matthieu Castet, but patched as above
$ cd "/lib/modules/$(uname -r)/build"
$ touch drivers/net/wireless/airo_cs.c
$ grep CONFIG_AIRO .config # Just to make sure both drivers are to be made as modules
CONFIG_AIRO=m
CONFIG_AIRO_CS=m
$ make
$ sudo make modules_install
There are probably other ways (namely, move airo.ko to /lib/modules/`uname -r`/kernel/drivers/net/wireless, run depmod, cd to your kernel source, touch the file airo_cs.c, undefine CONFIG_AIRO in .config, remake, reinstall — NOTE: not sure if this will work).
 
Old 04-01-2007, 10:58 PM   #10
doctorcisco
Member
 
Registered: Nov 2003
Posts: 70

Original Poster
Rep: Reputation: 17
Hey again,

1) include linux/freeze<h> did fix the try_to_freeze error.
2) Rebuilding airo and airo_cs with the modified airo.c file down in the src tree for the drivers didn't help the airo_cs problem:

[ 117.418000] airo_cs: disagrees about version of symbol init_airo_card
[ 117.418000] airo_cs: Unknown symbol init_airo_card
[ 117.419000] airo_cs: disagrees about version of symbol stop_airo_card
[ 117.419000] airo_cs: Unknown symbol stop_airo_card
[ 117.420000] airo_cs: disagrees about version of symbol
reset_airo_card
[ 117.420000] airo_cs: Unknown symbol reset_airo_card

So ... I'll try your other suggestions on building airo_cs, but this is looking a bit grim for this module version. Again, thanks for all your help.

doc
 
Old 04-02-2007, 12:51 PM   #11
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Do you get any errors when building? In particular, can you post the make output (it should be rather short, since you are only really compiling two files, with the rest being linked).
Code:
$ cd "/lib/modules/$(uname -r)/build"
$ touch drivers/net/wireless/airo{,_cs}.c
$ make
## Post this output (You can snip all lines beginning with CHECK) ##

Last edited by osor; 04-02-2007 at 01:33 PM.
 
Old 04-09-2007, 03:31 PM   #12
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
I got an email from Matthieu Castet saying that the driver you were using has been relocated to Gna! and is being actively developed there. There are sources that compile against the latest kernel and there is also a mailing list you might find useful.
 
  


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
Building lan driver help exallon Linux - Newbie 4 03-18-2007 05:24 AM
Building the madwifi driver with kernel 2.6.20 dracolich Linux - Wireless Networking 4 03-13-2007 07:08 PM
new forum: driver building mcconnaughey LQ Suggestions & Feedback 3 07-15-2005 04:22 PM
building nvidia driver xemophora Linux - Hardware 4 05-09-2004 12:10 AM
Building a driver diskette jacobmross Linux - Hardware 1 01-13-2004 01:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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