mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-02 20:35:32 +00:00
Creating VM images is always a pain to users, and it is especially the case for those who want to set up the ACRN sample application which needs two different VM images, one with graphical desktop and the other optimized for real-time. This patch introduces the so-called "image builder" utility which is a set of scripts that can automate the creation of those VM images. The scripts will take care of: - Forking image files based on Ubuntu cloud images and enlarge the root file system per needs. - Setting up users and passwords. - Installing necessary packages to run either the graphical desktop or real-time applications. - Specific to the RT VM image, disabling services and tweaking kernel command line for optimized real-time performance. - Copying the sample applications into the images so that users can start them directly, after they launch the VMs. Tracked-On: #7820 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
43 lines
1.1 KiB
Bash
43 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# Copyright (C) 2020-2022 Intel Corporation.
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
logger_prefix="(hmi-vm-rootfs) "
|
|
source logger.sh
|
|
|
|
function umount_directory() {
|
|
target_dir=$1
|
|
umount -q ${target_dir} || true
|
|
}
|
|
|
|
function update_package_info() {
|
|
apt update
|
|
apt install python3 python3-pip net-tools python3-matplotlib
|
|
pip3 install flask numpy pandas posix_ipc
|
|
|
|
}
|
|
|
|
function install_desktop() {
|
|
apt install ubuntu-gnome-desktop
|
|
}
|
|
|
|
function change_root_password() {
|
|
passwd root
|
|
}
|
|
|
|
function add_normal_user() {
|
|
useradd -s /bin/bash -d /home/acrn/ -m -G sudo acrn && \
|
|
passwd acrn
|
|
}
|
|
|
|
# Change current working directory to the root to avoid "target is busy" errors
|
|
# on unmounting.
|
|
cd /
|
|
|
|
try_step "Unmounting /root" umount_directory /root
|
|
try_step "Unmounting /home" umount_directory /home
|
|
try_step "Updating package information" update_package_info
|
|
try_step "Installing GNOME desktop" install_desktop
|
|
try_step "Changing the password of the root user" change_root_password
|
|
try_step "Adding the normal user acrn" add_normal_user
|