From 593fc597166839b42b8e48976447fa37c433a7af Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sun, 6 Aug 2017 18:48:50 +0100 Subject: tools qemu and core setup scripts revision --- tools/qemu.html | 140 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 71 insertions(+), 69 deletions(-) (limited to 'tools/qemu.html') 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;

-        $ qemu-img create -f qcow2 crux-img.qcow2 20G
+        $ qemu-img create -f qcow2 crux-img.qcow2 2000M
         

Qemu disk images can be treated as regular disks using @@ -61,13 +61,25 @@ to use parted to create a gpt system table;

-        # 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
         
@@ -77,22 +89,30 @@
         

Use /dev/mapper/$(name_of_device) to assign correct blocks;

-        # 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
         

Mount partition;

-        # 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
         

Before disconnecting image, clean dev mappings;

@@ -200,41 +220,40 @@

runvm/profile/crux

-        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"
         

runvm/runvm.sh

-
-        #!/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 \
+            -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 \
-            &
+            ${other} \
+            &
         

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

-

Guest Graphics

+

Guest Graphics

Get current resolution on host machine;

@@ -270,53 +289,36 @@
         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"
         
-

runvm/runvm.sh

+

Guest USB

-        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
+        
- 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} \ - &> +
+        # chown root:kvm /dev/bus/usb/003/004
         
+
+        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"
+        
Tools Index

This is part of the c9 Manual. Copyright (C) 2016 -- cgit 1.4.1-2-gfad0