Table Of Contents
- Download Linux Kernel and Compile it
- Install and Setup QEMU
- Compile and Install NVMe CLI, liblightnvm and pblk-tools
This blog post describes the steps that I took to set up an environment with OpenChannel SSD using QEMU.
Download Linux Kernel and Compile it
The first step is to download the Linux kernel source from OpenChannelSSD’s GitHub repository. At the time of writing, features like pblk were not available on mainline Linux kernel. Compiling your own kernel might not be necessary in the future.
- Change to the directory where you want to clone the git repository. In this example I will use
- Clone the kernel:
At the time of writing this, latest kernel was available in the
for-nextbranch of https://github.com/OpenChannelSSD/linux
- Copy the kernel config file from your existing system to the kernel tree:
- Make sure that the .config file includes the following:
- Bring the config file up to date. Answer any questions that get prompted. Unless you know you are interested in a particular feature, accepting the default option by pressing Enter should be a safe choice:
- Clean the kernel source directory:
- Build the linux-image and linux-header .deb files using a thread per core + 1.
.deb files which is used to install the kernel in QEMU.
Install and Setup QEMU
In case you don’t have a physical OpenChannel SSD in hand, you may use Keith Busch’s QEMU branch to emulate the device via a backend file.
- Create an empty file to hold your NVMe device.
- Clone, compile and install QEMU
You might need to install the following depencencies.
sudo apt install libpixman-1-dev libaio-dev libspice-server-dev libspice-protocol-dev libattr1-dev libcap-dev
- Download Ubuntu and install it in QEMU. Start by creating a disk image and booting Ubuntu from an ISO.
For more information on what the parameters do, visit smdaudhilbe.wordpress.com
Follow the on-screen instructions to install Ubuntu
After installation, start the VM with the following parameters. You may notice that I am using spice.
- You may have noticed that I am trying to share host’s
/home/arpith/partto the guest.
Once the VM boots up, mount that folder in the guest. To do so, run the following command in the guest.
- Remember the Kernel we compiled earlier? Install it.
Alternatively, you may use
-kernel option to load the kernel as described here, but I had some issues with networking and mouse pointer (which disappeared!). Hence the need for this workaround. (The issue is that the kernel does not load modules correctly when using the
-kernel option. Not sure what is the cause of this issue. Maybe I’ll look into this later when I have time. A quick solution is to change certain parameters in
=y. The driver is now built into the kernel.)
- Reboot the virtual machine. Ensure that it is running the kernel that you compiled with
Compile and Install NVMe CLI, liblightnvm and pblk-tools
- Install Nvme CLI
- Install liblightnvm
- Install pblk-tools
- If everything went according to plan, run the following command and check if a virtual disk is detected.