Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Linux Kernel Programming

You're reading from  Linux Kernel Programming

Product type Book
Published in Mar 2021
Publisher Packt
ISBN-13 9781789953435
Pages 754 pages
Edition 1st Edition
Languages
Author (1):
Kaiwan N. Billimoria Kaiwan N. Billimoria
Profile icon Kaiwan N. Billimoria
Toc

Table of Contents (19) Chapters close

Preface 1. Section 1: The Basics
2. Kernel Workspace Setup 3. Building the 5.x Linux Kernel from Source - Part 1 4. Building the 5.x Linux Kernel from Source - Part 2 5. Writing Your First Kernel Module - LKMs Part 1 6. Writing Your First Kernel Module - LKMs Part 2 7. Section 2: Understanding and Working with the Kernel
8. Kernel Internals Essentials - Processes and Threads 9. Memory Management Internals - Essentials 10. Kernel Memory Allocation for Module Authors - Part 1 11. Kernel Memory Allocation for Module Authors - Part 2 12. The CPU Scheduler - Part 1 13. The CPU Scheduler - Part 2 14. Section 3: Delving Deeper
15. Kernel Synchronization - Part 1 16. Kernel Synchronization - Part 2 17. About Packt 18. Other Books You May Enjoy

Install the Oracle VirtualBox Guest Additions

For best performance, it's important to install the Oracle VirtualBox Guest Additions as well within the guest VM. These are essentially para-virtualization accelerator software, which greatly helps with optimal performance. Let's see how to do this on an Ubuntu guest session:

  1. First, update your Ubuntu guest OS's software packages. You can do so using the following command:
sudo apt update

sudo apt upgrade
  1. On completion, reboot your Ubuntu guest OS and then install the required packages using the following command:
sudo apt install build-essential dkms linux-headers-$(uname -r)
  1. Now, from the VM menu bar, go to Devices Insert Guest Additions CD image...This will mount the Guest Additions ISO file inside your VM. The following screenshot shows what it looks like doing this: 

Figure 1.3 – VirtualBox | Devices | Insert Guest Additions CD image
  1. Now, a dialog window will pop up that will prompt you to run the installer in order to launch it. Select Run.
  2. The Guest Additions installation will now take place in a Terminal window that shows up. Once complete, hit the Enter key to close the window. Then, power off your Ubuntu guest OS in order to change some settings from the VirtualBox manager, as explained next.
  1. Now, to enable Shared Clipboard and Drag'n'Drop functionalities between the guest and host machines, go to GeneralAdvanced and enable the two options (Shared Clipboard and Drag'n'Drop) as you wish with the dropdowns:
Figure 1.4 – VirtualBox: enabling functionality between the host and guest
  1. Then, click OK to save the settings. Now boot into your guest system, log in, and test that everything is working fine.
As of the time of writing, Fedora 29 has an issue with the installation of the vboxsf kernel module required for the Shared Folders feature. I refer you to the following resource to attempt to rectify the situation: Bug 1576832 - virtualbox-guest-additions does not mount shared folder (https://bugzilla.redhat.com/show_bug.cgi?id=1576832). If this refuses to work, you can simply transfer files between your host and guest VM over SSH (using scp(1)); to do so, install and start up the SSH daemon with the following commands:
sudo yum install openssh-server
sudo systemctl start sshd

Remember to update the guest VM regularly and when prompted. This is an essential security requirement. You can do so manually by using the following: 

sudo /usr/bin/update-manager

Finally, to be safe, please do not keep any important data on the guest VM. We will be working on kernel development. Crashing the guest kernel is actually a commonplace occurrence. While this usually does not cause data loss, you can never tell! To be safe, always back up any important data. This applies to Fedora as well. To learn how to install Fedora as a VirtualBox guest, visit https://fedoramagazine.org/install-fedora-virtualbox-guest/.

Sometimes, especially when the overhead of the X Window System (or Wayland) GUI is too high, it's preferable to simply work in console mode. You can do so by appending 3 (the run level) to the kernel command line via the bootloader. However, working in console mode within VirtualBox may not be that pleasant an experience (for one, the clipboard is unavailable, and the screen size and fonts are less than desirable). Thus, simply doing a remote login (via ssh, putty, or equivalent) into the VM from the host system can be a great way to work.
You have been reading a chapter from
Linux Kernel Programming
Published in: Mar 2021 Publisher: Packt ISBN-13: 9781789953435
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 $15.99/month. Cancel anytime}