Turns out, two important things have changed.
- A directory previously called driver is now called drivers
- The Makefile newly (and correctly) delegates the installation of the modules to the kernel build system, KBUILD
$(MAKE) -C $(LINUX_SRCDIR) V=1 modules_install CC="$(LINUX_CC) \
-I/usr/src/packages/BUILD/linux-gpib-3.2.09/drivers/.. \
-I/usr/src/packages/BUILD/linux-gpib-3.2.09/drivers/../driver/include \
-I/usr/src/packages/BUILD/linux-gpib-3.2.09/drivers/../include" \
SUBDIRS="$(GPIB_ABS_MODULE_SUBDIR)" INSTALL_MOD_DIR="gpib"
but this means that the RPM fails to build because KBUILD tries (as a non-root user) to install the kernel modules under the absolute path /lib/modules/2.6.13-15.15-default/gpib. What we need is to get the modules installed under the RPM build root, but there seems to be no way to tell KBUILD to install modules somewhere else other than under /lib/modules/. KBUILD's output path variable O has no effect on this, it seems. Finally, in the %prep section of the spec file I introduce a module_prefix variable in front of the INSTALL_MOD_DIR path thus:
sed -i '/INSTALL_MOD_DIR="gpib"/s/gpib/$(module_prefix)gpib/'
drivers/Makefile.in
and then override this during %install thus:
make module_prefix=../../../$RPM_BUILD_ROOT/lib/modules/%{kernel}/ install
so that the final directory to which the module is copied is, in full
/lib/modules/2.6.13-15.15-default/../../../var/tmp/linux-gpib-3.2.09/lib/modules/2.6.13-15.15-default/gpib
And that works. Phew!