How to self-learn Linux?

Linux Kernel Development Self-Learning Curriculum

This Curriculum is created by the REASONING AI, ChatGPT-o1 (The Strawberry AI).

Prerequisites Before diving into kernel development, ensure you have a solid understanding of:

Linux Fundamentals

Programming Skills

  1. Introduction to Linux Kernel Development Linux Kernel Architecture Monolithic vs. Microkernel Kernel space vs. User space Kernel Versions and Releases Understanding stable, mainline, and long-term support (LTS) kernels Setting Up a Development Environment Installing necessary tools (gcc, make, git) Configuring and building the kernel from source Using virtualization tools like QEMU or VMware for testing
  2. Advanced C Programming for Kernel Development Kernel Coding Style Linux kernel coding guidelines (Documentation/process/coding-style.rst) Pointers and Memory Management Pointer arithmetic, memory allocation (kmalloc, kfree) Data Structures in the Kernel Linked lists, trees, queues Concurrency and Synchronization Volatile keyword, memory barriers
  3. Kernel Modules and Device Drivers Writing Kernel Modules Creating simple modules (init and exit functions) Compiling and inserting modules (insmod, rmmod, modprobe) Character Device Drivers Implementing open, read, write, close operations Block Device Drivers Understanding block I/O operations Device Model and sysfs Interacting with device attributes
  4. Kernel Debugging Techniques Logging and Debugging Using printk, log levels, and dmesg Kernel Debuggers Using kgdb, kdb, and GDB for kernel debugging Analyzing Kernel Crashes Setting up kdump and crash utilities Tracing and Profiling Tools Using ftrace, perf, eBPF
  5. Source Code Management with Git Cloning the Linux Kernel Source Using git to clone repositories from kernel.org Understanding the Kernel Source Tree Navigating directories and understanding code organization Submitting Patches Generating patches with git format-patch Sending patches via email (git send-email) Linux Kernel Mailing List (LKML) Participating in discussions and code reviews
  6. File System Development (FS Expertise) Introduction to File Systems Overview of ext2/3/4, XFS, Btrfs, etc. Virtual File System (VFS) Layer Understanding the VFS abstraction Key structures: inode, dentry, super_block, file_operations Implementing a Simple File System Creating a basic file system (e.g., a RAM-based file system) File System Operations Implementing methods like read, write, open, release File System Caching and Buffers Page cache, buffer heads Advanced File System Concepts Journaling mechanisms Transaction management File system consistency and recovery
  7. Networking Stack Development (Networking Expertise) Linux Networking Architecture OSI model layers in the kernel Netlink sockets, socket buffers (sk_buff) Network Device Drivers Writing Ethernet drivers NAPI (New API) for network drivers Protocol Implementation Implementing or modifying TCP/IP stack components Working with transport protocols Netfilter Framework Packet filtering, NAT, connection tracking Network Namespaces and Virtualization Implementing network isolation Traffic Control and QoS Understanding tc, queuing disciplines
  8. Synchronization and Concurrency in the Kernel Atomic Operations Using atomic variables and operations Synchronization Primitives Spinlocks, mutexes, semaphores, completion variables Locking Strategies Deadlock avoidance, lock ordering Read-Copy Update (RCU) Understanding RCU mechanisms and use-cases
  9. Memory Management Subsystem Physical and Virtual Memory Address translation, paging mechanisms Memory Zones and Allocation ZONE_DMA, ZONE_NORMAL, ZONE_HIGHMEM Slab Allocator Working with kmem_cache Page Cache and Swapping Managing page cache, swap space interactions
  10. Process Management and Scheduling Process Descriptor and Task Structure Understanding task_struct Process Lifecycle Creation (fork, exec), scheduling, termination Kernel Threads Creating and managing kernel threads Scheduling Algorithms Completely Fair Scheduler (CFS), real-time scheduling policies Timers and Scheduling Latency High-resolution timers, jiffies, delays
  11. Inter-Process Communication in the Kernel Signals Handling signals in kernel space Wait Queues Implementing sleep and wake-up mechanisms Notifiers and Callbacks Using notifier chains for event handling
  12. Security in the Kernel Linux Security Modules (LSM) Overview of SELinux, AppArmor Capability Systems Dropping and checking capabilities Secure Coding Practices Avoiding common pitfalls (buffer overflows, integer overflows)
  13. Kernel Configuration and Build System Kernel Configuration Tools Using make menuconfig, xconfig Kernel Build Process Understanding Makefiles and Kconfig files Cross-Compilation Building kernels for different architectures
  14. Contributing to the Linux Kernel Kernel Development Process Understanding the contribution workflow Coding Standards Compliance Using checkpatch.pl to validate code style Legal Considerations GPL licensing, developer’s Certificate of Origin Maintainers and Subsystems Working with subsystem maintainers for patch acceptance
  15. Advanced Topics Real-Time Linux PREEMPT_RT patch, real-time scheduling Kernel Virtualization Technologies KVM, Xen integration in the kernel Device Tree Usage Understanding and writing device tree blobs for hardware Methodology for Effective Self-Learning
  16. Structured Learning Approach Progressive Learning Start with foundational concepts before moving to advanced topics. Set Clear Goals Define what you aim to achieve (e.g., write a basic file system module).
  17. Hands-On Practice Set Up a Development Lab Use virtual machines or spare hardware for kernel testing. Kernel Compilation and Testing Regularly build and boot custom kernels. Code Exploration Read existing kernel code to understand implementations.
  18. Utilize Multiple Resources Books “Linux Kernel Development” by Robert Love “Understanding the Linux Kernel” by Daniel P. Bovet and Marco Cesati “Linux Device Drivers” by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman Online Documentation The Linux Kernel Archives: kernel.org Kernel Newbies: kernelnewbies.org Linux Cross Reference: elixir.bootlin.com Tutorials and Guides The Linux Kernel Module Programming Guide Linux Device Drivers Tutorial by Derek Molloy Mailing Lists and Forums Linux Kernel Mailing List (LKML) Stack Overflow, Reddit’s r/kernel
  19. Engage with the Community Participate in Discussions Join IRC channels like #kernel on Freenode. Contribute to Projects Start with small bug fixes or documentation improvements. Attend Conferences and Workshops Linux Foundation events, local meetups.
  20. Apply Knowledge to Projects File System Project Implement a simple file system (e.g., a memory-based file system). Networking Project Modify or extend a network protocol implementation. Device Driver Development Write drivers for virtual or actual hardware devices.
  21. Regular Assessment Code Reviews Seek feedback from experienced developers on your code. Self-Evaluation Reflect on what you’ve learned after completing each topic. Mentorship Consider finding a mentor in the kernel community.
  22. Stay Updated Follow Kernel Development News Read LWN.net for updates and articles. Track Mailing Lists Stay informed about discussions on LKML. Additional Tips Consistency and Patience Kernel development is complex; consistent effort is crucial. Attention to Detail Small mistakes can have significant impacts; double-check your work. Understand Before Coding Spend time understanding the existing codebase before making changes. Documentation Keep notes and document your learning journey. By following this curriculum and methodology, you’ll develop a deep understanding of Linux kernel internals, particularly in file systems and networking. This will prepare you for contributing to the kernel community and pursuing a career in kernel development.

Recommended Learning Path Start with the basics: Ensure your C programming skills are solid, and you understand operating systems concepts. Set up your environment: Build and boot a custom kernel. Learn by doing: Begin writing simple kernel modules. Dive into file systems: Study the VFS layer and implement a basic file system. Explore networking: Understand the networking stack and experiment with network modules. Contribute to the community: Start small by fixing bugs or improving documentation. Remember, kernel development requires a strong commitment to learning and adherence to community standards. Engaging with the community will not only enhance your learning but also open up opportunities for collaboration and mentorship.

How to add comments to the static site? Using Github discussion API and giscus-app, Follow the below tutorial

Hope, you could set it up too :) Stay tuned for more!