Sunday, August 5, 2007

How to install Attansic L2 Network Driver in Fedora Core 7

Having bought new box for my kids, I've got ASUS P5GC-MX motherboard with Intel chipset and installed Fedora Core 7 (Live CD).

All worked fine except integrated network card from Attansic (Taiwan). First of all, I couldn't figure out what type of device I have, there were two Linux drivers provided: L1 and L2.

A little bit of googling and voila - it's L2 !
As it happened, the driver required building Linux kernel module (responsible for network) as LiveCD install didn't have it by default.
What ?!
Building kernel module ? Hmm... (why don't I just install windows, I asked myself several times during this procedure :) )

My default method to install all the required components is yum, but it was useless without network setup. So I had to download all packages to my another desktop, copy them to USB key and then use the key at target Linux box.

You would need to get kernel-headers-2.6.21-1.3194.fc7.i386.rpm, kernel-devel-2.6.21-1.3194.fc7.i686.rpm, gcc with dependencies
- glibc-2.6-3.i386.rpm,
- glibc-headers-2.6-3.i386.rpm,
- libgomp-4.1.2-12.i386.rpm,
- glibc-devel-2.6-3.i386.rpm,
- gcc-4.1.2-12.i386.rpm,
- cpp-4.1.2-12.i386.rpm,


and install it using RPM (e.g. rpm -Uvh _name_here.rpm).

To verify that you are ready to build kernel module, check content of /usr/src path, it should contain 'kernels' directory.
Now follow instructions and change current dir to /src/ dir with driver source code and do:
'make install'.

I had some issues with drivers provided on motherboard CD, as happened it was outdated version something like 0.2.40.0. It complained on missing config.h etc

After some googling, I figure out, that version 0.2.40.0 is for older kernels (before 2.6.21). Then I found newer version of the driver and got rid of config.h and other header errors, but got another ones about non-declared members of
struct. A short look at C code showed that some debugging parts are excessive, so simple commenting did the trick.

At this point I'd ran 'make install' , then 'cd /lib/modules//kernel/drivers/net', 'insmod atl2.ko' and got network device working. Then I went to Network configuration and added ip address and dns information.
After device activation I was able to browse internet.

Newer version of driver is (was) available here:
http://launchpadlibrarian.net/7382416/L2-linux-driver_new.rar

RPMs are available at ftp://download.fedora.redhat.com/pub/fedora/linux/releases/7/Everything/i386/os/Fedora/

Good luck !

ps. also found this site (it has Linux Drivers package, but download was so slow that i didn't test the package) http://support.asus.com/download/download_item.aspx?model=P5GC-MX&product=1&type=map&mapindex=3&SLanguage=en-us


pps.

When applying updates that include kernel updates, after reboot it loads new kernel and module we built is not loaded, so no network would be available. In my case I just edit grub.conf and set old kernel (the one we build driver for) and reboot.

18 comments:

Anonymous said...

Hello
I could not compiled the driver. I has error
'struct vlan_group' has no member named 'vlan_devices'

Please, help me.

Khaz Sapenov said...

You need to comment out corresponding functions in C code, that are intended for debugging.
After that everything goes fine.

Anonymous said...

Compiled with errors:

/net/L2_N/src/at_main.c: In function ‘at_vlan_rx_kill_vid’:
/net/L2_N/src/at_main.c:1488: error: ‘struct vlan_group’ has no member named ‘vlan_devices’
/net/L2_N/src/at_main.c: In function ‘at_restore_vlan’:
/net/L2_N/src/at_main.c:1507: error: ‘struct vlan_group’ has no member named ‘vlan_devices’

Kernel 2.6.22.4

Khaz Sapenov said...

Again,
EDIT FILE 'at_main.c' AND COMMENT OUT FUNCTIONS:
at_restore_vlan(){
/*

... stuff here

*/
}
AND
at_vlan_rx_kill_vid()
{
/*

... stuff here

*/

}

Anonymous said...

I think much better solution than commenting some stuff is to correct it. I think that the code is not for debugging but for VLAN support.

Try change 'vlan_devices' to 'vlan_devices_arrays'
See linux/if_vlan.h header (in kernel headers directory) for definition of vlan_group struct

Dean said...

Hi, in an attempt to get this working without downloading and installing kernel source, I tried the link you posted the Red Hat's site (BTW, the full directory name was truncated on my computer, but "Display Source" fixed that). I can't find any RPM with a likely name -- do you remember how you found the file?

Thanks in advance,
Dean

Matlou said...

Hi there, same configuration here - ASUS P5GC-MX motherboard and a Fedora 7 fresh install - Followed the link you posted to the new driver, commented out those vlan functions and it's working just fine :)

Just wanted to say Thank You!

Anonymous said...

Hello,

write you a How to for Fedora 8?

I cant compile the Source with F8....


Thx 4 the great work!

PLATFORMedia LLC said...

I've been doing some work on this for Fedora 8 (so that I can get it installed on the Eee). I've written it up in the Wiki for the Google Code project eeedora.

Anonymous said...

Found your article while setting up my P5GC-MX under Slack 12 & looking for a LAN solution. Just wanted to say thanks!

Anonymous said...

You mentioned that you had problems with make stopping at config.h as of being missing? What did you do to get around this?

Thanks!

Khaz Sapenov said...

I guess you need to download newer version of driver. There's a link in the article.

Anonymous said...

OK, I downloaded the newer code, commented out code in the two functions as recommended, then did a `make install', and I get this error:

at_main.o:2163: error: implicit declaration of function 'eth_copy_and_sum'

and it failed to compile.

What's next?

Khaz Sapenov said...

looks like you are missing some files

Anonymous said...

Nothing missed.

For 2.6.23+ try the patch:

diff -Naur old/at_ethtool.c src/at_ethtool.c
--- old/at_ethtool.c 2007-04-20 09:34:00.000000000 +0400
+++ src/at_ethtool.c 2008-02-27 16:18:56.000000000 +0300
@@ -419,7 +419,7 @@
.get_tso = ethtool_op_get_tso,
#endif
#ifdef ETHTOOL_GPERMADDR
- .get_perm_addr = ethtool_op_get_perm_addr,
+ //.get_perm_addr = ethtool_op_get_perm_addr,
#endif
};

diff -Naur old/at_hw.c src/at_hw.c
--- old/at_hw.c 2007-04-21 11:22:00.000000000 +0400
+++ src/at_hw.c 2008-02-27 16:05:25.000000000 +0300
@@ -536,7 +536,7 @@
at_phy_init(struct at_hw* hw)
{
int32_t ret_val;
- u16 phy_val;
+ //u16 phy_val;


// if (hw->phy_configured)
diff -Naur old/at_main.c src/at_main.c
--- old/at_main.c 2007-04-21 11:19:00.000000000 +0400
+++ src/at_main.c 2008-02-27 16:16:36.000000000 +0300
@@ -1485,7 +1485,7 @@
at_irq_disable(adapter);

if (adapter->vlgrp) {
- adapter->vlgrp->vlan_devices[vid] = NULL;
+ adapter->vlgrp->vlan_devices_arrays[vid] = NULL;
}

at_irq_enable(adapter);
@@ -1504,7 +1504,7 @@
if(adapter->vlgrp) {
u16 vid;
for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
- if(!adapter->vlgrp->vlan_devices[vid])
+ if(!adapter->vlgrp->vlan_devices_arrays[vid])
continue;
at_vlan_rx_add_vid(adapter->netdev, vid);
}
@@ -2160,10 +2160,10 @@

skb_reserve(skb, NET_IP_ALIGN);
skb->dev = netdev;
- eth_copy_and_sum(
+ skb_copy_to_linear_data(
skb,
rxd->packet,
- rx_size, 0);
+ rx_size);
skb_put(skb, rx_size);
/*
memcpy(skb_put(skb, rx_size),

Anonymous said...

UPD: Patch file is here http://hut.sp.ru/misc/attansic_l2_2.6.23.patch
or here
http://earth.creware.com/misc/attansic_l2_2.6.23.patch

Created against L2 driver v.1.0.40.2 and tested with 2.6.23.16 kernel.

Actually you can easily make the patch yourself - just look into recent kernel patches for all symbols reported as undefined or missed. If you have any C/C++ experience or something like that - for sure.

Anonymous said...

How do you aply the patch. Sorry i'm new to linux.

Elie said...

This guide is awesome!^^ Two-thumbs up!!

Cloud Computing Google Group