Rebuilding a kernel for a new driver

Associate
Joined
1 Aug 2003
Posts
1,053
I'm currently running CentOS 5.2

cat /proc/version gives:

Linux version 2.6.18-92.el5 ([email protected]) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Tue Jun 10 18:49:47 EDT 2008

I want to install and use a Connexant ADSL adapter (or modem as people seem to insist on calling them). I have found a driver that claims to support kernels of ≥ 2.6.27 but I am having problems. Its make process requires that I have the kernel sources unpacked and configured in /usr/src/linux

I downloaded linux-2.6.27.31.bz2 from kernel.com and ran bzip2 -d then tar -fx and put all the files into a /usr/src/linux folder. From here, I'm a little stuck. I was under the impression that I merely had to run 'make config' but this does not work. Please could someone point out where I have managed to go so terribly wrong so early.

Ta!
 
Easiest way to do it:

1) Download source
2) unzip source to /usr/src/linux2.whatever
3) create symlink called linux --> /usr/src/linux2.whatever
4) copy current kernel .config from /proc (zcat /proc/config.gz > .config)
5) make clean
6) make oldconfig
7) make menuconfig (here you get to configure your options - don't mess around too much unless you know what you're doing - but hey, you're compiling your own kernel, you might as well at least have it compiled for your specific processor. You might want to set the timer resolution to something a lot less generic as well)
8) make -jx && make modules && make modules install (where x = cores+1)
9) cp system.map /boot/
10) cp arch/&YOUR_ARCH/bzImage /boot/vmlinuz (doesn't have to be called vmlinuz, btw)
11) edit menu.lst to reflect your new kernel
12) reboot
 
Right - falling fairly early on I'm afraid.

There is no file in proc called config.gz, I wasn't totally sure what you were suggesting here. You seemed to be invoking zcat to decompress a file in proc - sorry if this makes me sound stupid but it's best to be honest with these things.

Beyond that, I think I need to install a bunch of stuff as I'm being told by bash that it doesn't understand make commands (something to do with gcc apparently).

Thanks
 
As an update, I ran the following:

yum groupinstall "Development Tools"
yum install ncurses-devel

As I thought that these would be necessary. The drivers I'm trying to install are located here:

http://www.zweije.nl.eu.org/~vzweije/accessrunner/release/CnxADSL-6.1.2.007-PIM-2.6-2.1.tar.bz2

The instructions read that I have to unpack the kernel to /usr/src/linux and that it be configured and compiled. Well... I have unpacked (tar and bz2) the kernel to /usr/src/linux but beyond that I am lost. After unpacking, I ran make menuconfig and got:

HOSTCC scripts/basic/fixdep
/bin/sh: gcc: command not found
make[1]: *** [scripts/basic/fixdep] Error 127
make: *** [scripts_basic] Error 2

Hope this clarifies the matter :)
 
There is no file in proc called config.gz, I wasn't totally sure what you were suggesting here. You seemed to be invoking zcat to decompress a file in proc - sorry if this makes me sound stupid but it's best to be honest with these things.

ok - the zcat line looks in /proc for a gzipped version of the kernel config - this is very often enabled in the kernel config by distros, but not enabled by default so all we were doing was reading the zgipped content and dropping it into a new file called .config. This would give us a good starting point to compile a working kernel for your box, as it would give us all the modules and config of the currently running kernel. CentOS/RHEL doesn't seem to do this though, so you might need to look a bit harder.

If you extracted the new kernel sources straight to /usr/src/linux - you may very well have overwritten the existing sources (and subsequently dirtied the new ones), so - you'll need to find out if /usr/src is currently a symlink - it should be
Code:
 $ ls -l /usr/src/linux
lrwxrwxrwx 1 root root 27 2009-09-09 09:10 /usr/src/linux -> /usr/src/linux-2.6.29-SABAYON/
Shows that it's a symlink to /usr/src/linux-2.6.29-SABAYON. If this is the case, then
Code:
# rm /usr/src/linux
# tar zxvf linux-2.6.30-3.gz
# ln -s /usr/src/linux-2.6.30-3 /usr/src/linux
now we need to find a .config to start from... Debian based distros also don't use /proc/config.gz, but instead install the kernel config into /boot (can't remember what the name of the file is, but it won't be very large and I imagine thast it will have the kernel version in the name if it is there... if not, you can either google for the kernel config file yourself or you can start from fresh - but if this is your first time, don't expect the kernel to boot first time!

