mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 10:04:42 +00:00
DM: VMcfg: mrb-env-setup.sh
Script that setup envriment on MRB platform, for UOS with build-in configuration For example, you need to run mrb-env-setup.sh once, to prepare images, networks and pci-stubs, etc,. Tracked-On: #1528 Acked-by: Yin Fengwei <fengwei.yin@intel.com> Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
This commit is contained in:
committed by
wenlingz
parent
d2ed9955fd
commit
321021ebaf
45
devicemodel/vmcfg/apl-mrb/mrb-env-setup.sh
Executable file
45
devicemodel/vmcfg/apl-mrb/mrb-env-setup.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -b "/dev/mmcblk1p3" ]; then
|
||||
echo "no /dev/mmcblk1p3 data partition, exit"
|
||||
exit
|
||||
fi
|
||||
|
||||
mkdir -p /data
|
||||
mount /dev/mmcblk1p3 /data
|
||||
|
||||
if [ ! -f "/data/android/android.img" ]; then
|
||||
echo "no /data/android/android.img, exit"
|
||||
exit
|
||||
fi
|
||||
|
||||
# create a unique tap device for each VM
|
||||
tap=tap_AaaG
|
||||
tap_exist=$(ip a | grep acrn_"$tap" | awk '{print $1}')
|
||||
if [ "$tap_exist"x != "x" ]; then
|
||||
echo "tap device existed, reuse acrn_$tap"
|
||||
else
|
||||
ip tuntap add dev acrn_$tap mode tap
|
||||
fi
|
||||
|
||||
# if acrn-br0 exists, add VM's unique tap device under it
|
||||
br_exist=$(ip a | grep acrn-br0 | awk '{print $1}')
|
||||
if [ "$br_exist"x != "x" -a "$tap_exist"x = "x" ]; then
|
||||
echo "acrn-br0 bridge aleady exists, adding new tap device to it..."
|
||||
ip link set acrn_"$tap" master acrn-br0
|
||||
ip link set dev acrn_"$tap" down
|
||||
ip link set dev acrn_"$tap" up
|
||||
fi
|
||||
|
||||
modprobe pci_stub
|
||||
|
||||
# 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
|
||||
Reference in New Issue
Block a user