Sometimes i need to compile just one kernel module for current kernel without compiling full kernel tree.
This is how i get it done:
1) get attached patch
2) install and extract kernel source
sudo apt-get install linux-source
tar xjf /usr/src/
or
sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
apt-get source linux-image-$(uname -r)
3) patching and compilation (only drivers/usb/serial subdirectory)
mkdir temp
cd ./linux-
patch -p1 < ../usb-
cp /lib/modules/`uname -r`/build/.config ../temp
cp /lib/modules/`uname -r`/build/
cp /lib/modules/`uname -r`/build/Makefile .
make O=../temp outputmakefile
make O=../temp archprepare
make O=../temp prepare
make O=../temp modules SUBDIRS=scripts
make O=../temp modules SUBDIRS=
4) copy resulting modules to kernel modules directory
sudo cp ../temp/
sudo cp ../temp/
sudo cp ../temp/
sudo /sbin/depmod -a
评论