From f2d341eb19d222c96446a3a7f20eaef53dbcacfa Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 16 Feb 2021 22:34:33 +0000 Subject: deploy: e7acb2ed6b15dbd35350516a87e7b77e5ecbca0a --- tools/awk.html | 2 +- tools/bash.html | 2 +- tools/emacs.html | 2 +- tools/fish.html | 2 +- tools/gdb.html | 2 +- tools/git.html | 2 +- tools/gpg.html | 2 +- tools/index.html | 3 +- tools/qemu.html | 306 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/radare2.html | 6 +- tools/tmux.html | 2 +- tools/zsh.html | 2 +- 12 files changed, 320 insertions(+), 13 deletions(-) create mode 100644 tools/qemu.html (limited to 'tools') diff --git a/tools/awk.html b/tools/awk.html index 6dc1273..9c4cd2b 100644 --- a/tools/awk.html +++ b/tools/awk.html @@ -81,7 +81,7 @@ diff --git a/tools/bash.html b/tools/bash.html index 9b6327d..67b6648 100644 --- a/tools/bash.html +++ b/tools/bash.html @@ -81,7 +81,7 @@ diff --git a/tools/emacs.html b/tools/emacs.html index 67735c1..42df2e9 100644 --- a/tools/emacs.html +++ b/tools/emacs.html @@ -81,7 +81,7 @@ diff --git a/tools/fish.html b/tools/fish.html index e21d2b3..9e6d569 100644 --- a/tools/fish.html +++ b/tools/fish.html @@ -81,7 +81,7 @@ diff --git a/tools/gdb.html b/tools/gdb.html index 4947042..90e9568 100644 --- a/tools/gdb.html +++ b/tools/gdb.html @@ -81,7 +81,7 @@ diff --git a/tools/git.html b/tools/git.html index d417a73..8dde6c0 100644 --- a/tools/git.html +++ b/tools/git.html @@ -81,7 +81,7 @@ diff --git a/tools/gpg.html b/tools/gpg.html index b0d5f44..bc317f0 100644 --- a/tools/gpg.html +++ b/tools/gpg.html @@ -81,7 +81,7 @@ diff --git a/tools/index.html b/tools/index.html index 1625f5c..475a2d6 100644 --- a/tools/index.html +++ b/tools/index.html @@ -81,7 +81,7 @@ @@ -160,6 +160,7 @@
  • gpg
  • gdb
  • radare2
  • +
  • qemu
  • diff --git a/tools/qemu.html b/tools/qemu.html new file mode 100644 index 0000000..92c069b --- /dev/null +++ b/tools/qemu.html @@ -0,0 +1,306 @@ + + + + + + qemu - Notes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + + + + + + + +
    +
    +

    qemu(1)

    +

    All the examples & notes use qemu-system-x86_64 but in most cases +this can be swapped with the system emulator for other architectures.

    +

    Keybindings

    +
    Ctrl+Alt+g         release mouse capture from VM
    +
    +Ctrl+Alt+1         switch to display of VM
    +Ctrl+Alt+2         switch to qemu monitor
    +
    +

    VM config snippet

    +

    Following command-line gives a good starting point to assemble a VM:

    +
    qemu-system-x86_64                              \
    +        -cpu host -enable-kvm -smp 4            \
    +        -m 8G                                   \
    +        -vga virtio -display sdl,gl=on          \
    +        -boot menu=on                           \
    +        -cdrom <iso>                            \
    +        -hda <disk>                             \
    +        -device qemu-xhci,id=xhci               \
    +        -device usb-host,bus=xhci.0,vendorid=0x05e1,productid=0x0408,id=capture-card
    +
    +

    CPU & RAM

    +
      +
    • -cpu host emulate host CPU in guest VM
    • +
    • -enable-kvm use KVM instead software models (requires KVM on host machine)
    • +
    • -smp <N> number of guest CPUs
    • +
    +
    +

    List available CPUs qemu-system-x86_64 -cpu help.

    +
    +
      +
    • -m 8G size of guest RAM
    • +
    +

    Graphic & Display

    +
      +
    • -vga virtio use virtio as 3D video graphic accelerator (requires virgl in guest)
    • +
    • -display sdl,gl=on use sdl window and enable openGL context
    • +
    +

    Boot Menu

    +
      +
    • -boot menu=on enables boot menu to select boot device (enter with ESC)
    • +
    +

    Block devices

    +
      +
    • -cdrom <iso> attach cdrom drive with iso to a VM
    • +
    • -hda <disk> attach disk drive to a VM
    • +
    • -drive file=<file>,format=qcow2 generic way to configure & attach a drive to a VM
    • +
    +

    Create a disk with qemu-img

    +

    To create a qcow2 disk (qemu copy-on-write) of size 10G:

    +
    qemu-img create -f qcow2 disk.qcow2 10G
    +
    +

    The disk does not contain any partitions or a partition table. +We can format the disk from within the guest as following example:

    +
    # Create `gpt` partition table.
    +sudo parted /dev/sda mktable gpt
    +
    +# Create two equally sized primary partitions.
    +sudo parted /dev/sda mkpart primary 0% 50%
    +sudo parted /dev/sda mkpart primary 50% 100%
    +
    +# Create filesystem on each partition.
    +sudo mkfs.ext3 /dev/sda1
    +sudo mkfs.ext4 /dev/sda2
    +
    +lsblk -f /dev/sda
    +  NAME   FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
    +  sda
    +  ├─sda1 ext3         ....
    +  └─sda2 ext4         ....
    +
    +

    USB

    +

    Host Controller

    +
      +
    • -device qemu-xhci,id=xhci add XHCI USB controller to the VM (supports USB 3.0, 2.0, 1.1). id=xhci creates a usb bus named xhci.
    • +
    +

    USB Device

    +
      +
    • -device usb-host,bus=xhci.0,vendorid=0x05e1,productid=0x0408 pass-through USB device from host identified by vendorid & productid and attach to usb bus xhci.0 (defined with controller id)
    • +
    +

    References

    + + +
    + + +
    +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/radare2.html b/tools/radare2.html index dd68d76..1aacae4 100644 --- a/tools/radare2.html +++ b/tools/radare2.html @@ -81,7 +81,7 @@ @@ -179,7 +179,7 @@ - @@ -197,7 +197,7 @@ - diff --git a/tools/tmux.html b/tools/tmux.html index babad92..5ac0acd 100644 --- a/tools/tmux.html +++ b/tools/tmux.html @@ -81,7 +81,7 @@ diff --git a/tools/zsh.html b/tools/zsh.html index 1e419aa..4d9f6bf 100644 --- a/tools/zsh.html +++ b/tools/zsh.html @@ -81,7 +81,7 @@ -- cgit v1.2.3