Skip to main content

Posts

Showing posts with the label Linux Kernel Programming

Compiling and Building Linux kernel with your Name

1. Download the latest stable kernel  from https://www.kernel.org/ or clone from git repository [root@localhost linux]# cd /usr/src [root@localhost linux]# git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2. Move to the cloned repository if you cloned using git [root@localhost linux]# cd /usr/src/linux or extract the tar ball if you have downloaded from kernel.org [root@localhost linux]# tar -xf linux-3.15-rc1.tar.xz -C /usr/src 3. Install the Development tools [root@localhost linux]# yum install gcc ncurses-devel  4. Configure the kernel before compiling the kernel you need to configure the kernel with different tools xconfig,gconfig,menuconfig,nconfig. menuconfig and nconfig needs ncurses-devel to be installed. [root@localhost linux]# make menuconfig select the configurations based on your hardware and save.It will create .config file in current directory. 5. open t...

How to send patches to linux-next tree staging subsystem

1) Checkout the latest branch from below link       git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 2)  Bu ild the kernel using below commands       make oldconfig && make prepare        make scripts 3) Configure your git-send-email for gmail  https://www.kernel.org/pub/software/scm/git/docs/git-send-email.html   This is my .gitconfig file.Paste the below contents into your ~/.gitconfig file.  Edit  name and email address,currently it is configured for gmail. -------------------------------------------------------------------------------------------------------------------------------   [user]         name = Surendra Patil         email = surendra.tux@gmail.com [sendemail]         smtpserver = smtp.gmail.c...

How to write Linux Kernel Modules

1) hello_driver.c program which conatins the init and exit functions /* This is my first driver module program */ #include<linux/init.h> #include<linux/module.h> #include<linux/kernel.h> static int __init hello_init(void) {         printk(KERN_ALERT "Hello my first module \n");         return 0; } static void __exit hello_exit(void) {         printk(KERN_ALERT "Good Bye \n"); } module_init(hello_init); module_exit(hello_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Hello world Module"); MODULE_AUTHOR("SURENDRA PATIL"); 2) Make file for the module ifneq ($(KERNELRELEASE),)         obj-m := hello_driver.o else         KDIR ?= /lib/modules/$(shell uname -r)/build         PWD :=$(shell pwd) default:     ...