From f6fd06dc2b20bc1adb149bf9ddfa8ffd9f9c76b3 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Thu, 2 May 2024 21:58:58 +0200 Subject: [PATCH] add qemu --- technology/linux/qemu.md | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/technology/linux/qemu.md b/technology/linux/qemu.md index 17a3a14..87e01fd 100644 --- a/technology/linux/qemu.md +++ b/technology/linux/qemu.md @@ -1,8 +1,41 @@ --- -website: https://www.qemu.org/ +website: https://www.qemu.org obj: application repo: https://github.com/qemu/qemu +rev: 2024-05-02 --- # QEMU -#wip #🐇 #notnow \ No newline at end of file +#wip #🐇 #notnow #review + +QEMU is an open-source emulator and virtualizer that enables running operating systems and various software applications on different hardware architectures. It supports [emulation](../emulation/Emulation.md) of various CPU architectures, including x86, ARM, PowerPC, and SPARC, among others. It allows running [virtual machines](../tools/Virtual%20Machine.md). + +## QCow Image +qcow is a file format for disk image files used by QEMU. It stands for "QEMU Copy On Write" and uses a disk storage optimization strategy that delays allocation of storage until it is actually needed. Files in qcow format can contain a variety of disk images which are generally associated with specific guest operating systems. Three versions of the format exist: qcow, qcow2 and qcow3 which use the .qcow, .qcow2 and .qcow3 file extensions, respectively. + +**Create a new image**: `qemu-img create -f qcow2 -s 10G my_image.qcow2` + +## Usage +### x86 +To use QEMU, you typically need a disk image containing the operating system you want to emulate. + +``` +qemu-system-x86_64 -drive +``` + +#### Options + +| Option | Description | Example | +| -------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `-cpu ` | Specifies the CPU model or architecture to emulate. This flag is useful for emulating different CPU types. | `qemu-system-x86_64 -cpu host` | +| `-smp ` | Specifies the number of CPU cores to emulate in the virtual machine. | `qemu-system-x86_64 -hda -smp 4` | +| `-m ` | Sets the amount of RAM to allocate for the virtual machine. | `qemu-system-x86_64 -m 2G -hda ` | +| `-netdev ` | Configures networking for the virtual machine. | `qemu-system-x86_64 -hda -netdev user,id=network0` | +| `-device ` | Adds a specific device to the virtual machine, such as a network interface card (NIC), graphics card, or sound card. | `qemu-system-x86_64 -hda -device e1000,netdev=network0` | +| `-display ` | Specifies the display driver to use for the virtual machine. Useful for setting up a graphical interface. | `qemu-system-x86_64 -hda -display gtk` | +| `-monitor` | Opens a monitor console for managing and interacting with the virtual machine during runtime. | `qemu-system-x86_64 -hda -monitor stdio` | +| `-vga ` | Specifies the graphics card model to emulate. Options include cirrus, std, vmware, qxl, and virtio. | `qemu-system-x86_64 -hda -vga virtio` | +| `-enable-kvm` | Enables KVM (Kernel-based Virtual Machine) acceleration if supported by the host system. This improves performance significantly. | `qemu-system-x86_64 -hda -enable-kvm` | +| `-drive ` | Allows more advanced configuration of disk drives, including specifying disk format, caching mode, and other options. | `qemu-system-x86_64 -drive file=,format=qcow2,cache=writeback` | +| `-cdrom ` | Specifies the CD-ROM image to use for booting or installing from a CD. | `qemu-system-x86_64 -cdrom ` | +| `-soundhw ` | Specifies the sound hardware to emulate in the virtual machine. | `qemu-system-x86_64 -hda -soundhw hda` |