For most Linux administrators, updating a kernel is done through the package manager for the Linux distribution that is being used. However, there can be situations where a particular kernel version or specific kernel configurations are needed. In this lab, you will be tasked with downloading the full kernel source tree, updating the kernel configuration to certain specifications, and then compiling a new kernel image.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Enable source URIs for apt repositories.
Open the sources.lst file in
/etc/apt/
:vim /etc/apt/sources.lst
Uncomment
deb-src
URIs manually or by substitution —:%s/# deb-src/deb-src/g
Resynchronize the package index files:
apt-get update
- Install dependencies
- Install additional dependencies:
apt-get install -y make gcc libncurses5-dev dpkg-dev
- Build dependencies for the kernel image:
apt-get build-dep -y linux-image-$(uname -r)
- Install additional dependencies:
- Download the Kernel source tree to /usr/src
- Switch to the
/usr/src
directory:cd /usr/src/
- Download the kernel source tree:
apt-get source linux-image-$(uname -r)
- Switch to the
- Update the kernel configuration
- Switch to the kernel source tree directory:
cd /usr/src/linux-aws-[kernel_version]/
- Update the kernel configuration with the
make menuconfig
command:make menuconfig
- Navigate with your arrow keys and use enter to go to
Device Drivers
>Block devices
- Using the “n” key, exclude the following two drivers –
DRBD Distributed Replicated Block Device support
andPacket writing on CD/DVD media (DEPRECATED)
- Exit the menu and save your configuration changes.
- Switch to the kernel source tree directory:
- Compile the kernel image (this step can take 15-20 minutes to complete)
- Create the compressed kernel image by calling the bzImage target:
make bzImage
Note: This can take 15-20 minutes to complete
- Create the compressed kernel image by calling the bzImage target: