diff options
author | Silvino Silva <silvino@bk.ru> | 2017-08-06 18:48:50 +0100 |
---|---|---|
committer | Silvino Silva <silvino@bk.ru> | 2017-08-06 20:49:31 +0100 |
commit | 593fc597166839b42b8e48976447fa37c433a7af (patch) | |
tree | 2500dfaaaa3ede2b54a4343d215327fdf502b06c /tools | |
parent | 577fd6418b36ef6d0024a6ccbcf2640922401a31 (diff) | |
download | doc-593fc597166839b42b8e48976447fa37c433a7af.tar.gz |
tools qemu and core setup scripts revision
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qemu.html | 140 | ||||
-rw-r--r-- | tools/scripts/runvm/c12-dvd | 15 | ||||
-rw-r--r-- | tools/scripts/runvm/profile/crux | 10 | ||||
-rw-r--r-- | tools/scripts/runvm/runvm.sh | 14 |
4 files changed, 102 insertions, 77 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 \ - & + ${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 diff --git a/tools/scripts/runvm/c12-dvd b/tools/scripts/runvm/c12-dvd new file mode 100644 index 0000000..9cbf201 --- /dev/null +++ b/tools/scripts/runvm/c12-dvd @@ -0,0 +1,15 @@ +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-ehci -device usb-host,vendorid=0x13d3,productid=0x5652" diff --git a/tools/scripts/runvm/profile/crux b/tools/scripts/runvm/profile/crux index eb2dc63..af33e1b 100644 --- a/tools/scripts/runvm/profile/crux +++ b/tools/scripts/runvm/profile/crux @@ -1,3 +1,7 @@ -iso=iso/crux-3.2.iso -image=img/crux-img.qcow2 -tap="tap1" +mac="54:60:be:ef:5c:64" +memory=1024 +boot=$2 +tap="tap4" +iso=iso/crux-3.3.iso +image=img/c14.qcow2 +other="-vga std -display sdl" diff --git a/tools/scripts/runvm/runvm.sh b/tools/scripts/runvm/runvm.sh index db479cc..1e56a52 100644 --- a/tools/scripts/runvm/runvm.sh +++ b/tools/scripts/runvm/runvm.sh @@ -5,18 +5,22 @@ printf '54:60:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)) } source profile/$1 -boot=$2 -mac=$(rmac_addr) +#mac=$(rmac_addr) +#memory=1024 +#boot=d +#tap="tap1" +#iso=iso/crux-3.3.iso +#image=img/crux-standard.qcow2 +#other="-soundhw hda -vga std -display sdl" 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} \ & |