Link to home
Start Free TrialLog in
Avatar of dhohimer
dhohimer

asked on

Why do I get errors when trying to compile the device driver for a ZyXEL GN670-T gigabit NIC

When I run "make" I get an error that the "config.h" file cannot be located.  I have all the kernel source code installed but can't seem to figure out why this file is missing.  I am running Suse Linux 10.0 with the 2.6.13-15.8 kernel

Any help would be appreciated, thanks

DH
Avatar of GinEric
GinEric

What are you trying to compile?  config.h is usually in an upper directory in the source tree and is used by configure  Need to know what you're trying to compile.
That is, what is the tarball of zip name of the program, where did you get it from?
Avatar of Duncan Roe
I assume from your mention of kernel source and question title that you are, in fact, attempting to rebuild the kernel. Otherwise you can disregard this post.

You have to make the config first. There are a variety of make targets that will do this:

make xconfig: needs X and Qt installed - probably OK on a recent install
make menuconfig: works in an xterm or a console
make oldconfig: If you can find an old .config file somewhere (maybe you have one in the top-level directory already - but you still have to run make oldconfig). HOWEVER, only use it if you're happy with the current configuration: if you want to add a new device driver then you probably aren't
make config: very tedious - I wouldn't recommend under normal circumstances

There may be other variants but the above should get you started.
Avatar of dhohimer

ASKER

The driver I am trying to install is velocityget.tgz from the ZyXEL website, it's the most recent driver file.  I located the config.h file, the make file was using uname -r for the version info and suse was adding "-default" to the version info and there is not directory with the "-default" so I had to modify the makefile with the absolute path of the source files.  However, I still got many compilation errors, but locating the source files wasn't one of them.  I am trying to compile the driver as a module as recommended and not recompile the kernel, but I can't even get the driver files to compile.

For duncan roe, I couldn't locate the .config file so I used make cloneconfig, that seemed to work fine.
Path errors and most likely it wasn't ready for your distribution.  There is also the old "perhaps you should set the environment variable" and that means the config and make don't know your system so you have to tell them where certain libraries and shared objects are.

One of the things that may help is autogen and any other that looks at your system and finds out where everything is.  Of course, it may not help much with
-default always in the way of your modifications.

This was hard to find and helped me:

http://www.Musics.com/DownLoad/XF86/XFreeSetup/

This shows the problem with the environment variable and how to fix it:

http://www.Musics.com/manhtml/NewConfigure/MedDocs.0.I.01.02.01.004.00004.NewConfigure.html

It also pretty much explains why the file can't be found, it is not in any known path.  This happens because of the diversity emerging from the uses of /usr , /usr/local , /usr/local/lib , and /usr/shared, include, and so on.  It's basically each distribution going off into its own predefined and static paths for libraries and other shared object files.

authogen is supposed to find all the paths and information per distribution, but there is no guarantee.  After that, automake is also supposed to set up your system, but if the paths are divergent, as the above suggests, it may not find them either.

