March 2010
The file hxge-1.2.2_rhel53-1.src.rpm
was sent to me and seems to contain the source for a Linux driver for a fast NIC.
I unpack it, using a fixed cpio (see :
rpm2cpio hxge-1.2.2_rhel53-1.src.rpm |cpio -idmv
This gives us two files:
-rw----r-- 1 jurjen jurjen 3579 2009-05-04 17:05 hxge.spec
-rw-r--r-- 1 jurjen jurjen 138508 2009-05-04 17:05 hxge-1.2.2.tgz
The spec
file indicates that we have got sources for a kernel module here.
From the .spec
file, we can derive a script that will try tom compile the module for the kernels installed on the local machine:
#!/bin/bash BUILDROOT=$(pwd)/build KERNEL_VER='2.6.18-4*' rm -rf ${BUILDROOT} mkdir -p ${BUILDROOT} for i in `find /lib/modules/ -maxdepth 1 -name "$KERNEL_VER" -not -name "*xen*"`; do if [ -e $i/build ]; then mkdir -p ${BUILDROOT}/$i kernel=`basename ${i}`; cp -a src ${BUILDROOT}/${i} make -C ${i}/build/ M=${BUILDROOT}/$i/src/ modules; fi; done;
...executing which gives:
sudo ./build.sh
make: Entering directory `/usr/src/linux-headers-2.6.18-4-amd64'
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_other.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_ethtool.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_main.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_stats.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_vmac.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_param.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_pfc.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_txdma.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_rxdma.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge_intr.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hpi/hpi.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hpi/hpi_rxdma.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hpi/hpi_txdma.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hpi/hpi_pfc.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hpi/hpi_vir.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hpi/hpi_vmac.o
LD [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge.o
Building modules, stage 2.
MODPOST
CC /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge.mod.o
LD [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.18-4-amd64/src/hxge.ko
make: Leaving directory `/usr/src/linux-headers-2.6.18-4-amd64'
However, if we redefine $KERNEL_VER
to match 2.6.26 kernels in build.sh
, we run into trouble:
tar zxf hxge-1.2.2.tgz
sudo ./build.sh
make: Entering directory `/usr/src/linux-headers-2.6.26-2-amd64'
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_other.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_ethtool.o
CC [M] /home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_main.o
/home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_main.c: In function ‘hxge_probe’:
/home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_main.c:506: error: implicit declaration of function ‘SET_MODULE_OWNER’
/home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_main.c:598:45: error: macro "INIT_WORK" passed 3 arguments, but takes just 2
/home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_main.c:597: error: ‘INIT_WORK’ undeclared (first use in this function)
/home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_main.c:597: error: (Each undeclared identifier is reported only once
/home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_main.c:597: error: for each function it appears in.)
make[1]: *** [/home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src/hxge_main.o] Error 1
make: *** [_module_/home/jurjen/tmp/hydra/build//lib/modules/2.6.26-2-amd64/src] Error 2
make: Leaving directory `/usr/src/linux-headers-2.6.26-2-amd64'
We apparently have an undefined SET_MODULE_OWNER (rather old doc), in the 2.6.26-2 kernel:
grep -ri SET_MODULE_OWNER /lib/modules/2.6.26-2-amd64/build/*
grep: /lib/modules/2.6.26-2-amd64/build/virt: No such file or directory
grep -ri SET_MODULE_OWNER /lib/modules/2.6.18-4-amd64/build/*
/lib/modules/2.6.18-4-amd64/build/include/linux/netdevice.h:#define SET_MODULE_OWNER(dev) do { } while (0)
As you can see, the 2.6.18-4 kernel still has the macro but the 2.6.26-2 doesn't. I thought this thread was fairly old. Apparently something has precipitated from it six years later: