I assume you have gone through the Preface, the relevant section being To get the most out of this book, and have appropriately prepared a guest virtual machine (VM) running Ubuntu 18.04 LTS (or a later stable release) and installed all the required packages. If not, I recommend you do this first.
To get the maximum out of this book, I strongly recommend you first set up the workspace environment, including cloning this book's GitHub repository (https://github.com/PacktPublishing/Linux-Kernel-Programming-Part-2) for the relevant code, and work on it in a hands-on fashion.