Re: Kernel build system broken in 5.8?

From: Randy Dunlap
Date: Tue Aug 18 2020 - 12:20:34 EST


[adding kbuild list and maintainer]

On 8/18/20 9:09 AM, Martin Burnicki wrote:
> Hi,
>
> I'm the maintainer of a driver package for some PCI cards (GPS receiver
> cards, etc.). A read-only git repo of the driver package can be found here:
> https://git.meinbergglobal.com/mbgtools-lx.git
>
> The kernel driver from that package is compiled as out-of-tree module,
> and runs fine on kernels 2.6, 3.x, 4.x, and 5.x up to 5.7, actually
> 5.7.15 on Ubuntu.
>
> However, if I try this on kernel 5.8.1, I get strange errors related to
> autoconf.h, which make it impossible to compile or install the kernel
> module.
>
> I usually build the kernel module as standard user, and only install the
> new module as root, e.g.:
>
> git checkout devel # The 'devel' branch is appropriate for testing
> cd mbgclock # the subdirectory of the kernel module
> git clean -fd; make # or make V=1 for verbose output
> sudo make install
>
> Also, I was under the impression that the kernel source tree should be
> read-only, and kept clean, but this doesn't seem to be the case anymore.
>
>
> For example:
>
> On Ubuntu 19.10 with kernel 5.8.1-050801-generic from
> https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.8.1/
>
> 'make' completes without error, even if run as normal user without write
> permissions in the kernel source tree.
>
> 'sudo insmod ./mbgclock.ko' loads the module successfully, and the PCI
> card can be accessed as usually, e.g. using the 'mbgstatus' program, so
> the compiled kernel module is OK.
>
> BUT: Once I run 'sudo make install', which calls the kernel build system
> to make 'modules_install', I immediately get an error:
>
> -------------------------------------------------------------------------
> Calling kernel build system to make "modules_install"
> make[1]: Entering directory '/usr/src/linux-headers-5.8.1-050801-generic'
>
> ERROR: Kernel configuration is invalid.
> include/generated/autoconf.h or include/config/auto.conf are
> missing.
> Run 'make oldconfig && make prepare' on kernel src to fix it.
>
> make[1]: *** [Makefile:719: include/config/auto.conf] Error 1
> make[1]: Leaving directory '/usr/src/linux-headers-5.8.1-050801-generic'
> make: *** [/home/martin/projects/mbgtools-lx/mbgclock/../Makefile:834:
> install_module] Error 2
> -------------------------------------------------------------------------
>
> And once this has happened, this problem persists, i.e., if I run the
> same commands
>
> git clean -fd; make
>
> once more, as normal user as mentioned above, I get the error above
> every time.
>
> Also, If I initially try to build the kernel kernel module as root, with
> 'sudo':
>
> git clean -fd; sudo make
>
> I immediately get this error, and the module is not built. Only after I
> have re-installed the kernel headers package, I can compile the module
> again.
>
>
> A diff between the kernel header files before and after the kernel build
> system has been messed up shows that the following files have changed:
>
> include/generated/autoconf.h
> scripts/basic/.fixdep.cmd
> scripts/basic/fixdep
> scripts/kconfig/.conf.o.cmd
> scripts/kconfig/.confdata.o.cmd
> scripts/kconfig/.expr.o.cmd
> scripts/kconfig/.lexer.lex.c.cmd
> scripts/kconfig/conf.o
> scripts/kconfig/confdata.o
> scripts/kconfig/expr.o
> scripts/kconfig/lexer.lex.c
> scripts/kconfig/parser.tab.c
>
> Specifically, autoconf.h has been deleted even though some script
> obviously still requires that the file is available.
>
>
> With openSUSE Leap 15.2 and kernel 5.8.1 from
> https://download.opensuse.org/repositories/Kernel:/stable/standard/
>
> I've encountered similar problems because include/generated/autoconf.h
> is not even available after installation of the kernel headers package.
>
> Only on Arch Linux with kernel 5.8.1-arch1-1 I can build and install the
> module as root or standard user, as it was possible with earlier kernel
> versions.
>
> Can someone please shed some light on what's going on here?
>
>
> Thanks,
>
> Martin
>


--
~Randy
Reported-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>