Linux Project
Process of compiling the Linux kernel and working on various projects like adding new system calls, memory management, and process handling. Understand the essential steps and commands involved in kernel compilation. Dive into the significance of configuration files and the potential risks of misconfigurations. Discover efficient project solutions and system call hooking techniques. Get insights into the basics and complexities of Linux kernel development.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Outline How to compile linux kernel How to add a new system call Some Projects Example and Way to Solve it System Call Hooking by Module Project about Memory Project about Process
Download Link wget https://kernel.org/pub/linux/kernel/linux-2.6.18.tar.bz2 tar xvf linux-2.6.18.tar.bz2
The Basic Process 0. make mrproper 1. make oldconfig 2. make j[n] 3. make modules_install 4. make install 5. reboot
make mrproer Clean up the environment Will Remove almost everything, except .
make clean Almost the same as make mrproper.
make oldconfig Use the configuration file the current kernel is using. Some other alternative options. Make menuconfig
Config file Determine which kind of kernel you are compiling Determine which modules you want the kernel to compile. Misconfiguration will lead to kernel crash.
make j[n] Compile the whole source code according to your configuration
make modules_install Install the modules into the necessary folder. /lib/modules/`uname r`/
make install Install the image into the boot directory. Sometimes, update grub is necessary.
Between Device Device User Device Device
Pop Quiz : Write A Program To Print Hello World
User Application Printf libc.so System Call Kernel Code Device Driver IO Device
Everything Will Be x86 instruction in and out
Lets Focus On User Application Printf libc.so System Call Kernel Code Device Driver IO Device
Before We Talk Further, Let s Talk About X86 Architecture
User Application Kernel Device Driver CPU 8259 PIC Device Device Device Device
How The CPU Find The Address of The Device Driver Code
Kernel Device Driver Interrupt Descriptor Table Device Driver .. Device Driver Device Driver CPU 8259 PIC Device Device Device Device Physical Device
System Call Handler Interrupt Descriptor Table syscall_table System Call Handler .. .. 0x80 .. System Call Handler CPU 8259 PIC int 0x80 Device Device Device Device Physical Device
cpu cs ds ss esp eip int 0x80 User Application CPU Stack Kernel
cpu cs ds ss esp eip int 0x80 User Application CPU Get TSS GDT Stack TSS
cpu cs ds ss esp eip int 0x80 User Application CPU Get TSS GDT Stack TSS
cpu cs ds ss esp eip int 0x80 User Application CPU Get IDT IDT ENTRY(system_call) Stack 0x80 sys_call_table
cpu cs ds ss esp eip int 0x80 User Application CPU Get IDT IDT ENTRY(system_call) Stack 0x80 sys_call_table
cpu cs ds ss esp eip int 0x80 User Application CPU Get IDT IDT ENTRY(system_call) Stack ss esp eflags cs eip 0x80 sys_call_table
Add a System Call 1. cd $kernel_src 2. cd arch/i386/kernel/syscall_table.S 3. . .long sys_tee .long sys_vmsplice .long sys_move_pages .long sys_project Kernel.org/pub/linux/kernel /* 315 */ /* 318 */
Add a System Call cd linux/include/asm-i386/unistd.h #define __NR_vmsplice #define __NR_move_pages #define __NR_project 316 317 318 #ifdef __KERNEL__ #define NR_syscalls 319
Add a System Call cd linux/include/linux/syscalls.h asmlinkage long sys_set_robust_list(struct robust_list_head __user *head, size_t len); asmlinkage long sys_project( int i ); #endif