From f2d341eb19d222c96446a3a7f20eaef53dbcacfa Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 16 Feb 2021 22:34:33 +0000 Subject: deploy: e7acb2ed6b15dbd35350516a87e7b77e5ecbca0a --- print.html | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 91 insertions(+), 3 deletions(-) (limited to 'print.html') diff --git a/print.html b/print.html index d3fa8d3..2b67942 100644 --- a/print.html +++ b/print.html @@ -83,7 +83,7 @@ @@ -165,6 +165,7 @@
  • gpg
  • gdb
  • radare2
  • +
  • qemu
  • zsh(1)

    Keybindings

    @@ -1533,6 +1534,93 @@ executed. To workaround that bug one can create a wrapper function which calls
      > r2 -B <baddr> <exe>         # open <exe> mapped to addr <baddr>
       oob <addr>                    # reopen current file at <baddr>
     
    +

    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

    + +
    +

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

    +
    + +

    Graphic & Display

    + +

    Boot Menu

    + +

    Block devices

    + +

    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

    + +

    USB Device

    + +

    References

    +

    Resource analysis & monitor