2

I want to install the kernel modules to lib/modules/ . Actually there has to be created a folder in lib/modules/(uname-r) after doing make modules , but there are only created 3 folders called "build", "kernel" and "source". I also get an error after make modules:

DEPMOD 3.4.79
WARNING: COULDN't open directory /lib/modules/3.4.79: No such file or direcoty
FATAL: Could not open /lib/modules/3.4.79/modules.dep.temp for writing: No suhc file or directory
make: *** [_modinst_post] Error 1

Indeed there is no directory called that, but how can I add it?

csnewb
  • 1,190
  • 2
  • 19
  • 37

2 Answers2

0

Did you try \"make modules_install\"?

to install modules

make modules_install

to install kernel

make install

Sasi V
  • 1,074
  • 9
  • 15
  • yes i did, there are built 3 folders called build, kernel, source. there is also 2 files called modules.builtin and modules.order – csnewb Apr 02 '14 at 10:44
0

Out-of-tree modules

For the benefit of future Googlers, this is what Buildroot 2018.05 does to install out-of-tree modules for LInux v4.19:

cd linux_kernel_source
mkdir -p /build/dir/default/x86_64/target/lib/modules/4.19.0/extra
/usr/bin/make -f ./scripts/Makefile.modinst
mkdir -p /build/dir/default/x86_64/target/lib/modules/4.19.0/extra
cp /build/dir/default/x86_64/build/kernel_modules-1.0/./buildroot_dep.ko /build/dir/default/x86_64/target/lib/modules/4.19.0/extra
/build/dir/default/x86_64/host/bin/x86_64-buildroot-linux-uclibc-strip --strip-debug /build/dir/default/x86_64/target/lib/modules/4.19.0/extra/buildroot_dep.ko
/bin/bash ./scripts/depmod.sh /build/dir/default/x86_64/host/sbin/depmod 4.19.0

So we can see that it uses the ./scripts/Makefile.modinst and ./scripts/depmod.sh in tree scripts, plus some ugly manual copying of the modules.

Found by building a package that contains kernel modules with V=1 and kernel_modules_package_name-reconfigure and simplifying the output commands, works every time :-).

The only missing question is how depmod was obtained, so we do another verbose build with host-kmod-reconfigure, and basically obtain:

./configure
--prefix="/build/dir/default/x86_64/host"
--sysconfdir="/build/dir/default/x86_64/host/etc"
--localstatedir="/build/dir/default/x86_64/host/var"

where the source is obtained from: https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git

In tree modules are installed with make modules_install as mentioned at: How to install Kernel Modules from Source Code. Error while make process

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985