Linux Project

Linux Project
Slide Note
Embed
Share

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.

  • Linux
  • Kernel Compilation
  • System Calls
  • Project Development
  • Memory Management

Uploaded on Feb 22, 2025 | 0 Views


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


  1. Linux Project

  2. 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

  3. Download Link wget https://kernel.org/pub/linux/kernel/linux-2.6.18.tar.bz2 tar xvf linux-2.6.18.tar.bz2

  4. The Beginning of everything

  5. Compile Linux Kernel

  6. It is Hard?

  7. No, If you understand the concept

  8. The Basic Process 0. make mrproper 1. make oldconfig 2. make j[n] 3. make modules_install 4. make install 5. reboot

  9. Do You Know What It Means?

  10. make mrproer Clean up the environment Will Remove almost everything, except .

  11. make clean Almost the same as make mrproper.

  12. make oldconfig Use the configuration file the current kernel is using. Some other alternative options. Make menuconfig

  13. Is config File Important?

  14. 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.

  15. make j[n] Compile the whole source code according to your configuration

  16. make modules_install Install the modules into the necessary folder. /lib/modules/`uname r`/

  17. make install Install the image into the boot directory. Sometimes, update grub is necessary.

  18. What Is System Call

  19. Its a Bridge

  20. Between Device Device User Device Device

  21. Why System Call

  22. Pop Quiz : Write A Program To Print Hello World

  23. What You May Write

  24. What Actually Happened .

  25. User Application Printf libc.so System Call Kernel Code Device Driver IO Device

  26. What If There Is No System Call

  27. Everything Will Be x86 instruction in and out

  28. Lets Focus On User Application Printf libc.so System Call Kernel Code Device Driver IO Device

  29. Magic int 0x80

  30. Before We Talk Further, Let s Talk About X86 Architecture

  31. X86 Architecture Is Interrupt Driven

  32. User Application Kernel Device Driver CPU 8259 PIC Device Device Device Device

  33. How The CPU Find The Address of The Device Driver Code

  34. Callback Mechanism

  35. Kernel Device Driver Interrupt Descriptor Table Device Driver .. Device Driver Device Driver CPU 8259 PIC Device Device Device Device Physical Device

  36. How About System Call

  37. Magic int 0x80

  38. 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

  39. cpu cs ds ss esp eip int 0x80 User Application CPU Stack Kernel

  40. cpu cs ds ss esp eip int 0x80 User Application CPU Get TSS GDT Stack TSS

  41. cpu cs ds ss esp eip int 0x80 User Application CPU Get TSS GDT Stack TSS

  42. cpu cs ds ss esp eip int 0x80 User Application CPU Get IDT IDT ENTRY(system_call) Stack 0x80 sys_call_table

  43. cpu cs ds ss esp eip int 0x80 User Application CPU Get IDT IDT ENTRY(system_call) Stack 0x80 sys_call_table

  44. 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

  45. How To Add A System Call

  46. 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 */

  47. 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

  48. 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

More Related Content