Cp: cannot stat './modules.order': No such file or directory


I’m trying to install a single kernel module outside of the default /lib/modules.

I’m running:

make O=/home/bsg/kernel-build-artifacts LOCALVERSION=-tegra INSTALL_MOD_PATH=/home/bsg/kernel/dist modules_install

and I’m getting this error:

make[1]: Entering directory '/home/bsg/kernel-build-artifacts'
cp: cannot stat './modules.order': No such file or directory
/home/bsg/kernel/source/public/kernel/kernel-4.9/Makefile:1372: recipe for target '_modinst_' failed
make[1]: *** [_modinst_] Error 1
make[1]: Leaving directory '/home/bsg/kernel-build-artifacts'
Makefile:171: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

This is my procedure leading up to it to build a single kernel module:

make O=/home/bsg/kernel-build-artifacts LOCALVERSION=-tegra -j4 modules.builtin
make O=/home/bsg/kernel-build-artifacts LOCALVERSION=-tegra -j4 modules_prepare
make O=/home/bsg/kernel-build-artifacts LOCALVERSION=-tegra -j4 --output-sync=target M=drivers/media/i2c modules
make[1]: Entering directory '/home/bsg/kernel-build-artifacts'

  WARNING: Symbol version dump ./Module.symvers
           is missing; modules will have no dependencies and modversions.

make[1]: Leaving directory '/home/bsg/kernel-build-artifacts'
  CC [M]  drivers/media/i2c/tc358743.o
make[1]: Entering directory '/home/bsg/kernel-build-artifacts'
  Building modules, stage 2.
make[1]: Leaving directory '/home/bsg/kernel-build-artifacts'
  MODPOST 1 modules
  CC      drivers/media/i2c/tc358743.mod.o
  LD [M]  drivers/media/i2c/tc358743.ko

It looks like it’s missing modules.order file in the build directory. I tried looking for a make command in the Makefile that would generate this file but couldn’t find it.

How can I generated the modules.order without having to run make modules to build all?


hello JamieBasil,

please see this session, Building External Kernel Modules.