To get the most out of this book, we expect you to have knowledge and experience of the following:
- Know your way around a Linux system, on the command line (the shell).
- The C programming language.
- Know how to write simple kernel modules via the Loadable Kernel Module (LKM) framework
- Understand (at least the basics) of key Linux kernel internals concepts: kernel architecture, memory management (plus common dynamic memory alloc/de-alloc APIs), and CPU scheduling.
- It's not mandatory, but experience with Linux kernel programming concepts and technologies will help greatly.
Ideally, we highly recommend reading this book's companion, Linux Kernel Programming, first.
The details on hardware and software requirements for this book, as well as their installation, are shown here:
Chapter number |
Software required (with version) |
Free / proprietary |
Download links to the software |
Hardware specifications |
OS required |
All chapters |
A recent Linux distribution; we use Ubuntu 18.04 LTS (as well as Fedora 31 / Ubuntu 20.04 LTS); any of these will be suitable. Recommend you install the Linux OS as a virtual machine (VM), using Oracle VirtualBox 6.x (or later) as the hypervisor |
Free (open source) |
Ubuntu (desktop):Â https://ubuntu.com/download/desktop Oracle VirtualBox:Â https://www.virtualbox.org/wiki/Downloads |
Required:Â a modern relatively powerful PC or laptop equipped with 4 GB RAM (minimally; the more the better), 25 GB free disk space, and a good internet connection. Optional:Â we also use the Raspberry Pi 3B+ as a test bed. |
Linux VM on a Windows host |
Detailed installation steps (software-wise):
- Install Linux as a VM on a host Windows system; follow one of these tutorials:
- Install Linux Inside Windows Using VirtualBox, Abhishek Prakash (It's FOSS!, August 2019): https://itsfoss.com/install-linux-in-virtualbox/
- Alternately, here's another tutorial to help you do the same: Install Ubuntu on Oracle VirtualBox : https://brb.nci.nih.gov/seqtools/installUbuntu.html
- Install the required software packages on the Linux VM:
- Log in to your Linux guest VM and first run the following commands within a Terminal window (on a shell):
sudo apt update
sudo apt install gcc make perl
-
- Install the Oracle VirtualBox Guest Additions now. Reference: How to Install VirtualBox Guest Additions in Ubuntu: https://www.tecmint.com/install-virtualbox-guest-additions-in-ubuntu/
(This step only applies if you are running Ubuntu as a VM using Oracle VirtualBox as the hypervisor app.) - To install the packages, take the following steps:
- Within the Ubuntu VM, first run the sudo apt update command
- Now, run the sudo apt install git fakeroot build-essential tar ncurses-dev tar xz-utils libssl-dev bc stress python3-distutils libelf-dev linux-headers-$(uname -r) bison flex libncurses5-dev util-linux net-tools linux-tools-$(uname -r) exuberant-ctags cscope sysfsutils curl perf-tools-unstable gnuplot rt-tests indent tree pstree smem hwloc bpfcc-tools sparse flawfinder cppcheck tuna hexdump trace-cmd virt-what command in a single line.
- Install the Oracle VirtualBox Guest Additions now. Reference: How to Install VirtualBox Guest Additions in Ubuntu: https://www.tecmint.com/install-virtualbox-guest-additions-in-ubuntu/
- Useful resources:
- The Linux kernel official online documentation:Â https://www.kernel.org/doc/html/latest/.
- The Linux Driver Verification (LDV) project, particularly the Online Linux Driver Verification Service page: http://linuxtesting.org/ldv/online?action=rules.
- SEALS - Simple Embedded ARM Linux System:Â https://github.com/kaiwan/seals/.
- Every chapter of this book has a very useful Further reading section as well, detailing more resources.
- Detailed instructions, as well as additional useful projects, installing a cross-toolchain for ARM, and more, are described in Chapter 1, Kernel Workspace Setup, of this book's companion guide, Linux Kernel Programming, Kaiwan N Billimoria, Packt Publishing.
We have tested all the code in this book (it has its own GitHub repository as well) on these platforms:
- x86_64 Ubuntu 18.04 LTS guest OS (running on Oracle VirtualBox 6.1)
- x86_64 Ubuntu 20.04.1 LTS guest OS (running on Oracle VirtualBox 6.1)
- x86_64Â Ubuntu 20.04.1 LTS native OS
- ARM Raspberry Pi 3B+ (running both its distro kernel as well as our custom 5.4 kernel);Â lightly tested.
If you are using the digital version of this book, we advise you to type the code yourself or, better, access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.
For this book, we'll log in as the user named llkd. I strongly recommend that you follow the empirical approach: not taking anyone's word on anything at all, but trying it out and experiencing it for yourself. Hence, this book gives you many hands-on experiments and kernel driver code examples that you can and must try out yourself; this will greatly aid you in making real progress and deeply learning and understanding various aspects of Linux driver/kernel development.