acrn-hypervisor/misc/packaging/acrn-hypervisor.preinst

77 lines
1.9 KiB
Plaintext
Raw Normal View History

#!/bin/bash
#* Copyright (c) 2020 Intel Corporation SPDX-License-Identifier: BSD-3-Clause
# preinst script for acrn-hypervisor
acrnnative=$(ls /sys/class/ |grep vhm || true)
if [ -z "$acrnnative" ]
then
echo "You are in ubuntu, let's pre-check whether fit acrn needs"
else
echo "You are in acrn already, no need pre-check "
exit 0
fi
#check mem/cpu
cpunumsexp=4
percode=$(lscpu |awk '$1 == "Thread(s)" {print $NF}')
cputotal=$(lscpu |awk '$1 == "CPU(s):" {print $NF}')
if [[ $cputotal -eq $cpunumsexp ]]
then
echo "CPU cores config is ok"
elif [[ $cputotal -gt $cpunumsexp ]]
then
echo "Error ! hyper threding config not correct!"
echo "CPU(s) $cputotal should be $cpunumsexpThread(s) per core is $percode,please disable hyperthread in bios"
elif [[ $cputotal -lt $cpunumsexp ]]
then
echo "Error ! hyper threding config not correct!"
echo "CPU(s) $cputotal should be $cpunumsexpThread(s) per core is $percode,please open hyperthread in bios"
fi
#check vt
vtd=$(ls -al /sys/firmware/acpi/tables |grep DMAR || true)
if [ -z "$vtd" ]
then
echo "Error ! vt-d not enabled!"
echo "either hw not support vt-d or bios not enabled"
fi
vtx=$(lscpu |grep VT-x)
if [ -z "$vtx" ]
then
echo "Error ! vt-x not enabled!"
echo "either hw not support vt-x or bios not enabled"
fi
echo "vt-x/vt-d config is ok"
#check cpu
cputype=$(lscpu |awk '$1 == "Model"'|grep Core || true)
if [ -z "$cputype" ]
then
echo "CPU type not Core"
echo "Xeon not support!"
echo "Waring ! ACRN may not support your hardware!"
else
echo "cpu type is ok"
fi
#check memory
totalmemry=200000000000
wholememory=$(cat /proc/meminfo |grep MemTotal:|awk '{print $2}')
if [[ $wholememory -gt $totalmemry ]]
then
echo "Warning ! memory greater than 16G, please rebuild hypervisor"
echo "if you had rebuild version please ignore"
else
echo "memory is ok, $wholememory"
fi