From the course: Advanced Linux: The Linux Kernel
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Identifying how LKMs work - CentOS Tutorial
From the course: Advanced Linux: The Linux Kernel
Identifying how LKMs work
- [Instructor] Now let's look at source code for a simple module to see what it takes to write a loadable kernel module. Let's start with how do we compile a module once we have one. We're going to use the make command and we're going to have a make file. Now this make command to compile a module is kind of complicated. To compile a loadable kernel module for a kernel, we want to use that kernel's make file. So, when we use the make command, we're going to use the the dash capital C option and we're going to give the path name to where the kernel source is or at least where the kernel headers are. So with your distro, maybe you installed the package for kernel development, which would have the kernel headers that you need. So as long as that's installed right underneath lib modules, kernel version is a soft link called build that will point at that directory. When we compile our module, we're going to need the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.