Kali Linux Cookbook
上QQ阅读APP看书,第一时间看更新

Preparing kernel headers

There will occasionally be times where we'll face the need to compile code which requires kernel headers. Kernel headers are the source code of the Linux kernel. In this first recipe, we'll explain the steps required to prepare kernel headers for later use.

Getting ready

An Internet connection is required to complete this recipe.

How to do it...

Let's begin the process of preparing kernel headers:

  1. We begin first by updating our distribution by executing the following command:
    apt-get update
    
  2. Next, we must use apt-get again to prepare the kernel headers. Execute the following command:
    apt-get install linux-headers - `uname –r`
    
  3. Copy the following directory and its entire contents:
    cd /usr/src/linux
    cp -rf include/generated/* include/linux/
    
  4. We're now ready to compile code that requires kernel headers.