Usually kernel source are stored in /usr/src/linux-2.6.x/
.
To avoid to recompile the entire kernel if I modify a module's source, how can I recompile just that module?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Kernel oops Oops: 80000005 on arm embedded system
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
Switch to the root directory of your source tree and run the following command:
And to install the compiled module:
Note: As lunakid mentions, the latter command might not build the module first, so be careful.
In case you have edited just code in drivers/net/ethernet/intel/e1000/e1000_main.c file
Build the module.
Install the module.
You can pass the path to the module name or module directory to make as parameter.
since kernel versions 3.x.x and 4.x.x the procedure gets more complicated (but there is a hope, so keep reading):
make distclean
if you haven't just cloned a new source but used to build other modules before/boot/config-`uname -r`
file (example: /boot/config-4.8.0-46-generic) into kernel source folder file .config and runmake oldconfig
. if the module belongs to the kernel source, verify if it has been enabled by callingmake menuconfig
, by searching for the module and applying letter 'M' if necessarymake kernelversion
if it matches exactly theuname -r
one)make scripts
make prepare
andmake modules_prepare
has to be executed prior to the actual module build/usr/src/linux-headers-`uname -r`/Module.symvers
(example: /usr/src/linux-headers-3.13.0-117-generic/Module.symvers) into the newly created module source files folder prepared for the module compilation (the one extra in example).obj-y += <module_source_file_name>.o
or if the source code is complicated, use the guidance from heremake -C <kernel source path> M=the_module_directory
(example:make -C . M=extra/
)modprobe --dump-modversion <module_name>.ko
to verify CRC match between module exporting API and corresponding values in Module.symvers. in case of failure use commandmodinfo <module_name>.ko
insteadthe solution would be following:
commit all your changes, force release tag to shift above your modifications with the
git tag -a <tag version> -f
command. then rebuild your modules from step 8https://askubuntu.com/questions/515407/how-recipe-to-build-only-one-kernel-module