I have suggested that the Apache Portable Runtime libraries [APR's] be included with all new developer software, so configure and make can finally get past this major headache, so has Apache, but people have to agree on that first.  A simple --with-layout would have solved all of these problems, and that for eveyr program you compile, but the developers have to include the APR's for autotools to "get with the program."

Automake is a subset of GNU and GCC.  As you can tell from experience, it does not include all the possible options for C, configure, make, and the autotools.

Which leads mostly to path errors.  That is what you have, a path error.

Altering the make or config or configure file itself is one option, but a rather tedious one.  Apparently the velocityget.tgz out of the box is a RedHat install:

http://www.linux-tested.com/results/velocity.html

Fedora seems to need more work, and the only thing I could find on Suse was in German:

http://www.linux-web.de/post/38487/Gigabyte-Ethernet-VIA-VT6122.html

you can translate the page, but I think they have your solution.

there are other flags that may get in the way as well; as a module is it static or dynamic?  Etc..

It is still a path problem, maybe added to by wrong compiler flags.  Autotools is supposed to take care of that.  That's open to debate.

silly question: did you run ./configure in the untared directory?
Yes.  You have to be in the "source" directory when untarring.  There are ways to do it outside of that directory, but they are headachey at best.  If you have velocityget.tgz and you're in /Source/velocityget it will untar to something like /Source/velocityget/velocityget-1.0.1 or something like that and you then have to cd to /Source/velocityget/velocityget-1.0.1 and run ./configure there.  KDE Arkiver will work pretty much the same, but it does not like .bz2 nor .tgz on certain systems and you will have to either convert .bz2 or rename .tgz to .tar.gz

.zip should be strictly for Windows.

After ./configure the make will automatically know where everything is when you execute make in /Source/velocityget/velocityget-1.0.1

The same for install or make install

Some programs may require that you run an older command, config

before you run configure.

OK I downloaded a copy of velocityget.tgz from http://www.viaarena.com/downloads/drivers/LAN/velocityget.tgz for myself so I could get a look at it.

dhohimer - What is the URL you got your copy from? Do you get compilation errors like I show below?

Other experts: This tgz can be restored to anywhere (they recommend a tmp directory). In the restored velocityget directory there is a linux.txt file describing how you build this kernel module. The makefile guesses the linux source dir from uname -r. It cd's there to do the build, so you must have run make config or whatever to create config.h there. There is no configure in the restored dir.

Maybe the copy I got was old - make ran straight away but there were errors:

$ make
make -C /lib/modules/2.6.15_1_64/build SUBDIRS=/tmp/velocityget modules
make[1]: Entering directory `/usr/src/linux-2.6.15'
  CC [M]  /tmp/velocityget/velocity_main.o
/tmp/velocityget/velocity_main.c:1760: warning: initialization from incompatible pointer type
/tmp/velocityget/velocity_main.c: In function `velocity_ethtool_ioctl':
/tmp/velocityget/velocity_main.c:2223: error: structure has no member named `slot_name'
/tmp/velocityget/velocity_main.c: In function `velocity_suspend':
/tmp/velocityget/velocity_main.c:2394: error: too many arguments to function `pci_save_state'
/tmp/velocityget/velocity_main.c: In function `velocity_resume':
/tmp/velocityget/velocity_main.c:2430: error: too many arguments to function `pci_restore_state'
make[2]: *** [/tmp/velocityget/velocity_main.o] Error 1
make[1]: *** [_module_/tmp/velocityget] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.15'
make: *** [default] Error 2

Before going further, I'd like to be sure I'm looking at the same code as you have dhohimer - can you confirm URL please?
This worked for a newbie:

http://forums.viaarena.com/messageview.aspx?catid=28&threadid=71022&enterthread=y

duncan_roe,

what is that "incompatible pointer type" above?

Wouldn't it be nice if there were Linux Cross Reference for all software?

One thing to note:

SoundBlaster has taken to stealing Interrupt 10 from the NIC world.  This has lead to many problems with basic network connectivity.  Why couldn't SoundBlaster just stick with Interrupt 5?

Also, most video wants Interrupt 10.  Well, if everybody's on the same Interrupt, something is going to break.  I hate having to manually set the Interrupts for NIC cards just because the sound and video people are not paying attention!

Those will give you headaches for any binary driver and any compile after compilation, if they're stealing Interrupt lines.
Hi GinEric,
I was really hoping for confirmation from dhohimer of the URL he used in case it was more recent than the one I found, but for now I'll assume it wasn't.
The newbie in your URL had Rehhat 9 - that's pretty old (2.4 kernel at a guess - maybe even 2.2). Things have changed at 2.6.15, changed since 2.6.8-1 in fact.
At 2.6.8-1 and before, the prototype of the suspend function in struct pci_driver was:
  int  (*suspend) (struct pci_dev *dev, u32 state);
which agrees with velocityget.tgz.
Now the prototype is:
  int  (*suspend) (struct pci_dev *dev, pm_message_t state);
where pm_message_t is:
  typedef struct pm_message {
        int event;
  } pm_message_t;
so for now the warning can be ignored. That may not last - these comments follow the above typedef:
/*
 * There are 4 important states driver can be in:
 * ON     -- driver is working
 * FREEZE -- stop operations and apply whatever policy is applicable to a
 *           suspended driver of that class, freeze queues for block like IDE
 *           does, drop packets for ethernet, etc... stop DMA engine too etc...
 *           so a consistent image can be saved; but do not power any hardware
 *           down.
 * SUSPEND - like FREEZE, but hardware is doing as much powersaving as
 *           possible. Roughly pci D3.
 *
 * Unfortunately, current drivers only recognize numeric values 0 (ON) and 3
 * (SUSPEND).  We'll need to fix the drivers. So yes, putting 3 to all different
 * defines is intentional, and will go away as soon as drivers are fixed.  Also
 * note that typedef is neccessary, we'll probably want to switch to
 *   typedef struct pm_message_t { int event; int flags; } pm_message_t
 * or something similar soon.
 */

Once i'm sure I have the rigt source, I'll look into the feasability of fixing the errors. Would be nice to get this feedback to the authors of the driver too.
I like how you explain things, very comprehensive duncan_roe.

If I ever get some time around here I'll look at the code.  If the clonecofig worked, that's fine.

autogen is, I think, supposed to do the configure.in or something like that; I haven't had to make a config file lately, so I forget.  Some of the best config files have come from Muquit at muquit.com who wrote one of the first and still the best hit counters there is.  He had an interactive config, some other programs do as well, and it does make things easier the first time you have to compile something.

Whether "int" is integer or "interrupt" is confusing lately.  I've explained elsewhere that an IRQ is stack, not a piece of hardware!  Yet I see this term used all over the place in the wrong context.  I seriously hope someone does not redefine reserved words, like "int" for integer, not knowing that doing so will make the compiler go bananas!  One of the things I've advocated is that since we have scads of memroy now, we can use whole words for defines, um, maybe "integer" for integer and "interrupt" for interrupt and "interrupr_line_number" for the physical interrupt line number.  The case and use of underscore, etc., is governed by other guidelines.  For example, Interrupt_Number might be fine for the Intel compiler abbreviation IN and the like.  Caps and small case have different meanings, in general, in definitions.

It's best to avoid hyphens in all defines because it looks too much like a minus sign.  If you do fing the source, maybe you might want to lxr it.  In linux I can set kwrite to show the line numbers for code, with highlighting; not so in Windows and I use both for everything.  So, if you're writing code, find out about lxr at SourceForge.net or lxr's site.

Pretty sure that "int event" and "int flags" is integer, but I could be wrong here; why not a binary bit in a bit field though where all flags are bits and/or fields of some word or array?

Are you there, dhohimer? Please respond.
This looks to me like a simple case of the driver not being up to date with the latest kernel source. The driver already contains code conditional on linux revision - it now needs more of it.
duncan_roe - I got the driver from the ZyXEL web site, the driver download page  http://us.zyxel.com/web/support_download_list.php?indexflag=20040906164721&ModelIndexflags=0,420050110085119

This was the most up to date driver that I could find.  There is comment in the Linux.txt file referring only to kernels 2.2 & 2.4 so that might be the problem, I'm about to give up, thankfully I only paid $20 for the card.  I received similar errors to the ones listed above, with many others.  

I think you are right about the driver not being up to date with the latest kernel source.
Also duncan_roe, it is listed at ver. 1.29 for the driver, if that helps
GinEric - I can use make to create a ./config file before I compile, if one doesn't exist?  I made the config.h file using make once I found the kernel source files.

I appreciate all the help guys, I have alot to learn
I believe it's automake.  I haven't read the full details in some time, being busy on other large projects, but perhaps a read of autogen will help.  One of them makes config/configure.in and one makes makefile.am, the templates for the ensuing configure and make.  I had this problem with a program perhaps a year ago and had to do all of that.  I tried to document it with all the errors I made somewhere; have to locate that.  In general, I put all my documents on my webserver for quick access.

Good starting point:  http://www.musics.com/manhtml/AutoMake/automake.html     Automake tutorial is here.

All of my work and experiments that I can find:  http://www.Musics.com/manhtml/   Stuff on lots of other things

How to make a configure file:  http://www.Musics.com/manhtml/SlackWare/00.Boss.HowTo.html   well, at least how they say to make one

this part:  autoscan is supposed to create confifgure.in

01.)  autoscan -v
02.)  rename configure.scan to configure.in
03.)  autoconf -v
04.)  try your configure script

Interesting reference to duncan_roe in that write up!  hehe

You'll have to wade through it like I do to get a sense of what to do.  I'm still to busy to edit and organize it all just yet.  But I have relied on duncan_roe's advice in the past, many times.



Guys - this has nothing, absolutely nothing, to do with automake / autoconfig. You cannot create a .configure with make either.
This is actually quite a clever distribution of a driver in source form. Unfortunately, it precedes recent changes in the linux kernel source which make it obsolete, for now.
The URL I found actually provided a more recent version than the ZyXEL web site. Differences include:
- at least *some* mention of 2.6 kernels
- is GPL instead of proprietary licence
- lots of code changes
- internal revision 1.19 instead of 1.16
- ...

The source is Copyright (c) 1996, 2003 VIA Networking Technologies, Inc., and the authors are listed as Chuang Liang-Shing, AJ Jiang.

Even found Chuang's work phone # & email in Google - but then I found out something else thast makes this all rather academic - see next post.
ASKER CERTIFIED SOLUTION
Avatar of Duncan Roe
Duncan Roe
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks duncan_roe, I will try your recommendations tonight.  I'm suprised that the card wasn't recognized by Suse config program yast, and I ran make xconfig and the driver wasn't an option in the networking device listing, but I will try it again.
Found the driver in the kernel configuration, still working out the kinks but I think I got it.  Thanks for all your help!
duncan_roe,

If you fixed that code, you should submit the new version!

nice job