LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Want to compile a driver, but keep having problems (https://www.linuxquestions.org/questions/debian-26/want-to-compile-a-driver-but-keep-having-problems-320868/)

justintime32 05-06-2005 05:44 PM

Want to compile a driver, but keep having problems
 
I keep trying to compile the qc-usb driver for my quick cam web camera. It said all I needed was the kernel source, gcc and v4l. I did the "apt-get install kernel-source-2.6.10" and then extracted the file to "/usr/src/linux-2.6.10" and made a symlink to the "/usr/src/linux". However, it kept getting errors. I figured it was because the source had not been compiled, so I got the kernel-source package from the mepis repositories and copied the files into the kernel source directory, overwriting any same files (and also copied the /boot/config-2.6.10 to /usr/src/linux/.config). That almost worked, but it needed the fixdep program... so I went into that direcotry and compiled it with "gcc fixdep.c". It got past that, but now it needs another file, modpost. I tried compiling that the same way as before, but got an error message saying that I didn't have "elfconfig.h". I suspect these programs will leave if I actually compile the kernel, but the last time I did that it was horrendous... Is there a way I can compile it without installing it to my computer?

I'm using Simply Mepis 3.3 (debian testing/unstable)

rjlee 05-06-2005 05:48 PM

Since you have a 2.6 series kernel, you should be able to compile your kernel to the exact currently running settings. This command should do it (run it from the source directory):
Code:

make mrproper cloneconfig modules all

justintime32 05-06-2005 05:50 PM

Ok, I'll try that.

justintime32 05-06-2005 05:59 PM

I did that and got this output:
Code:

root@5[linux-2.6.10]# make mrproper cloneconfig modules all
make[1]: Nothing to be done for `Makefile'.
  CLEAN  scripts/basic
  CLEAN  .config
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/split-include
  HOSTCC  scripts/basic/docproc
make[2]: *** No rule to make target `cloneconfig'.  Stop.
make[1]: *** [cloneconfig] Error 2
make: *** [cloneconfig] Error 2

:confused:

rjlee 05-06-2005 06:17 PM

Do you have a file /proc/config.gz? If so, run:
Code:

zcat /proc/config.gz > .config && make modules all

justintime32 05-06-2005 06:26 PM

It says "gzcat: command not found"

HappyTux 05-06-2005 06:33 PM

Re: Want to compile a driver, but keep having problems
 
Quote:

Originally posted by justintime32
I keep trying to compile the qc-usb driver for my quick cam web camera. It said all I needed was the kernel source, gcc and v4l. I did the "apt-get install kernel-source-2.6.10" and then extracted the file to "/usr/src/linux-2.6.10" and made a symlink to the "/usr/src/linux". However, it kept getting errors. I figured it was because the source had not been compiled, so I got the kernel-source package from the mepis repositories and copied the files into the kernel source directory, overwriting any same files (and also copied the /boot/config-2.6.10 to /usr/src/linux/.config). That almost worked, but it needed the fixdep program... so I went into that direcotry and compiled it with "gcc fixdep.c". It got past that, but now it needs another file, modpost. I tried compiling that the same way as before, but got an error message saying that I didn't have "elfconfig.h". I suspect these programs will leave if I actually compile the kernel, but the last time I did that it was horrendous... Is there a way I can compile it without installing it to my computer?

I'm using Simply Mepis 3.3 (debian testing/unstable)

Why do you not compile and install the kernel source you have. Just copy the config for the running kernel then.

Code:

fakeroot make-kpkg clean
fakeroot make-kpkg --append-to-version=.050506 kernel_image

Then install the .deb kernel package and reboot then should have no complaints about missing anything from the module compile.

justintime32 05-06-2005 06:41 PM

The last time I did that, there were all sorts of problems. None of the modules would load, including the NVidia one so I didn't have a graphical environment.

I'd like to do what rjlee suggested and compile an exact version of the kernel I'm running, but without installing it.

rjlee 05-07-2005 06:19 PM

Quote:

Originally posted by justintime32
It says "gzcat: command not found"
Sorry! That was a typo; you should use zcat not gzcat. I've edited the post with the correct command-line.

justintime32 05-08-2005 11:30 AM

Code:

zcat: /proc/config.gz: No such file or directory
Will anything else work?

rjlee 05-08-2005 04:44 PM

If you don't have the /proc/config.gz file, then you will need to find a copy of the .config file for your system and copy it to /usr/src/linux.

There might be one on the install disks for your distro; then again, there might not be — in which case you will probably have to recompile your kernel.

You can probably upgrade your kernel to a version that supports /proc/config.gz; in this case the make cloneconfig trick will work.

justintime32 05-09-2005 02:02 PM

Umm... My configuration should be in /boot/config-2.6.10, at least I think.

rjlee 05-09-2005 03:58 PM

OK; do this:
Code:

cp /boot/config-2.6.10 /usr/src/linux
cd /usr/src/linux
make oldconfig modules all

This will give you a compiled (but not installed) kernel matching your current system's settings (or those in /boot/config-2.6.10 at least).

justintime32 05-14-2005 10:15 AM

Code:

make: *** No rule to make target `olddeps'.  Stop.
Would it work if I just typed in "make"?

rjlee 05-14-2005 03:44 PM

Sorry; that was a typo (fixed now in above post); you could probably have figured this out from the README.

Running “make” will only compile the kernel image; it won't set up dependencies, which is the most important step here. It also won't make modules IIRC.


All times are GMT -5. The time now is 04:37 AM.