Skip to content

Setup of a minimal debian rootfs for booting a given kernel image (e.g. bzImage) using Qemu/KVM.

Notifications You must be signed in to change notification settings

netgroup/linux-kernel-qemu-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QEMU/KVM Minimal Debian Image Setup

This repository provides scripts for creating a minimal Debian image, running a Linux kernel using QEMU/KVM, and accessing the VM via SSH. The setup allows you to easily test and develop with a custom Linux kernel in a lightweight virtualized environment.

Contents

  • create-image.sh: Script to build a minimal Debian image.
  • run.sh: Script to start a QEMU/KVM instance running the Linux kernel.
  • enter.sh: Script to log into the QEMU VM via SSH.

Prerequisites

Before you begin, ensure you have the following installed on your system:

  • QEMU
  • KVM (Kernel-based Virtual Machine)
  • Debian (for the base image)
  • ssh client for accessing the VM

Usage

Step 1: Create the Minimal Debian Image

The create-image.sh script builds a minimal Debian image. To run this script, execute the following command in your terminal:

./create-image.sh

This script will create a root filesystem that can be used by the QEMU/KVM instance.

Step 2: Run the QEMU/KVM Instance

Once you have the minimal image created, you can start the QEMU/KVM instance using the provided run.sh script. Make sure to have your Linux kernel image (bzImage) available in the same folder. You can run the script as follows:

./run.sh

This command will launch the QEMU instance with the following configurations:

  • The created Debian root filesystem will be used as the root for the VM.
  • The networking model is set to 'user', which avoids any complex configuration on the host machine.

Step 3: Accessing the QEMU VM

To log into the QEMU VM, use the enter.sh script which sets up port forwarding for SSH. Run the following command:

./enter.sh

This script configures your SSH client to connect to the VM via localhost on port 10022. You can access the VM by executing:

ssh -i <certificate>  -p 10022 root@localhost

Note that 'certificate' is created during the image creation and is available in the root folder.

Notes

  • Ensure that the QEMU/KVM process has sufficient permissions to run and access the required resources.
  • If you encounter any issues, check the logs generated by QEMU for debugging.
  • Modify the scripts as needed to fit your specific use case or environment.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! If you have suggestions or improvements, please feel free to submit a pull request.

About

Setup of a minimal debian rootfs for booting a given kernel image (e.g. bzImage) using Qemu/KVM.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages