acrn-hypervisor/devicemodel/samples/nuc/launch_uos.sh

53 lines
1.5 KiB
Bash
Raw Normal View History

#!/bin/bash
kernel_version=$(uname -r | awk -F. '{ printf("%d.%d", $1,$2) }')
function launch_clear()
{
vm_name=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 5,virtio-console,@pty:pty_port \
-s 6,virtio-hyper_dmabuf \
-s 3,virtio-blk,/root/clear-23690-kvm.img \
-s 4,virtio-net,tap0 \
-k /usr/lib/kernel/org.clearlinux.pk414-standard.4.14.52-63 \
-B "root=/dev/vda3 rw rootwait maxcpus=$2 nohpet console=tty0 console=hvc0 \
console=ttyS0 no_timer_check ignore_loglevel log_buf_len=16M \
consoleblank=0 tsc=reliable i915.avail_planes_per_pipe=$4 \
i915.enable_hangcheck=0 i915.nuclear_pageflip=1 i915.enable_guc_loading=0 \
i915.enable_guc_submission=0 i915.enable_guc=0" $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
echo $idx > /sys/class/vhm/acrn_vhm/offline_cpu
fi
done
gvt_args=0x070F00
# this is the temporal solution before plane_restriction is ready on 4.19
if [ "$kernel_version" = "4.19" ]; then
gvt_args=0
fi
launch_clear 1 1 "64 448 8" $gvt_args clear