Bug#720682: does only build for running kernel

Marc Haber mh+debian-packages at zugschlus.de
Sat Aug 24 09:32:34 UTC 2013


Package: bbswitch-source
Version: 0.7-2
Severity: important

Hi,

the Makefile in the unpacked kernel sets its KVERSION variable to
uname -r, which makes the build fail for any kernel version unequal
the running kernel.

This kind of defeats the purpose of having a -source package which
should allow modules to be built before the kernel has been booted yet.

Please take precautions to allow building the bbswitch kernel module
for a kernel that is not the one running currently:

[30/527]mh at fan[chroot kernel32]:~/m-a/user/usr_src/modules/bbswitch$ uname -a
Linux fan 3.10.5-zgws1 #2 SMP Mon Aug 5 15:05:39 UTC 2013 i686 GNU/Linux
[31/528]mh at fan[chroot kernel32]:~/m-a/user/usr_src/modules/bbswitch$ fakeroot debian/rules kdist_clean
for templ in ; do \
    cp $templ `echo $templ | sed -e 's/_KVERS_/unknown/g'` ; \
  done
for templ in `ls debian/*.modules.in` ; do \
    test -e ${templ%.modules.in}.backup || cp ${templ%.modules.in} ${templ%.modules.in}.backup 2>/dev/null || true; \
    sed -e 's/##KVERS##/unknown/g ;s/#KVERS#/unknown/g ; s/_KVERS_/unknown/g ; s/##KDREV##//g ; s/#KDREV#//g ; s/_KDREV_//g  ' < $templ > ${templ%.modules.in}; \
  done
dh_clean
/usr/bin/make clean KBUILD=/usr/src/linux KVERS=unknown
make[1]: Entering directory `/home/mh/m-a/user/usr_src/modules/bbswitch'
/usr/bin/make O="$(pwd)" -C /lib/modules/3.10.5-zgws1/build M="$(pwd)" clean
make: Entering an unknown directory
make: *** /lib/modules/3.10.5-zgws1/build: No such file or directory.  Stop.
make: Leaving an unknown directory
make[1]: *** [clean] Error 2
make[1]: Leaving directory `/home/mh/m-a/user/usr_src/modules/bbswitch'
make: *** [kdist_clean] Error 2
[32/529]mh at fan[chroot kernel32]:~/m-a/user/usr_src/modules/bbswitch$

This call is happens in a chroot where no kernel is actually
installed. Therefore, there is no /lib/modules/ at all. Building a
kernel module should not require a kernel to be present in the build
environment. We might be building for another system.

[38/535]mh at fan[chroot kernel32]:~/linux/3.10.9/linux-3.10.9$ m-a --non-inter --userdir $HOME/m-a/user --text-mode --kernel-dir $(pwd) build bbswitch
Removing old /home/mh/m-a/user/usr_src/modules/bbswitch/ tree
Extracting the package tarball, /usr/src/bbswitch.tar.bz2, please wait...
for templ in ; do \
    cp $templ `echo $templ | sed -e 's/_KVERS_/3.10.9-zgws1/g'` ; \
  done
for templ in `ls debian/*.modules.in` ; do \
    test -e ${templ%.modules.in}.backup || cp ${templ%.modules.in} ${templ%.modules.in}.backup 2>/dev/null || true; \
    sed -e 's/##KVERS##/3.10.9-zgws1/g ;s/#KVERS#/3.10.9-zgws1/g ; s/_KVERS_/3.10.9-zgws1/g ; s/##KDREV##/3.10.9.20130824.0/g ; s/#KDREV#/3.10.9.20130824.0/g ; s/_KDREV_/3.10.9.20130824.0/g  ' < $templ > ${templ%.modules.in}; \
  done
dh_clean
/usr/bin/make clean KBUILD=/home/mh/linux/3.10.9/linux-3.10.9 KVERS=3.10.9-zgws1
make[1]: Entering directory `/home/mh/m-a/user/usr_src/modules/bbswitch'
/usr/bin/make O="$(pwd)" -C /lib/modules/3.10.5-zgws1/build M="$(pwd)" clean
make: *** /lib/modules/3.10.5-zgws1/build: No such file or directory.  Stop.
make: Entering an unknown directory
make: Leaving an unknown directory
make[1]: *** [clean] Error 2
make[1]: Leaving directory `/home/mh/m-a/user/usr_src/modules/bbswitch'
make: *** [kdist_clean] Error 2
/usr/bin/make  -f debian/rules kdist_clean kdist_config binary-modules
make[1]: Entering directory `/home/mh/m-a/user/usr_src/modules/bbswitch'
for templ in ; do \
    cp $templ `echo $templ | sed -e 's/_KVERS_/3.10.9-zgws1/g'` ; \
  done
for templ in `ls debian/*.modules.in` ; do \
    test -e ${templ%.modules.in}.backup || cp ${templ%.modules.in} ${templ%.modules.in}.backup 2>/dev/null || true; \
    sed -e 's/##KVERS##/3.10.9-zgws1/g ;s/#KVERS#/3.10.9-zgws1/g ; s/_KVERS_/3.10.9-zgws1/g ; s/##KDREV##/3.10.9.20130824.0/g ; s/#KDREV#/3.10.9.20130824.0/g ; s/_KDREV_/3.10.9.20130824.0/g  ' < $templ > ${templ%.modules.in}; \
  done
dh_clean
/usr/bin/make clean KBUILD=/home/mh/linux/3.10.9/linux-3.10.9 KVERS=3.10.9-zgws1
make[2]: Entering directory `/home/mh/m-a/user/usr_src/modules/bbswitch'
/usr/bin/make O="$(pwd)" -C /lib/modules/3.10.5-zgws1/build M="$(pwd)" clean
make: Entering an unknown directory
make: *** /lib/modules/3.10.5-zgws1/build: No such file or directory.  Stop.
make: Leaving an unknown directory
make[2]: *** [clean] Error 2
make[2]: Leaving directory `/home/mh/m-a/user/usr_src/modules/bbswitch'
make[1]: *** [kdist_clean] Error 2
make[1]: Leaving directory `/home/mh/m-a/user/usr_src/modules/bbswitch'
make: *** [kdist_build] Error 2
BUILD FAILED!
See /home/mh/m-a/user/var_cache_modass/bbswitch-source.buildlog.3.10.9-zgws1.1377336334 for details.
[39/536]mh at fan[chroot kernel32]:~/linux/3.10.9/linux-3.10.9$

Please note that this build attempt clearly specified that we were
building for Linux 3.10.9. The code still wants to peddle around in
/lib/modules/3.10.5.

At a second look to the upstream Makefile, one sees that it make
install will install to /lib/modules/$(KVERSION), hardcoded. Has this
ever been actually tested for building of Debian packages? If so, how
was it tested?

Greetings
Marc

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.10.5-zgws1 (SMP w/6 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash



More information about the pkg-nvidia-devel mailing list