+91-9952009545 | +91-9884386075 contact@slashprog.com

Introduction to Linux Kernel Internals and Development

Duration: 5 days (3 hours 30 minutes per day – Monday to Friday)

Course Track: Beginner / Intermediate

About the Course

This master class offers a comprehensive introduction to Linux kernel internals. It delves into the high-level architecture of the Linux kernel, essential OS concepts and terminologies, and best practices in Linux kernel development.

Participants will gain hands-on experience in building the Linux kernel from source code tailored for specific requirements and hardware customizations. Additionally, they will learn to construct a lightweight bootable Linux-based system from the ground up.

Moreover, the class includes hands-on exercises for crafting and building custom loadable kernel modules, as well as creating patches and applying them into the Linux kernel source code.

Target Audience

  • Working professionals on Linux-based environments and academic students who are interested in understanding the working internals of the Linux kernel.
  • Enthusiasts who are interested in contributing to the Linux kernel project.
  • Engineers and enthusiasts who are interested in migrating to Linux ecosystem for device driver development.
  • Systems architects who are interested in learning the features and inner workings of the Linux kernel to better leverage its capabilities into their projects.

Prerequisites

Participants should meet the following pre-requisites:
  • Knowledge of high-level CPU and computer hardware architecture.
  • Ability to install Linux and perform basic tasks on the Linux command-line
  • Ability to read and understand code written in C and basic knowledge on C data-structures.
  • Ability to understand and converse in spoken English (master speaks in Indian accent).

Training Mode

  • This training program is designed to be an online live master class conducted via Zoom Meeting.
  • All communication related to training materials, assignments and Meeting Links will be via email and WhatsApp group (details will be shared upon enrollment).
  • Each module is planned for 3 hour 30 minutes sessions, but can spill-over multiple sessions based on overall wavelength of attendees.

Training Requirements

As the training will be a live master-class, each attendee must have a working computer/laptop for practice sessions with good internet connectivity and recent hardware configuration. The recommended setup is as below:

Module 1

Introduction to Linux kernel

  • Introductory overview on Linux ecosystem
  • Design goals of the Linux kernel
  • Linux kernel architectural overview
  • Kernel-mode vs User-mode
  • Linux kernel to user-space interface: ABI vs API
  • Features and benefits of Linux kernel design
    • Monolithic kernel architecture
    • “Everything as a file” paradigm
    • An overview on pseudo filesystems
    • Processes, Threads and Scheduling design overview
    • Virtual memory system
    • Support for dynamically loadable kernel modules
  • Navigating the Linux kernel source tree
  • High-level walkthrough on the flow of a Linux system call
  • Linux kernel and process view of the system
  • Linux kernel execution contexts

Hands On

  • Identify some important documentation bundled with the Linux
    kernel source.
  • Understand the directory structure/organization of Linux
    kernel source tree.

Module 2

Building Linux kernel from the sources

  • The Linux kernel development process
  • The Linux kernel trees: mainline, stable, longterm and linux-next trees
  • Sync’ing up with mainline GIT repository
  • Creating and submitting patches (demonstration)
  • Steps involved in deploying custom compiled Linux kernel from
    the available sources.
  • An overview on the Kbuild system (Kconfig, .config and Makefile)
  • A quick walkthrough on Linux kernel source configuration parameters
  • Building a custom kernel optimized for the hardware configuration and specific-requirements.
  • Debugging options in the Linux kernel build
  • An overview on busybox and uClibc project
  • Configuring and Building busybox from sources
  • Creating a custom initrd/initramfs/rootfs image
    integrating Linux kernel and busybox build.
  • An overview on buildroot, openwrt and similar projects

Hands On

  • Build Linux Kernel from sources customized for a target hardware.
  • Creating custom boot image with busybox based initrd/rootfs.

Module 3

Linux kernel modules

  • In-Kernel-Tree modules vs Out-Of-Tree (OOT) modules
  • Built-in modules Vs Loadable Kernel Modules (LKM)
  • User libraries Vs. Kernel mode library functions.
  • An overview on Kernel Taint flags
  • LKM management tools
  • LKM diagnostics using /proc and /sys/module interfaces
  • Managing LKM module dependencies and module aliases
  • The role of udev subsystem in LKM management

Linux kernel module development – Part 1

  • Important header files.
  • Kernel module functions.
  • Compiling LKMs.
  • Interesting macros and annotations: how they work
    • __init, __exit, __initdata, __initconst
    • likely() and unlikely() macros

Hands On

  • Using the Linux kmod tools (lsmod, insmod, modprobe, depmod, modinfo).
  • Create simple Linux Kernel module and build the same

Module 4

Linux kernel module development – Part 2

  • Module-specific macros and rudimentary functions.
  • Handling module parameters.
  • Using printk() series of functions, dump_stack(),
    BUG(), WARN() and panic().
  • Creating LKMs from multiple C sources.
  • Using dmesg command and /proc/kmsg to read kernel log messages.
  • Managing kernel logs using klogd/syslogd.
  • Tips, techniques and conventions used in writing programs within
    the Linux kernel.
  • Exporting symbols from LKM.
  • Creating library LKMs and using EXPORT_SYMBOL() macros
  • Managing multi-module dependencies

Hands On

  • Creating Loadable Kernel Modules
  • Integrating LKMs into kernel source tree
  • Creating kernel patches and distributing them
  • Applying a custom patch and testing on a kernel source tree
  • Creating multiple LKMs and managing dependencies

Module 5

Linux kernel design patterns and paradigms

  • READ_ONCE(), WRITE_ONCE() and ACCESS_ONCE() macros
  • __deprecated, __kernel and __user annotation macros
  • might_sleep(), might_fault() annotation macros
  • Various GCC-specific features used within Linux kernel
  • Linux ABI: procfs, debugfs, sysfs, sysctl and module_params
  • Interfacing pseudo filesystem using the seq_file interface
  • Best practices and recommendations for exposing kernel
    features/configuration to user-space
  • An overview on IRQ subsystem – hardIRQ and softIRQ contexts
  • A high-level overview on device interface and the device driver subsystems
  • An overview on device hotplug support, devicetree (OpenFirmware Specificiations) and device-managed resources within the kernel.
  • An overview on concurrency and synchronization mechanisms within the Linux kernel
  • An overview on dynamic memory management APIs within the Linux kernel

Hands On

  • Create an LKM to interface a kernel-space linked-list via /proc filesystem
  • A high-level code-walk on a simple character device driver

Course fee: ₹5000 INR / $65 USD / £50 GBP / €60 EUR

How to enroll ?

In order to enroll to this training class, you can fill in the form below registering your interest with the required details.

You will receive an acknowledgement email from registrations@slashprog.com once you submit the form. In this email, we will provide you with the details for paying the course fee including payment links if you chose “Pay via Stripe” or UPI/NEFT details if you chose UPI/NEFT payment option.

Once we receive the payment, we will reply back with the confirmation of your training registration and provide you links to connect using Google Meet along with the exact schedule for the classes by email.

If you have any further queries, you can email us directly to contact@slashprog.com

Kindly fill in the following details to enroll to this training class.

Kindly select your preferred payment method from below