Anyway...

HOSTCC scripts/basic/fixdep
/bin/sh: gcc: command not found
make[1]: *** [scripts/basic/fixdep] Error 127
make: *** [scripts_basic] Error 2

Code:
# yum install gcc 
# cd /usr/src/linux
# make mrproper  <<<cleans the sources properly - don't assume that the sources you have downloaded are clean by default >>>
<<<< copy your kernel config to /usr/src/linux/.config >>>
# make oldconfig
# make..... blah, blah, blah

Now - I haven't had a look at the details of the kernel module (driver) that you're trying to add, but I suspect that you'll need to do something along the lines of this once you've booted your new kernel - so don't forget to *update* menu.lst or grub.conf:

Code:
$ tar xvf $kernel_module.bz2
$ cd $kernel_module
$ ./configure
$ make
# make install

OR...

You masy need to create a Makefile in the unpacked directory if it doesn't exist (note the capital M) with
Code:
obj-m := [b]$YOUR_MODULE_OBJECT.o[/b]
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
Replace $YOUR_MODULE_OBJECT.o with the real name of the file ;)

Code:
$ make -C /lib/modules/$(uname -r)/build M=$(pwd) modules
# cp k10temp.ko /lib/modules/$(uname -r)/kernel/drivers/hwmon
# depmod && modprobe $YOUR_NEW_KERNEL_MODULE    <<<< this will likely be the object name without the .o
 
If you extracted the new kernel sources straight to /usr/src/linux - you may very well have overwritten the existing sources (and subsequently dirtied the new ones), so - you'll need to find out if /usr/src is currently a symlink - it should be

I created the folder /usr/src/linux (am I the only one who keeps absent mindedly jabbing the tab key while typing these things...?) so certainly didn't overwrite anything. As for everything else, I'll get to that and let you know how I get on.
 
btw - it might be a good idea to enable zgipped config in proc for future can't remember exactly where it is in mneuconfig... somewhere at the bottom of one of the first few menus!), and to set your actual architecture rather than generic i386.
 
Right - I seem to be getting somewhere.

I had to yum a bunch of things before it would allow me to make, but it was eventually happy with them. I am now waiting for the kernel to recompile.

On another note, I think it is a point that many have made before me but surely this has to be the most obtuse way to install drivers imaginable. For all the faults of Windows, if you need a driver you just slap it on and go. While there are many advantages to Linux, the disadvantages are that it seems to delight in making me cry like a little girl.
 
Right, now I seem to be getting somewhere else. Following the directions of the man who wrote the driver package (I felt this best since he clearly knew what he was doing far more than I) after sorting out what I wanted in my kernel I then was supposed to run make in the folder containing the driver package and it produced this rather lovely stream for me:

bashprompt# make
for n in KernelModule/DpController; \
do if [ -d $n ]; then make -C $n all || exit; fi; done
for n in KernelModule DownLoadApp; do make -C $n all || exit; done
make[1]: Entering directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make CnxADSL.ko
make[2]: Entering directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make -C /usr/src/linux SUBDIRS=`pwd` modules
make[3]: Entering directory `/usr/src/linux'
CC [M] /root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/ARMAbstract.o
In file included from /root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/LnxTools.h:44,
from /root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/ARMAbstract.c:34:
/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/Version.h:66:2: error: #error "CONFIG_ATM not defined, you can't use this driver without it"
/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/Version.h:78:2: error: #error "CONFIG_PPPOATM not defined, you can't use this driver without it"
make[4]: *** [/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/ARMAbstract.o] Error 1
make[3]: *** [_module_/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule] Error 2
make[3]: Leaving directory `/usr/src/linux'
make[2]: *** [CnxADSL.ko] Error 2
make[2]: Leaving directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make: *** [all] Error 2

Any advice?

I rather foolishly (as I wanted to see what it would do) ran the make config routine and installed the new kernel before adding the driver. This was partially to check that it all worked fine without so that if anything did go wrong, it would narrow it down to the driver.

Clearly I'm missing pppd with the PPPoATM plugin but any ideas as to how to proceed?
 
