- 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.xz
ortar jxvf source.tar.bz3
- Configure kernel using
make [x|g|menu]config
ormake [x|g|menu]config ARCH=x86_64
Note: Architecture specific libraries are must - Compile the kernel using
make
- Compile modules
make modules
and install themmake modules_install
- Install the newly compiled kernel using
make install
- Create initrd image
cd /boot
andmkinitramfs -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
dmesg
output for 'printk' statements * Runsudo lsmod
and find your module listed - Unload a module by running
sudo rmmod hello