- Compile and build Kernel from source
- Simple examples on LKM(Loadable Kernel Modules)
- Simiple example to read process information
Prerequisite: gcc & libncurses5 on Ubuntu 14.10
- Get the latest Linux Kernel code here
- Extract the source file using
tar pxvf source.tar.xzortar jxvf source.tar.bz3 - Configure kernel using
make [x|g|menu]configormake [x|g|menu]config ARCH=x86_64
Note: Architecture specific libraries are must - Compile the kernel using
make - Compile modules
make modulesand install themmake modules_install - Install the newly compiled kernel using
make install - Create initrd image
cd /bootandmkinitramfs -o initfd.img-ver ver - Update grub using
update-grub
Prerequisite: gcc & linux-headers on Ubuntu 14.10
- Build ko(kernel object) file by running
make - Load ko file by running
sudo insmod hello.ko - Validate if ko was succesfully loaded by
* Checking
dmesgoutput for 'printk' statements * Runsudo lsmodand find your module listed - Unload a module by running
sudo rmmod hello