From 4c28a374409849ddf5ac2e9711e1982e4fa0cd02 Mon Sep 17 00:00:00 2001 From: Jian Jun Chen Date: Fri, 10 May 2019 14:19:49 +0800 Subject: [PATCH] dm: add sample script to launch Windows as guest This patch adds one sample script to launch Windows as guest. Tracked-On: #3099 Signed-off-by: Jian Jun Chen Reviewed-by: Binbin Wu --- devicemodel/samples/nuc/launch_win.sh | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 devicemodel/samples/nuc/launch_win.sh diff --git a/devicemodel/samples/nuc/launch_win.sh b/devicemodel/samples/nuc/launch_win.sh new file mode 100755 index 000000000..eb00c3529 --- /dev/null +++ b/devicemodel/samples/nuc/launch_win.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +function launch_win() +{ +vm_name=win_vm$1 + +#check if the vm is running or not +vm_ps=$(pgrep -a -f acrn-dm) +result=$(echo $vm_ps | grep "${vm_name}") +if [[ "$result" != "" ]]; then + echo "$vm_name is running, can't create twice!" + exit +fi + +#for memsize setting +mem_size=2048M + +acrn-dm -A -m $mem_size -c $2 -s 0:0,hostbridge -s 1:0,lpc -l com1,stdio \ + -s 2,pci-gvt -G "$3" \ + -s 3,virtio-blk,./win10-ltsc.img \ + -s 4,virtio-net,tap0 \ + --ovmf ./OVMF.fd \ + $vm_name +} + +# offline SOS CPUs except BSP before launch UOS +for i in `ls -d /sys/devices/system/cpu/cpu[1-99]`; do + online=`cat $i/online` + idx=`echo $i | tr -cd "[1-99]"` + echo cpu$idx online=$online + if [ "$online" = "1" ]; then + echo 0 > $i/online + # during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod + while [ "$online" = "1" ]; do + sleep 1 + echo 0 > $i/online + online=`cat $i/online` + done + echo $idx > /sys/class/vhm/acrn_vhm/offline_cpu + fi +done + +launch_win 1 1 "64 448 8"