Commit 243112dd authored by Thomas Abraham's avatar Thomas Abraham Committed by Arvind Chauhan
Browse files

sgi: reorganize sgi platform model-scripts



The existing structure of the sgi575 platform model-scripts is not
extensible when adding support for additional sgi platforms and
test cases. So the sgi platform model-scripts have been reorganized
as below

    model-scripts
         |
          ---sgi
              |
              |--- distro-boot.sh
              |--- busybox-boot.sh
               --- platforms
                       |
                        --- sgi575
                              |
                               --- run_model.sh

The new 'sgi' directory will hold all the test scripts. The new
'platforms' directory will hold the platform specific run_model.sh
script and there is a directory for each supported platform.

The distro-boot.sh is now moved to 'sgi' directory and the changes
required to align with this new structure has been included in this
script. There is also a new 'busybox-boot.sh' script as well to be
used for busybox boot tests.

Change-Id: I78445bf59f0690900f60a819500ab455e1c14179
Signed-off-by: Thomas Abraham's avatarThomas Abraham <thomas.abraham@arm.com>
parent 53aa2099
#!/bin/bash
###############################################################################
# Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# Neither the name of ARM nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
platform_dir=""
declare -A sgi_platforms
sgi_platforms[sgi575]=1
__print_supported_sgi_platforms()
{
echo "Supported platforms are -"
for plat in "${!sgi_platforms[@]}" ;
do
printf "\t $plat \n"
done
echo
}
print_usage ()
{
echo "busybox_boot:"
echo ""
echo "Busybox boot on System Guidance for Infrastructure Models."
echo ""
echo "busybox_boot -p [platform]"
echo " -p - SGI platform name"
echo ""
echo "Examples:"
echo ""
echo " busybox_boot -p sgi575"
echo ""
}
while getopts "p:n:a:h" opt; do
case $opt in
p)
platform=$OPTARG
;;
n|a)
;;
*)
print_usage
exit 1
;;
esac
done
#Ensure that the platform is supported
if [ -z "$platform" ] ; then
print_usage
exit 1
fi
if [ -z "${sgi_platforms[$platform]}" ] ; then
echo "[ERROR] Could not deduce the selected platform."
__print_supported_sgi_platforms
exit 1
fi
platform_dir="platforms/$platform"
pushd $platform_dir
set -- "$@" "-f" "busybox"
source ./run_model.sh
popd
exit 0
......@@ -3,6 +3,22 @@
installer_image=""
disk_size=""
mode=""
platform_dir=""
network=false
extra_param=""
declare -A sgi_platforms
sgi_platforms[sgi575]=1
__print_supported_sgi_platforms()
{
echo "Supported platforms are -"
for plat in "${!sgi_platforms[@]}" ;
do
printf "\t $plat \n"
done
echo
}
install ()
{
......@@ -13,7 +29,8 @@ install ()
echo "Created $disk_name of size $disk_size GB, proceeding to install $installer_image ..."
./run_model.sh -v $installer_image -d $disk_name
pushd $platform_dir
./run_model.sh -v $installer_image -d $disk_name -n $network -a "$extra_param"
}
# This script allows a user to create a virtual satadisk and install either
......@@ -32,14 +49,15 @@ boot ()
case $num_available_images in
0)
echo "No available images found to boot from, please install one, see distr_boot -h for help"
echo "No available images found to boot from, please install one, see distro_boot -h for help"
exit 1
;;
1)
# In the case of exactly one, the list of images will
# be the image name so just use it
echo "Found $available_images, proceeding to boot ..."
./run_model.sh -d $available_images
pushd $platform_dir
./run_model.sh -d $available_images -n $network -a "$extra_param"
;;
*)
if [[ -z "$disk_image" ]]; then
......@@ -51,7 +69,8 @@ boot ()
echo ""
else
echo "Proceeding to boot supplied disk image name: $disk_image ..."
./run_model.sh -d $disk_image
pushd $platform_dir
./run_model.sh -d $disk_image -n $network -a "$extra_param"
fi
;;
esac
......@@ -63,12 +82,15 @@ print_usage ()
echo ""
echo " Install or boot Linux distos on System Guidance Models."
echo ""
echo "distro_boot -i [image] -s [disk size] -d [ disk image]"
echo "distro_boot -p [platform] -i [image] -s [disk size] -d [ disk image]"
echo " -p - SGI platform name"
echo " -i - Image, takes a path to an iso installer image"
echo " -s - Disk size in GB."
echo " -d - Disk image with previously installed distro, used for"
echo " disambiguation if there are more than one installed"
echo " concurrently"
echo " -n - Enable network: true or (default)false"
echo " -a - Additional model parameters, if any"
echo ""
echo " distro_boot must be called either with both -i and -s options or"
echo " with neither, please see examples below"
......@@ -77,20 +99,23 @@ print_usage ()
echo ""
echo " Install Fedora 27 on to a 16 GB disk"
echo ""
echo " distro_boot -i Fedora-Server-dvd-aarch64-27-1.6.iso -s 16"
echo " distro_boot -p sgi575 -i Fedora-Server-dvd-aarch64-27-1.6.iso -s 16"
echo ""
echo " Boot existing single install"
echo ""
echo " distro_boot"
echo " distro_boot -p sgi575"
echo ""
echo " Boot existing install from a set of intalled disks"
echo ""
echo " distro_boot -d bluepeter.satadisk"
echo " distro_boot -p sgi575 -d bluepeter.satadisk"
echo ""
}
while getopts "i:s:d:h" opt; do
while getopts "p:i:s:d:n:a:h" opt; do
case $opt in
p)
platform=$OPTARG
;;
i)
installer_image=$OPTARG
;;
......@@ -100,6 +125,12 @@ while getopts "i:s:d:h" opt; do
d)
disk_image=$OPTARG
;;
n)
network=$OPTARG
;;
a)
extra_param=$OPTARG
;;
*)
print_usage
exit 1
......@@ -125,6 +156,19 @@ else
exit 1
fi
#Ensure that the platform is supported
if [ -z "$platform" ] ; then
print_usage
exit 1
fi
if [ -z "${sgi_platforms[$platform]}" ] ; then
echo "[ERROR] Could not deduce the selected platform."
__print_supported_sgi_platforms
exit 1
fi
platform_dir="platforms/$platform"
case $mode in
install)
install
......
......@@ -17,15 +17,16 @@ GREEN_FONT="\e[32;1m"
YELLOW_FONT="\e[33;1m"
CURRENT_DATE="`date +%Y%m%d_%H-%M-%S`"
MYPID=$$
ROOTDIR="../../output/sgi575"
ROOTDIR="../../../../output/sgi575"
OUTDIR=${ROOTDIR}/sgi575
MODEL_TYPE="sgi575"
FS_TYPE="busybox"
MODEL_PARAMS=""
FS_TYPE=""
# Check that a path to the model has been provided
if [ ! -e "$MODEL" ]; then
#if no model path has been provided, assign a default path
MODEL="../../fastmodel/sgi/models/Linux64_GCC-4.9/FVP_CSS_SGI-575"
MODEL="../../../../fastmodel/sgi/models/Linux64_GCC-4.9/FVP_CSS_SGI-575"
if [ ! -f "$MODEL" ]; then
echo "ERROR: you should set variable MODEL to point to a valid SGI575 " \
"model binary, currently it is set to \"$MODEL\""
......@@ -145,23 +146,24 @@ if [[ -z $FIP_IMAGE ]]; then
FIP_IMAGE="fip-uefi.bin";
fi
if [[ ! -z $FS_TYPE ]] && [ ${FS_TYPE,,} == "busybox" ]; then
if [[ ${FS_TYPE,,} == "busybox" ]]; then
VIRTIO_IMAGE_PATH="${ROOTDIR}/grub-busybox.img"
fi
if [[ -n "$VIRTIO_IMAGE_PATH" ]]; then
KERNEL_ARGS="-C board.virtioblockdevice.image_path=${VIRTIO_IMAGE_PATH}"
MODEL_PARAMS="$MODEL_PARAMS \
-C board.virtioblockdevice.image_path=${VIRTIO_IMAGE_PATH}"
fi
if [[ -n "$SATADISK_IMAGE_PATH" ]]; then
KERNEL_ARGS="$KERNEL_ARGS \
MODEL_PARAMS="$MODEL_PARAMS \
-C pci.ahci.ahci.image_path="${SATADISK_IMAGE_PATH}""
fi
#For distribution installation and boot, ensure that the virtio devices
#behind the PCIe RC are not enumerated.
if [[ ! -z $FS_TYPE ]] && [ ${FS_TYPE,,} == "distro" ]; then
KERNEL_ARGS="$KERNEL_ARGS \
MODEL_PARAMS="$MODEL_PARAMS \
-C pci.pcidevice0.bus=0xFF \
-C pci.pcidevice1.bus=0xFF"
fi
......@@ -169,44 +171,43 @@ fi
mkdir -p ./$MODEL_TYPE
if [ ${NTW_ENABLE,,} == "true" ]; then
BOOT_ARGS="$BOOT_ARGS \
MODEL_PARAMS="$MODEL_PARAMS \
-C board.hostbridge.interfaceName="$INTERFACE_NAME" \
-C board.smsc_91c111.enabled=1"
fi
#check whether crypto plugin exists
if [ -e $PATH_TO_MODEL_ROOT/plugins/Linux64_GCC-4.9/Crypto.so ]; then
BOOT_ARGS="$BOOT_ARGS \
MODEL_PARAMS="$MODEL_PARAMS \
--plugin $PATH_TO_MODEL_ROOT/plugins/Linux64_GCC-4.9/Crypto.so"
fi
echo
echo "Starting model "$MODEL_TYPE
echo " KERNEL_ARGS = "$KERNEL_ARGS
echo " BOOT_ARGS = "$BOOT_ARGS
echo " MODEL_PARAMS = "$MODEL_PARAMS
echo " EXTRA_PARAMS = "$EXTRA_MODEL_PARAMS
echo
if [ ${MODEL_TYPE,,} == "sgi575" ]; then
${MODEL} \
-C css.cmn600.mesh_config_file="$PATH_TO_MODEL/SGI-575_cmn600.yml" \
-C css.cmn600.mesh_config_file="$PATH_TO_MODEL/SGI-575_cmn600.yml" \
-C css.cmn600.force_on_from_start=1 \
--data css.scp.armcortexm7ct=$OUTDIR/scp-ram.bin@0x0BD80000 \
-C css.mcp.ROMloader.fname="$OUTDIR/mcp-rom.bin" \
-C css.scp.ROMloader.fname="$OUTDIR/scp-rom.bin" \
-C css.trustedBootROMloader.fname="$OUTDIR/$BL1_IMAGE" \
-C board.flashloader0.fname="$OUTDIR/$FIP_IMAGE" \
${KERNEL_ARGS} \
-S -R \
-C css.scp.pl011_uart_scp.out_file=${MODEL_TYPE,,}/${UART0_SCP_OUTPUT_FILE_NAME} \
-C css.pl011_uart_ap.out_file=${MODEL_TYPE,,}/${UART0_CONSOLE_OUTPUT_FILE_NAME} \
-C soc.pl011_uart_mcp.out_file=${MODEL_TYPE,,}/${UART0_MCP_OUTPUT_FILE_NAME} \
-C soc.pl011_uart0.out_file=${MODEL_TYPE,,}/${UART0_ARMTF_OUTPUT_FILE_NAME} \
-C soc.pl011_uart0.unbuffered_output=1 \
-C soc.pl011_uart1.out_file=${MODEL_TYPE,,}/${UART1_MM_OUTPUT_FILE_NAME} \
-C soc.pl011_uart1.unbuffered_output=1 \
-C css.pl011_uart_ap.unbuffered_output=1 \
${BOOT_ARGS} \
${EXTRA_MODEL_PARAMS}
--data css.scp.armcortexm7ct=$OUTDIR/scp-ram.bin@0x0BD80000 \
-C css.mcp.ROMloader.fname="$OUTDIR/mcp-rom.bin" \
-C css.scp.ROMloader.fname="$OUTDIR/scp-rom.bin" \
-C css.trustedBootROMloader.fname="$OUTDIR/$BL1_IMAGE" \
-C board.flashloader0.fname="$OUTDIR/$FIP_IMAGE" \
-S -R \
-C css.scp.pl011_uart_scp.out_file=${MODEL_TYPE,,}/${UART0_SCP_OUTPUT_FILE_NAME} \
-C css.pl011_uart_ap.out_file=${MODEL_TYPE,,}/${UART0_CONSOLE_OUTPUT_FILE_NAME} \
-C soc.pl011_uart_mcp.out_file=${MODEL_TYPE,,}/${UART0_MCP_OUTPUT_FILE_NAME} \
-C soc.pl011_uart0.out_file=${MODEL_TYPE,,}/${UART0_ARMTF_OUTPUT_FILE_NAME} \
-C soc.pl011_uart0.unbuffered_output=1 \
-C soc.pl011_uart1.out_file=${MODEL_TYPE,,}/${UART1_MM_OUTPUT_FILE_NAME} \
-C soc.pl011_uart1.unbuffered_output=1 \
-C css.pl011_uart_ap.unbuffered_output=1 \
${MODEL_PARAMS} \
${EXTRA_MODEL_PARAMS}
else
:
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment