From 5ff68b8c191272fe9c80765fa6ac11c18aee3224 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sat, 4 Feb 2017 19:44:23 +0000 Subject: qemu and pkgmk-test.conf revision --- tools/qemu.html | 36 +++++++++++++++++-------- tools/scripts/pkgmk-test.conf | 2 +- tools/scripts/runvm/profile/crux | 3 +++ tools/scripts/runvm/runvm.sh | 22 +++++++++++++++ tools/scripts/system-qemu.sh | 58 ---------------------------------------- 5 files changed, 51 insertions(+), 70 deletions(-) create mode 100644 tools/scripts/runvm/profile/crux create mode 100644 tools/scripts/runvm/runvm.sh delete mode 100644 tools/scripts/system-qemu.sh (limited to 'tools') diff --git a/tools/qemu.html b/tools/qemu.html index 86fb7aa..1c58e49 100644 --- a/tools/qemu.html +++ b/tools/qemu.html @@ -193,9 +193,17 @@

Guest System

-

See scripts/system-qemu.sh, - as template. Run virtual machine that uses above tap device;

+

See scripts/runvm/runvm.sh, + as template. Example scripts;

+

runvm/profile/crux

+
+        iso=iso/crux-3.2.iso
+        image=img/crux-img.qcow2
+        tap="tap1"
+        
+ +

runvm/runvm.sh

         #!/bin/bash
 
@@ -203,14 +211,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 +222,19 @@
             -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 \
+            &
+        
+ +

Set guests machines to run under the total resolution provided + by host system configure grub on the guest with gfxmode;

+ +
+        GRUB_GFXMODE=640x480
+        GRUB_GFXPAYLOAD_LINUX=keep
         
Tools Index diff --git a/tools/scripts/pkgmk-test.conf b/tools/scripts/pkgmk-test.conf index 2336685..623c52c 100644 --- a/tools/scripts/pkgmk-test.conf +++ b/tools/scripts/pkgmk-test.conf @@ -22,7 +22,7 @@ case ${PKGMK_ARCH} in ;; esac - PKGMK_SOURCE_MIRRORS=(https://ports.c9.core/distfiles/) +PKGMK_SOURCE_MIRRORS=(https://c9.root.cx/ports/distfiles/) # PKGMK_SOURCE_DIR="$PWD" # PKGMK_PACKAGE_DIR="$PWD" # PKGMK_WORK_DIR="$PWD/work" diff --git a/tools/scripts/runvm/profile/crux b/tools/scripts/runvm/profile/crux new file mode 100644 index 0000000..eb2dc63 --- /dev/null +++ b/tools/scripts/runvm/profile/crux @@ -0,0 +1,3 @@ +iso=iso/crux-3.2.iso +image=img/crux-img.qcow2 +tap="tap1" diff --git a/tools/scripts/runvm/runvm.sh b/tools/scripts/runvm/runvm.sh new file mode 100644 index 0000000..db479cc --- /dev/null +++ b/tools/scripts/runvm/runvm.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +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 \ + & diff --git a/tools/scripts/system-qemu.sh b/tools/scripts/system-qemu.sh deleted file mode 100644 index 489af5e..0000000 --- a/tools/scripts/system-qemu.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -# First we define the function -ConfirmOrExit () -{ - while true - do - echo -n "Please confirm (y or n) :" - read CONFIRM - case $CONFIRM in - y|Y|YES|yes|Yes) break ;; - n|N|no|NO|No) - echo "Aborting - you entered $CONFIRM" - exit - ;; - *) echo "Please enter only y or n" - esac - done - echo "You entered $CONFIRM. Continuing ..." -} - -SCRIPT=$(readlink -f "$0") -# Absolute path this script is in, thus /home/user/bin -SCRIPTPATH=$(dirname "$SCRIPT") - -DIR=$(dirname "$SCRIPTPATH"); -DIR_LOCAL="$(dirname $(dirname ${DIR}))/local"; - -MEM=$1 -TAP=$2 -ISO_FILE="${DIR_LOCAL}/$3" -IMG="${DIR_LOCAL}/$4" - -echo "MEM (512): $MEM" -echo "TAP (tap1): $TAP" -echo "ISO_FILE (crux-3.2.iso): $ISO_FILE" -echo "IMG (crux-img.qcow2): $IMG" -ConfirmOrExit - -if [ "$ISO_FILE" = "$DIR_LOCAL/" ] -then - qemu-system-x86_64 \ - -enable-kvm \ - -m $MEM \ - -boot c \ - -hda ${IMG} \ - -net nic,model=virtio -net tap,ifname=${TAP},script=no,downscript=no -else - qemu-system-x86_64 \ - -enable-kvm \ - -m $MEM \ - -boot d \ - -cdrom ${ISO_FILE} \ - -hda ${IMG} \ - -net nic,model=virtio -net tap,ifname=${TAP},script=no,downscript=no -fi - -exit 0; -- cgit 1.4.1-2-gfad0