All Projects → pmem → run_qemu

pmem / run_qemu

Licence: CC0-1.0 License
A script to create bootable OS images, and run qemu with a locally built kernel.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to run qemu

Linux Kernel Module Cheat
The perfect emulation setup to study and develop the Linux kernel v5.4.3, kernel modules, QEMU, gem5 and x86_64, ARMv7 and ARMv8 userland and baremetal assembly, ANSI C, C++ and POSIX. GDB step debug and KGDB just work. Powered by Buildroot and crosstool-NG. Highly automated. Thoroughly documented. Automated tests. "Tested" in an Ubuntu 19.10 ho…
Stars: ✭ 2,748 (+17075%)
Mutual labels:  linux-kernel, qemu
Linux Lab
Docker/Qemu Based Linux Kernel Learning, Development and Testing Environment; New Linux ELF Video Course from this project author: https://www.cctalk.com/m/group/88089283
Stars: ✭ 771 (+4718.75%)
Mutual labels:  linux-kernel, qemu
Linux 0.11 Lab
Docker/Qemu/Bochs Based Linux 0.11 Kernel Development Environment; New Linux ELF Video Course from this project author: https://www.cctalk.com/m/group/88089283
Stars: ✭ 554 (+3362.5%)
Mutual labels:  linux-kernel, qemu
virtblkiosim
Virtual Linux block device driver for simulating and performing I/O.
Stars: ✭ 30 (+87.5%)
Mutual labels:  linux-kernel, qemu
FireMarshal
Software workload management tool for RISC-V based SoC research. This is the default workload management tool for Chipyard and FireSim.
Stars: ✭ 37 (+131.25%)
Mutual labels:  qemu
FEMU
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
Stars: ✭ 213 (+1231.25%)
Mutual labels:  qemu
kernel new features
一个深挖 Linux 内核的新功能特性,以 io_uring, cgroup, ebpf, llvm 为代表,包含开源项目,代码案例,文章,视频,架构脑图等
Stars: ✭ 1,094 (+6737.5%)
Mutual labels:  linux-kernel
Initium
A modern bootloader with no legacy components
Stars: ✭ 15 (-6.25%)
Mutual labels:  qemu
Sphinx-Dipper
Sphinx Custom Kernel for Mi 8 (Dipper)
Stars: ✭ 17 (+6.25%)
Mutual labels:  linux-kernel
PrawnOS
Libre Mainline Kernel and Debian for arm laptops
Stars: ✭ 73 (+356.25%)
Mutual labels:  linux-kernel
proton wsl2
Proton Kernel for the Windows Subsystem for Linux 2 (WSL 2). Highly experimental and always at the mercy of Windows Update.
Stars: ✭ 23 (+43.75%)
Mutual labels:  linux-kernel
TCP BBR
BBR implementation and research resources
Stars: ✭ 43 (+168.75%)
Mutual labels:  linux-kernel
how-to-qemu-arm-gdb-gtest
How to run, debug, and unit test ARM code on X86 ubuntu
Stars: ✭ 19 (+18.75%)
Mutual labels:  qemu
seals
Simple Embedded ARM Linux System
Stars: ✭ 28 (+75%)
Mutual labels:  linux-kernel
OpenHarmony
华为鸿蒙分布式操作系统(Huawei OpenHarmony)开发技术交流,鸿蒙技术资料,手册,指南,共建国产操作系统万物互联新生态。
Stars: ✭ 373 (+2231.25%)
Mutual labels:  linux-kernel
ProxmoxVE PHP API
ProxmoxVE PHP API
Stars: ✭ 78 (+387.5%)
Mutual labels:  qemu
qemu-android-x86-runner
Quick Start on How to Run Android x86 in QEMU
Stars: ✭ 102 (+537.5%)
Mutual labels:  qemu
ria-jit
Lightweight and performant dynamic binary translation for RISC–V code on x86–64
Stars: ✭ 38 (+137.5%)
Mutual labels:  qemu
mdepx
MDEPX — A BSD-style RTOS
Stars: ✭ 17 (+6.25%)
Mutual labels:  qemu
Baby-CPU-Scheduler
This is a very basic/lightweight yet a very performant CPU scheduler. You can use it for learning purposes as a base ground CPU scheduler on Linux.
Stars: ✭ 24 (+50%)
Mutual labels:  linux-kernel

