boot.sh 4.37 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/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=""

34
source $PWD/../sgi/sgi_common_util.sh
35

36
37
38
39
40
# List of all the supported platforms.
declare -A platforms_sgi
platforms_sgi[sgi575]=1
declare -A platforms_rdinfra
platforms_rdinfra[rdn1edge]=1
41
platforms_rdinfra[rdn1edgex2]=1
42
platforms_rdinfra[rde1edge]=1
43
platforms_rdinfra[rdv1]=1
44
platforms_rdinfra[rdv1mc]=1
45
platforms_rdinfra[rdn2]=1
46
platforms_rdinfra[rdn2cfg1]=1
47

48
__print_examples()
49
{
50
51
52
53
54
55
56
57
58
59
60
61
62
	echo "Example 1: ./boot.sh -p $1"
	echo "  Starts the execution of the $1 model and the software boots upto the"
	echo "  busybox prompt"
	echo ""
	echo "Example 2: ./boot.sh -p $1 -n true"
	echo "  Starts the execution of the $1 model and the software boots upto the"
	echo "  busybox prompt. The model supports networking allowing the software running"
	echo "   within the model to access the network."
	echo ""
	echo "Example 3: ./boot.sh -p $1 -n true -a \"board.flash0.diagnostics=1\""
	echo "  Starts the execution of the $1 model with networking enabled and the"
	echo "  software boots upto the busybox prompt. Additional parameters to the model"
	echo "  are supplied using the -a command line parameter."
63
64
65
66
67
}

print_usage ()
{
	echo ""
68
	echo "Boots upto busybox console on a specified platform."
69
	echo "Usage: ./boot.sh -p <platform> [-n <true|false>] [-a \"model params\"] [-j <true|false>]"
70
	echo ""
71
	echo "Supported command line parameters - "
72
73
	echo "  -p   Specifies the platform to be selected. See below for list of"
	echo "       platforms supported \(mandatory\)"
74
75
76
77
78
79
	echo "  -n   Enable or disable network controller support on the platform \(optional\)."
	echo "       If not specified, network support is disabled by default."
	echo "  -j   Enable or disable auto termination of the model after booting upto"
	echo "       a busybox shell \(optional\). If not specified, default behaviour is"
	echo "       to keep the model executing."
	echo "  -a   Additional model parameters \(optional\)."
80
	echo ""
81
82
	__print_supported_platforms_$refinfra
	__print_examples_$refinfra
83
84
85
	echo ""
}

86
while getopts "p:n:a:j:h" opt; do
87
88
89
90
	case $opt in
		p)
			platform=$OPTARG
			;;
91
92
		j)
			;;
93
94
95
96
97
98
99
100
101
102
		n|a)
			;;
		*)
			print_usage
			exit 1
			;;
	esac
done

#Ensure that the platform is supported
103
__parse_params_validate
104
105

platform_dir="platforms/$platform"
106
107
disk_image="$platform/grub-busybox.img"

108
pushd $platform_dir
109
set -- "$@" "-v" "../../../../output/$disk_image"
110
source ./run_model.sh
111
112
113
114
115
116
117

# if not model failed to start, return
if [ "$MODEL_PID" == "0" ] ; then
	exit 1
fi

# wait for boot to complete and the model to be killed
118
parse_log_file "$PWD/$platform/$UART0_ARMTF_OUTPUT_FILE_NAME" "/ #" 300
119
120
ret=$?

121
kill_model
122
123
124
125
126
127
128
129
130
sleep 3

if [ "$ret" != "0" ]; then
	echo "[ERROR]: Busybox boot test failed or timedout!"
	exit 1
else
	echo "[SUCCESS]: Busybox boot test completed!"
fi

131
132
popd
exit 0