Mandrake 9.0 compile error: `CONFIG_X86_L1_CACHE_SHIFT' undeclared here (not in a function)

Dateline: 2003-09-02 04:24 ET

I happened upon this error tonight trying to install drivers for the Broadcom BCM5702 chipset under Mandrake 9.0 on an ASUS P4PE motherboard (giving google lots of juice, here!). This probably also applies to Mandrake 9.1 and anything else in the 9.x series (if there is anything else in the 9.x series, which I wouldn't know, since this is what shipped with this machine's original drives).

While I'm bumping up the google juice here, I'll mention that the drivers for the Broadcom BCM5702 chipset are available on the CD that ships with the motherboard, under /Drivers/Lan/5702/Linux/Driver, along with instructions in the RELEASE.TXT file in that directory.

And now, to the point... Mandrake, as shipped, will barf all over you when you try to build any kernel module or kernel dependant piece, even if you have the kernel "development" stuff (headers, -source RPM, etc.) installed. The fix for this follows.

First, make sure you have the following "kernel development" RPMs installed:

Huh? Oh, the kernels are in that list because you kinda need a kernel to do kernel development... You only need the one you're actually running, but it's a pretty good bet you have the one you're running if you're running it. Yeah. There are more than just the two listed here (e.g., secure, smp, etc.) Make sure you're aware of which one you're running. If you don't know, use:

uname -r

to find out. I'm not entirely sure that you need kernel-headers, and the fact that it lags a minor revision number behind the rest of the kernel bits suggests that it's just there for legacy code, but best to have it installed just in case. I haven't tried this without it.

And now, to the part you really give a rat's rear about: making compilation work. Presumably, you came to this page because you searched for the error message below:

`CONFIG_X86_L1_CACHE_SHIFT' undeclared here (not in a function)
/usr/include/asm/processor.h:55: requested alignment is not a constant
	

Since you've searched for that error message, you've probably also discovered the million and one posts related to nVidia drivers and Aureal drivers and Netgear drivers and everything else and... nobody seems to have the answer. Well, tada!. I have the answer. And if you Paypal me five bucks, I'll gladly link you to it, right now!

Just kidding. Damn, but that would be sweet, wouldn't it? I know I'd have Paypal'ed someone five bucks an hour ago to have gotten this whacked.

Sorry, I'm getting distracted. It's 04:36 here, and I'm a little fried from getting this system up.

Alright, then, the magic is really simple: your sources and development tools are installed, but they're not primed. That is to say, the config files aren't propagated around, the dependancies aren't generated, and the various header files and symlinks haven't been put in the right places based on your target architecture and config settings.

All you have to do to get that stuff working is this (assuming everything's where Mandrake puts it, and you haven't gone and dinked with it. If you've dinked with it, un-dink it.):

cd /usr/src/linux
cp arch/config/i386/defconfig-enterprise .config
make oldconfig
make dep
	

Voila! It's done. Go back to following your device driver's installation instructions and type make or rpm -bb SPECS/foo.spec or whatever mojo they recommend. Mandrake's kernel installation will no longer be the thing that stops you.

Note: in the example above, the line in which you copy the default config (defconfig-enterprise in the example) to the active .config file should be customized to reflect which kernel configuration you're running. So if, for instance, you're running 2.4.19-16mdk, you'd copy defconfig, and if you're running 2.4.19-16mdksecure, you'd copy defconfig-secure, and so on. If you don't pay attention to this particular "trivial" detail, I guarantee you your driver compile will get hosed and you will bring the crashing thunder of a broken driver down on yourself.

When you've managed to successfully compile your driver, your vendor's installation instructions may or may not include instructions on where to put the driver. The general form is that the module will go under /lib/modules/`uname -r`/kernel, but the specific location thereunder may vary depending on your distribution, kernel revision, driver, etc.

Make sure to add your driver module to /lib/modules/`uname -r`/modules.description and run /sbin/depmod -a to rebuild modules.dep and modules.*map and so on if your driver's installation scripts or instructions don't.


Tripp Lilley, Technologist at Large