The document provides instructions for compiling the Linux kernel and submitting a first patch. It lists prerequisites like VMware Player, VirtualBox, and a guest and host Linux installation. It outlines the steps to build the kernel, create a "Hello World" kernel module, make changes to it, generate a patch, apply the patch, and send the patch to an email address for review. The goal is for participants to get hands-on experience compiling the kernel and contributing a small patch back to the community.
1 of 13
Download to read offline
More Related Content
Compiling linux kernel and submit first patch
1. Compiling Linux Kernel &
Submit First Patch
Speaker:
Mr Mayur S Patil, Asst Prof, MITAOE.
2. As linux kernel compilation is daunting task, so to save our
time I request to the participants coming for this workshop
must have following things preinstalled:
> VMware Player (If possible, VMware tools also)
> Virtualbox
> Guest and Host Linux Installed (Fedora or CentOS)
> Thunderbird Email client as mentioned in schedule.
Strict Requirement
3. Plan of Talk
Very Brief history of Linux
Let's Build Kernel right away
Uh..But where is my driver?
Writing your first Linux Kernel Module
Send it to Mail
4. Hope you all are ready with prerequisites that I mentioned
Check these packages:
# yum install ncurses-devel
# yum install rsyslog
# yum install gcc
Start the Game
5. Source Code Uncompress
To extract code at desired location,
# tar -Jxvf linux-3.12.42.tar.xz -C /usr/src
Enter into Directory
# cd /usr/src
Create a link to original one
# ln -s linux-3.x.x/ linux-fudcon
# cd linux-fudcon/
6. Start Compilation
To clean config+prev backup+prev files
# make mrproper
To copy old config file
# cp /usr/src/kernels/3.10.x/.config /usr/src/linux-fudcon/
To start build
# make localmodconfig
7. Time to create image
# make bzImage
To compile modules only
# make modules
To install modules
# make modules_install
8. Time to install the Kernel images
# make install
Time to reboot as compilation process completed
# reboot
9. Hello World Module
Create a dir at non-root user location
$ cd Documents/LKP/
https://github.com/ramlaxman/LKP/
Contains two files:
- hello.c
- Makefile (Be careful with name and its contents)
Now go to Directory of Modules
$ make
10. Loading Module.
Log in as root
# insmod hello.ko
# lsmod | less
# tail -f /var/log/messages
Now unload module
# rmmod hello
# dmesg
11. Create a patch
Now make create copy of hello.c and make
changes into that:
$ cp hello.c hello1.c
After making changes,
$ diff -u hello.c hello1.c > hello.patch
Apply patch,
$ patch < hello.patch
12. Send your patch to:
kernel-training@lukaselsner.de
[Will disabled later]
Use thunderbird settings.
13. Thanks to:
Lukas Elsner: For email Domains
Greg Kroah-hartman: For advice on building kernel like
Speedy Machine
and of course,
Audience !!