Hello Masahiro and Kbuild ML, Recently we added out-of-tree module building on kselftests for the livepatch selftests. Everything worked as expected, but kernel test robot complained about it[1]. So far, all our tests were being done targeting different options for kselftests, but we didn't test using the O= option. The interesting part of it is that this can be easily reproducible with any out-of-tree module building even on current upstream, like the code below: $ uname -r 6.8.0-rc4+ $ make make -C /lib/modules/6.8.0-rc4+/build M=/home/mpdesouza/test-oot modules make[1]: Entering directory '/home/mpdesouza/git/linux' CC [M] /home/mpdesouza/test-oot/patch_1.o MODPOST /home/mpdesouza/test-oot/Module.symvers CC [M] /home/mpdesouza/test-oot/patch_1.mod.o LD [M] /home/mpdesouza/test-oot/patch_1.ko BTF [M] /home/mpdesouza/test-oot/patch_1.ko make[1]: Leaving directory '/home/mpdesouza/git/linux' But it fails when using O= argument: $ make O=/tmp/kout make -C /lib/modules/6.8.0-rc4+/build M=/home/mpdesouza/test-oot modules make[1]: Entering directory '/home/mpdesouza/git/linux' make[2]: Entering directory '/tmp/kout' /home/mpdesouza/git/linux/Makefile:733: include/config/auto.conf: No such file or directory make[2]: *** [/home/mpdesouza/git/linux/Makefile:240: __sub-make] Error 2 make[2]: Leaving directory '/tmp/kout' make[1]: *** [Makefile:240: __sub-make] Error 2 make[1]: Leaving directory '/home/mpdesouza/git/linux' make: *** [Makefile:6: all] Error 2 As I already described on [2], the O= argument (or KBUILD_OUTPUT) makes the kernel to jump into the directory specified on the variabled, but running the Makefile on /lib/modules/6.8.0-rc4+/build. The problem is thattoplevel Makefile on /lib/modules/.../build includes files using relative paths. In this case, the makefile tries to find include/config/auto.conf on /tmp/kout, which obviously doesn't exists. Do you think this can be a bug on Kbuild? Should we ignore O= when building out-of-tree modules? Also, as noted[3] by Petr Mladek (CCed here as well), kernel-devel doesn't include auto.conf, so maybe kernel-devel should be patched as well? Thanks in advance, Marcos [1]: https://lore.kernel.org/oe-kbuild-all/202401300736.GkSZoSrA-lkp@xxxxxxxxx/ [2]: https://lore.kernel.org/oe-kbuild-all/fd027fa958a0bc65285a0c6c42e5921e7d28b0ad.camel@xxxxxxxx/ [3]: https://lore.kernel.org/oe-kbuild-all/ZbpnBqHUl3pE_3Te@alley/