Last edited:
On another note, I think it is a point that many have made before me but surely this has to be the most obtuse way to install drivers imaginable. For all the faults of Windows, if you need a driver you just slap it on and go. While there are many advantages to Linux, the disadvantages are that it seems to delight in making me cry like a little girl.

Yeah -but the Windows kernel is the same every time, isn't it? The only reason you're doing this is because your kernel isn't new enough to support the driver, right? more often than not, you can compile kernel modules on the fly and add them to your system (without the reboot that Windows almost always needs)

Any advice?

You haven't defined certain config options that are required. use make oldconfig - that should read all the new parameters and assign some values into .config.
 
Last edited:
I ran make oldconfig but still got

make
for n in KernelModule/DpController; \
do if [ -d $n ]; then make -C $n all || exit; fi; done
for n in KernelModule DownLoadApp; do make -C $n all || exit; done
make[1]: Entering directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make CnxADSL.ko
make[2]: Entering directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make -C /usr/src/linux SUBDIRS=`pwd` modules
make[3]: Entering directory `/usr/src/linux'
CC [M] /root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/ARMAbstract.o
In file included from /root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/LnxTools.h:44,
from /root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/ARMAbstract.c:34:
/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/Version.h:66:2: error: #error "CONFIG_ATM not defined, you can't use this driver without it"
/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/Version.h:78:2: error: #error "CONFIG_PPPOATM not defined, you can't use this driver without it"
make[4]: *** [/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/ARMAbstract.o] Error 1
make[3]: *** [_module_/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule] Error 2
make[3]: Leaving directory `/usr/src/linux'
make[2]: *** [CnxADSL.ko] Error 2
make[2]: Leaving directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make: *** [all] Error 2

I thought I'd made PPPoATM on the kernel but it doesn't seem to have helped
 
I'll try to run through this a bit later on a vm and get back to you. :)

EDIT: you could just "cheat" and fix the .config file by hand.. e.g. file the lines mentioned and modify them (making sure you comment out the line that says "no")

EDIT2: What's the output of this?
Code:
$ cd /usr/src/linux && cat .config | grep ATM
?
 
Last edited:
I ran make oldconfig but still got

make
for n in KernelModule/DpController; \
do if [ -d $n ]; then make -C $n all || exit; fi; done
for n in KernelModule DownLoadApp; do make -C $n all || exit; done
make[1]: Entering directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make CnxADSL.ko
make[2]: Entering directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make -C /usr/src/linux SUBDIRS=`pwd` modules
make[3]: Entering directory `/usr/src/linux'
CC [M] /root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/ARMAbstract.o
In file included from /root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/LnxTools.h:44,
from /root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/ARMAbstract.c:34:
/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/Version.h:66:2: error: #error "CONFIG_ATM not defined, you can't use this driver without it"
/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/Version.h:78:2: error: #error "CONFIG_PPPOATM not defined, you can't use this driver without it"
make[4]: *** [/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule/ARMAbstract.o] Error 1
make[3]: *** [_module_/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule] Error 2
make[3]: Leaving directory `/usr/src/linux'
make[2]: *** [CnxADSL.ko] Error 2
make[2]: Leaving directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/root/CnxADSL-6.1.2.007-PIM-2.6-2.1/KernelModule'
make: *** [all] Error 2

I thought I'd made PPPoATM on the kernel but it doesn't seem to have helped

Since CONFIG_ATM is not defined, you probably have not selected ATM networking. Run "make menuconfig" and select ATM networking, and select PPP over ATM after that as well. Then try again.

By the way, if you're trying linux-2.6.30 it might not work in the end. Try linux-2.6.29 first. I'm still finding out what's wrong with 2.6.30 (hangs on insmod).
 
Since CONFIG_ATM is not defined, you probably have not selected ATM networking. Run "make menuconfig" and select ATM networking, and select PPP over ATM after that as well. Then try again.

By the way, if you're trying linux-2.6.30 it might not work in the end. Try linux-2.6.29 first. I'm still finding out what's wrong with 2.6.30 (hangs on insmod).
The problem has been fixed. The AccessRunner driver now works with linux-2.6.30. Go get version 2.2.
 
Back
Top Bottom