Skip to content

Commit 4c28a37

Browse files
chejianjacrnsi
authored andcommitted
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 <jian.jun.chen@intel.com> Reviewed-by: Binbin Wu <binbin.wu@intel.com>
1 parent bdae8ef commit 4c28a37

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

devicemodel/samples/nuc/launch_win.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
function launch_win()
4+
{
5+
vm_name=win_vm$1
6+
7+
#check if the vm is running or not
8+
vm_ps=$(pgrep -a -f acrn-dm)
9+
result=$(echo $vm_ps | grep "${vm_name}")
10+
if [[ "$result" != "" ]]; then
11+
echo "$vm_name is running, can't create twice!"
12+
exit
13+
fi
14+
15+
#for memsize setting
16+
mem_size=2048M
17+
18+
acrn-dm -A -m $mem_size -c $2 -s 0:0,hostbridge -s 1:0,lpc -l com1,stdio \
19+
-s 2,pci-gvt -G "$3" \
20+
-s 3,virtio-blk,./win10-ltsc.img \
21+
-s 4,virtio-net,tap0 \
22+
--ovmf ./OVMF.fd \
23+
$vm_name
24+
}
25+
26+
# offline SOS CPUs except BSP before launch UOS
27+
for i in `ls -d /sys/devices/system/cpu/cpu[1-99]`; do
28+
online=`cat $i/online`
29+
idx=`echo $i | tr -cd "[1-99]"`
30+
echo cpu$idx online=$online
31+
if [ "$online" = "1" ]; then
32+
echo 0 > $i/online
33+
# during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod
34+
while [ "$online" = "1" ]; do
35+
sleep 1
36+
echo 0 > $i/online
37+
online=`cat $i/online`
38+
done
39+
echo $idx > /sys/class/vhm/acrn_vhm/offline_cpu
40+
fi
41+
done
42+
43+
launch_win 1 1 "64 448 8"

0 commit comments

Comments
 (0)