Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Linux Kernel Programming Part 2 - Char Device Drivers and Kernel Synchronization

You're reading from   Linux Kernel Programming Part 2 - Char Device Drivers and Kernel Synchronization Create user-kernel interfaces, work with peripheral I/O, and handle hardware interrupts

Arrow left icon
Product type Paperback
Published in Mar 2021
Publisher Packt
ISBN-13 9781801079518
Length 452 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Kaiwan N. Billimoria Kaiwan N. Billimoria
Author Profile Icon Kaiwan N. Billimoria
Kaiwan N. Billimoria
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Section 1: Character Device Driver Basics
2. Writing a Simple misc Character Device Driver FREE CHAPTER 3. User-Kernel Communication Pathways 4. Working with Hardware I/O Memory 5. Handling Hardware Interrupts 6. Working with Kernel Timers, Threads, and Workqueues 7. Section 2: Delving Deeper
8. Kernel Synchronization - Part 1 9. Kernel Synchronization - Part 2 10. Other Books You May Enjoy

To get the most out of this book

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
-OR- 
Linux as a stand-alone OS

Detailed installation steps (software-wise):

  1. Install Linux as a VM on a host Windows system; follow one of these tutorials:
  2. Install the required software packages on the Linux VM:
    1. 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
    1. Install the Oracle VirtualBox Guest Additions now. Reference: How to Install VirtualBox Guest Additions in Ubuntuhttps://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.)
    2. To install the packages, take the following steps:
      1. Within the Ubuntu VM, first run the sudo apt update command
      2. 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.
  1. Useful resources:
  2. Detailed instructions, as well as additional useful projects, installing a cross-toolchain for ARM, and more, are described in Chapter 1, Kernel Workspace Setupof 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.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime