about summary refs log tree commit diff stats
path: root/tools/qemu.html
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2017-09-27 00:35:15 +0100
committerSilvino Silva <silvino@bk.ru>2017-09-27 00:35:15 +0100
commit6bf0c99f1320e117663e34221837c6fe22f75e6f (patch)
tree534f6c62b590298968d22b32a4d36366e0d583f2 /tools/qemu.html
parentb1b5779493352c72cced0251625d0b850ebac5b8 (diff)
parentb3a6bc5ad6b8f294efcbcf3c0039626918eccd69 (diff)
downloaddoc-6bf0c99f1320e117663e34221837c6fe22f75e6f.tar.gz
release 0.3.2
Diffstat (limited to 'tools/qemu.html')
-rw-r--r--tools/qemu.html140
1 files changed, 71 insertions, 69 deletions
diff --git a/tools/qemu.html b/tools/qemu.html
index fc0f15c..f79b955 100644
--- a/tools/qemu.html
+++ b/tools/qemu.html
@@ -43,7 +43,7 @@
         this describes how to create a qcow2 type;</p>
 
         <pre>
-        $ qemu-img create -f qcow2 crux-img.qcow2 20G
+        $ qemu-img create -f qcow2 crux-img.qcow2 2000M
         </pre>
 
         <p>Qemu disk images can be treated as regular disks using
@@ -61,13 +61,25 @@
         to use parted to create a gpt system table;</p>
 
         <pre>
-        # parted --script $DEV \
-            mklabel gpt \
-            mkpart ESP fat32 1MiB 120MiB \
-            mkpart primary ext4 120MiB 720MiB \
-            mkpart primary ext4 720MiB 2720MiB \
-            mkpart primary ext4 2720MiB 5000MiB \
-            set 1 boot on
+        parted --script ${DEV} \
+                mklabel gpt \
+                unit mib \
+                mkpart primary 1 3 \
+                set 1 bios_grub on \
+                name 1 grub \
+                mkpart ESP fat32 3 59 \
+                set 2 boot on \
+                name 2 efi \
+                mkpart primary ext4 103 200 \
+                name 3 boot \
+                mkpart primary linux-swap 200 456 \
+                name 4 swap \
+                mkpart primary ext4 456 3700 \
+                name 5 root \
+                mkpart primary ext4 3700 4000 \
+                name 6 var \
+                mkpart primary ext4 4000 100% \
+                name 7 home
         </pre>
 
         <pre>
@@ -77,22 +89,30 @@
         <p>Use /dev/mapper/$(name_of_device) to assign correct blocks;</p>
 
         <pre>
-        # mkfs.fat -F 32 $BLK_EFI
-        # mkfs.ext4 $BLK_BOOT
-        # mkfs.ext4 $BLK_ROOT
-        # mkfs.ext4 $BLK_VAR
+        mkfs.fat -F 32  /dev/mapper/${DEV_NAME}p2
+        mkfs.ext4       /dev/mapper/${DEV_NAME}p3
+        mkswap          /dev/mapper/${DEV_NAME}p4
+        mkfs.ext4       /dev/mapper/${DEV_NAME}p5
+        mkfs.ext4       /dev/mapper/${DEV_NAME}p6
+        mkfs.ext4       /dev/mapper/${DEV_NAME}p7
         </pre>
 
         <p>Mount partition;</p>
 
         <pre>
-        # mount $BLK_ROOT $CHROOT
-        # mkdir -p $CHROOT/boot
-        # mount $BLK_BOOT $CHROOT/boot
-        # mkdir -p $CHROOT/boot/efi
-        # mount $BLK_EFI $CHROOT/boot/efi
-        # mkdir -p $CHROOT/var
-        # mount $BLK_VAR $CHROOT/var
+        mount /dev/mapper/${DEV_NAME}p5 $CHROOT
+        mkdir -p $CHROOT/proc
+        mkdir -p $CHROOT/sys
+        mkdir -p $CHROOT/dev
+
+        mkdir -p $CHROOT/boot
+        mount /dev/mapper/${DEV_NAME}p3 $CHROOT/boot
+        mkdir -p $CHROOT/boot/efi
+        mount /dev/mapper/${DEV_NAME}p2 $CHROOT/boot/efi
+        mkdir -p $CHROOT/var
+        mount /dev/mapper/${DEV_NAME}p6 $CHROOT/var
+        mkdir -p $CHROOT/home
+        mount /dev/mapper/${DEV_NAME}p7 $CHROOT/home
         </pre>
 
         <p>Before disconnecting image, clean dev mappings;</p>
