diff options
Diffstat (limited to 'tools/qemu.html')
-rw-r--r-- | tools/qemu.html | 132 |
1 files changed, 113 insertions, 19 deletions
diff --git a/tools/qemu.html b/tools/qemu.html index 86fb7aa..fc0f15c 100644 --- a/tools/qemu.html +++ b/tools/qemu.html @@ -43,22 +43,17 @@ this describes how to create a qcow2 type;</p> <pre> - $ qemu-img create -f qcow2 crux-img.qcow2 15G + $ qemu-img create -f qcow2 crux-img.qcow2 20G </pre> - <p>You can mount disk image;</p> + <p>Qemu disk images can be treated as regular disks using + qemu disk network block device server;</p> <pre> $ sudo modprobe nbd $ sudo qemu-nbd -c /dev/nbd0 /crux-img.qcow2 </pre> - <p>To disconnect image disk (ndb);</p> - - <pre> - $ sudo qemu-nbd -d /dev/nbd0 - </pre> - <p>Information about preparing <a href="../core/install.html#step2">partitions</a> and <a href="storage.html">storage</a> administration. @@ -100,6 +95,13 @@ # mount $BLK_VAR $CHROOT/var </pre> + <p>Before disconnecting image, clean dev mappings;</p> + + <pre> + $ sudo kpartx -d /dev/nbd0 + $ sudo qemu-nbd -d /dev/nbd0 + </pre> + <h2 id="net">2. Network</h2> <p>Network configuration;</p> @@ -193,9 +195,17 @@ <h2 id="guest">Guest System</h2> - <p>See <a href="scripts/system-qemu.sh">scripts/system-qemu.sh</a>, - as template. Run virtual machine that uses above tap device;</p> + <p>See <a href="scripts/runvm/runvm.sh">scripts/runvm/runvm.sh</a>, + as template. Example scripts;</p> + <p>runvm/profile/crux</p> + <pre> + iso=iso/crux-3.2.iso + image=img/crux-img.qcow2 + tap="tap1" + </pre> + + <p>runvm/runvm.sh</p> <pre> #!/bin/bash @@ -203,14 +213,9 @@ printf '54:60:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)) } - #boot=d - boot=$1 - #iso=crux-3.2.iso - iso=$2 - #image=crux-img.qcow2 - image=$3 - #tap="tap1" - tap=$4 + source profile/$1 + boot=$2 + mac=$(rmac_addr) qemu-system-x86_64 \ @@ -219,8 +224,97 @@ -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 \ + & + </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> + + <p>Get current resolution on host machine;</p> + + <pre> + $ xrandr --current | fgrep '*' + 1366x768 60.00*+ + </pre> + + <p>Set grub gfxmod on guest machine, edit /etc/default/grub;</p> + + <pre> + GRUB_GFXMODE=1366x768 + GRUB_GFXPAYLOAD_LINUX=keep + </pre> + + <p>Update grub configuration on guest machine;</p> + + <pre> + # update-grub + </pre> + + <h3 id="sound">Guest Sound</h3> + + <p>Check if DMAR is enable on kernel configuration, + Intel and AMD uses different technology. To check on + Inter machine run;</p> + + <pre> + # grep -e DMAR -e IOMMU + </pre> + + <p>runvm/profile/crux</p> + + <pre> + export QEMU_AUDIO_DRV=alsa + #export QEMU_AUDIO_DRV=sdl + + + #boot=$1 + boot=c + + iso=iso/crux-3.2.iso + #iso=$2 + + #image=$3 + image=img/crux-img.qcow2 + + #tap=$4 + tap="tap1" + + #mac=$(rmac_addr) + mac="54:60:be:ef:5c:72" + + other="-soundhw hda" + </pre> + + <p>runvm/runvm.sh</p> + + <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 \ + -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 + -netdev tap,id=t0,ifname=${tap},script=no,downscript=no \ + ${other} \ + &> </pre> <a href="index.html">Tools Index</a> |