Requirements

  • mkosi
    • e.g. dnf install mkosi
  • qemu-system-x86_64
  • nopasswd sudo preferred, or run as root, or enter passwords into the prompt several times
  • argbash to generate the argument parser lib (using parser_generator.m4)

Installation

  • symlink the run_qemu.sh script into somewhere in your PATH
    • e.g. ln -s ~/git/run_qemu/run_qemu.sh ~/bin/run_qemu.sh
  • Note: Supporting files in this repo are required to be in the same location as the script, after any symlink resolution. Copying just the script itself will not work.
  • Bash Completion
    • Copy or symlink the run_qemu file into the default bash completions dir
    • The completions directory can be found using: pkg-config --variable=completionsdir bash-completion

Usage Notes

  • Run this from the top level of a Linux kernel tree

    • e.g. run_qemu.sh --cxl --git-qemu
  • The script can/will:

    • Build the kernel with whatever .config is present (It is up to the user to manage the .config)
    • Create a rootfs image with the chosen distro using mkosi
    • Perform some basic setup on the rootfs, including installing the kernel, utilities (such as ndctl), and other convenience operations such as copying your ~/.ssh/id_rsa.pub for easy ssh access, and your ~/.bashrc etc.
    • Boot qemu with the newly compiled kernel provided on the qemu command line, and using the rootfs image above
    • Various options influence the qemu command line generated - there are options to select NUMA config, NVDIMMs, NVME devices, CXL devices etc.
  • More detailed CLI help is available with run_qemu.sh --help

  • Once qemu starts, in nographic mode, the Linux console 'takes over' the terminal. To interact with it, the following are useful:

    • Ctrl-a c : switch between the qemu monitor prompt (qemu) and console
    • Ctrl-a x : kill qemu and exit
  • mkosi creates a package cache in mkosi.cache/ If a cache is present, it will always use only that, and never go over the network even if newer packages are available. To force re-fetching everything, remove this directory, or --rebuild=wipe which removes the builddir entirely.

  • Which qemu to use can be overridden from the environment: qemu=/path/to/qemu/build/qemu-system-x86_64 ./run_qemu.sh [options]

  • List of variables that have overrides via env:

    • qemu
    • gdb
    • distro
    • rev
    • builddir
    • ndctl
  • To use the 'hostfwd' network, put this in your .ssh/config:

    Host rq
    Hostname localhost
    User root
    Port 10022
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    

    And then ssh rq. You may need to open port 10022 on any local firewalls.

  • The root password for the guest VM is root. The serial console automatically logs in, and a password isn't required.

CXL Usage

The script enables generating a sane QEMU commandline for instantiating a basic CXL topology. Since QEMU support for CXL isn't yet upstream, --git-qemu is additionally required. The CXL related options are:

  • --cxl: Enables a simple CXL topology with:
    • single host bridge
      • 512M window size at 0x4c00000000
      • Bus #52
    • single root port
    • single Type 3 device
      • Persistent 256M
    • simple label storage area
  • --cxl-debug: Add any and all flags for extra debug (kernel and QEMU)
  • --cxl-hb: Turn q35 into a CXL capable Host bridge. Don't use this option unless you're working on support for this.
  • --cxl-test-run: Attempt to do a sanity test of the kernel and QEMU configuration.

Kernel config

  • Make sure to Turn on CXL related options in the kernel's .config:
$ grep -i cxl .config
CONFIG_CXL_BUS=m
CONFIG_CXL_MEM=m
CONFIG_CXL_MEM_RAW_COMMANDS=y
CONFIG_CXL_ACPI=m

The following is a way to check basic sanity within the QEMU guest:

lspci  | grep '3[45]:00'
34:00.0 PCI bridge: Intel Corporation Device 7075
35:00.0 Memory controller [0502]: Intel Corporation Device 0d93 (rev 01)

readlink -f /sys/bus/cxl/devices/mem0
/sys/devices/pci0000:34/0000:34:00.0/0000:35:00.0/mem0
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].