@@ -200,41 +220,40 @@
 
         <p>runvm/profile/crux</p>
         <pre>
-        iso=iso/crux-3.2.iso
-        image=img/crux-img.qcow2
+        mac=$(rmac_addr)
+        memory=1024
+        boot=d
         tap="tap1"
+        iso=iso/crux-3.3.iso
+        image=img/crux-standard.qcow2
+        other="-vga std -display sdl"
         </pre>
 
         <p>runvm/runvm.sh</p>
-        <pre>
-        #!/bin/bash
 
+        <pre>
         function rmac_addr (){
         printf '54:60:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256))
         }
 
         source profile/$1
-        boot=$2
-
-        mac=$(rmac_addr)
 
         qemu-system-x86_64 \
             -enable-kvm \
-            -m 1024 \
+            -m ${memory} \
             -boot ${boot} \
             -cdrom ${iso} \
             -hda ${image} \
-            -vga std \
-            -display sdl \
             -device e1000,netdev=t0,mac=${mac} \
             -netdev tap,id=t0,ifname=${tap},script=no,downscript=no \
-            &amp;
+            ${other} \
+            &
         </pre>
 
         <p>Set guests machines to run under the total resolution provided
         by  host system configure grub on the guest with gfxmode;</p>
 
-        <h3 id="guest">Guest Graphics</h2>
+        <h3 id="guest">Guest Graphics</h3>
 
         <p>Get current resolution on host machine;</p>
 
@@ -270,53 +289,36 @@
 
         <pre>
         export QEMU_AUDIO_DRV=alsa
-        #export QEMU_AUDIO_DRV=sdl
-
-
-        #boot=$1
+        memory=1024
         boot=c
-
-        iso=iso/crux-3.2.iso
-        #iso=$2
-
-        #image=$3
-        image=img/crux-img.qcow2
-
-        #tap=$4
-        tap="tap1"
-
-        #mac=$(rmac_addr)
+        iso=iso/devuan_jessie_1.0.0_amd64_CD.iso
+        image=img/c12-dvd.qcow2
+        tap="tap2"
         mac="54:60:be:ef:5c:72"
-
-        other="-soundhw hda"
+        other="-soundhw hda -vga std -display sdl"
         </pre>
 
-        <p>runvm/runvm.sh</p>
+        <h3 id="sound">Guest USB</h3>
 
         <pre>
-        function rmac_addr (){
-        printf '54:60:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256))
-        }
-
-        source profile/$1
-        boot=$2
-
-        #mac=$(rmac_addr)
+        # lsusb
+        # ls /dev/v4l
+        </pre>
 
-        qemu-system-x86_64 \
-            -enable-kvm \
-            -m 1024 \
-            -boot ${boot} \
-            -cdrom ${iso} \
-            -hda ${image} \
-            -vga std \
-            -display sdl \
-            -device e1000,netdev=t0,mac=${mac} \
-            -netdev tap,id=t0,ifname=${tap},script=no,downscript=no \
-            ${other} \
-            &>
+        <pre>
+        # chown root:kvm /dev/bus/usb/003/004
         </pre>
 
+        <pre>
+        export QEMU_AUDIO_DRV=alsa
+        memory=1024
+        boot=c
+        iso=iso/devuan_jessie_1.0.0_amd64_CD.iso
+        image=img/c12-dvd.qcow2
+        tap="tap2"
+        mac="54:60:be:ef:5c:72"
+        other="-soundhw hda -vga std -display sdl -usb -device usb-host,vendorid=0x13d3,productid=0x5652"
+        </pre>
         <a href="index.html">Tools Index</a>
         <p>This is part of the c9 Manual.
         Copyright (C) 2016