Procedure 66. Compiling and Inserting the NovFS Kernel Module
Trying to build the module from source
Picking the module from the source tree
With the source unpacked as shown above, we look up version of the module according to the Makefile
:
grep ^NOVFS_VFS_ kernel-source-2.6.27.19/usr/src/linux-2.6.27.19-3.2/fs/novfs/Makefile |awk '{print $3}'|tr '\n' '.'
2.0.0.440.
Then we pick out the novfs
source directory and delete the rest of the tree:
cp -rp kernel-source-2.6.27.19/usr/src/linux-2.6.27.19-3.2/fs/novfs ./novfs-2.0.0.440
rm -rf kernel-source-2.6.27.19
Modifying the Makefile
We create a working copy of novfs-2.0.0.440
and cd into it:
mkdir -p wd/novfs-2.0.0.440
cd !$
, then to the Makefile
we prepend:
CONFIG_NOVFS=m
and append: [31]:
LNXINC=/lib/modules/`uname -r`/build/ all: make -C $(LNXINC) SUBDIRS=`pwd` modules clean: rm -f Modules.symvers make -C $(LNXINC) SUBDIRS=`pwd` clean
Adding the DKMS
config file
We create novfs-2.0.0.440/dkms.conf
containing:
PACKAGE_NAME="novfs" PACKAGE_VERSION="2.0.0.440" CLEAN="make clean" BUILT_MODULE_NAME[0]="novfs" MAKE[0]="make all" DEST_MODULE_LOCATION[0]="/kernel/fs/novfs/" AUTOINSTALL="yes"
Copying the filesystem module source into /usr/src
cd ~/novfs-hack
sudo cp -rp wd/novfs-2.0.0.440 /usr/src/
Compiling and inserting the module
We tell the dkms
subsystem about the new module:
sudo dkms add -m novfs -v 2.0.0.440
Creating symlink /var/lib/dkms/novfs/2.0.0.440/source ->
/usr/src/novfs-2.0.0.440
DKMS: add Completed.
We build the module:
sudo dkms build -m novfs -v 2.0.0.440
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area....
make KERNELRELEASE=2.6.27-14-generic all......
cleaning build area....
DKMS: build Completed.
... and we install it:
sudo dkms install -m novfs -v 2.0.0.440
Running module version sanity check.
novfs.ko:
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/2.6.27-14-generic/updates/dkms/
depmod.....
DKMS: install Completed.
Doublechecking whether the module loads
sudo modprobe novfs
lsmod|grep novfs
novfs 127920 0