Update the scripts to automate tests on fpga_arm platform.

Change-Id: I8313440a5f45a37774de320fb0290c0eb9f03aea
Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
diff --git a/script/build_package.sh b/script/build_package.sh
index f373d58..b49c301 100755
--- a/script/build_package.sh
+++ b/script/build_package.sh
@@ -157,7 +157,7 @@
 		return
 	fi
 
-	if ! find "$from" \( -name "*.bin" -o -name '*.elf' -o -name '*.dtb' \) -exec cp -t "${to:?}" '{}' +; then
+	if ! find "$from" \( -name "*.bin" -o -name '*.elf' -o -name '*.dtb' -o -name '*.axf' \) -exec cp -t "${to:?}" '{}' +; then
 		echo "You probably are running local CI on local repositories."
 		echo "Did you set 'dont_clean' but forgot to run 'distclean'?"
 		die
diff --git a/script/test_fpga_payload.sh b/script/test_fpga_payload.sh
index be27918..ee878e2 100644
--- a/script/test_fpga_payload.sh
+++ b/script/test_fpga_payload.sh
@@ -23,6 +23,7 @@
 mkdir -p "$run_root"
 
 archive="$artefacts"
+bootargs_file="bootargs_file"
 
 gen_fpga_params() {
 	local fpga_param_file="fpga_env.sh"
@@ -33,11 +34,27 @@
 	echo "baudrate=$uart_baudrate" > $fpga_param_file
 	echo "fpga=$fpga" >> $fpga_param_file
 	echo "fpga_bitfile=$fpga_bitfile" >> $fpga_param_file
-	echo "fpga_payload=$fpga_payload" >> $fpga_param_file
 	echo "project_name=$project_name" >> $fpga_param_file
 	echo "port=$uart_port" >> $fpga_param_file
 	echo "uart=$uart_descriptor" >> $fpga_param_file
 
+	if [ -n "$bl33_img" ]; then
+        	echo "bl33_img=$bl33_img" >> $fpga_param_file
+		echo "bl33_addr=$bl33_addr" >> $fpga_param_file
+	fi
+
+	if [ -n "$initrd_img" ]; then
+        	echo "initrd_img=$initrd_img" >> $fpga_param_file
+		echo "initrd_addr=$initrd_addr" >> $fpga_param_file
+	fi
+
+	if [ -n "$bootargs" ]; then
+		echo "CMD:$bootargs" > $bootargs_file
+		archive_file "$bootargs_file"
+		echo "cmdline_file=$bootargs_file" >> $fpga_param_file
+		echo "cmdline_addr=$bootargs_addr" >> $fpga_param_file
+	fi
+
 	archive_file "$fpga_param_file"
 }
 
@@ -169,8 +186,18 @@
 echo
 
 # Copy the image to the remote host.
-scp "$artefacts_wd/$fpga_payload" "$remote_user@$remote_host:./$fpga_payload" > \
-							/dev/null
+if [ -n "$bl33_img" ]; then
+	scp "$artefacts_wd/$bl33_img" "$remote_user@$remote_host:." > /dev/null
+fi
+
+if [ -n "$initrd_img" ]; then
+	scp "$artefacts_wd/$initrd_img" "$remote_user@$remote_host:." > /dev/null
+fi
+
+if [ -n "$bootargs" ]; then
+	scp "$artefacts_wd/$bootargs_file" "$remote_user@$remote_host:." > /dev/null
+fi
+scp "$artefacts_wd/bl31.axf" "$remote_user@$remote_host:." > /dev/null
 
 # Copy the env and run scripts to the remote host.
 scp "$artefacts_wd/fpga_env.sh" "$remote_user@$remote_host:." > /dev/null
@@ -178,7 +205,12 @@
 
 echo "FPGA configuration options:"
 echo
-cat "$artefacts_wd/fpga_env.sh"
+while read conf_option; do
+	echo -e "\t$conf_option"
+done <$artefacts/fpga_env.sh
+if [ -n "$bootargs" ]; then
+echo -e "\tKernel bootargs: $bootargs"
+fi
 
 # For an automated run, export a known variable so that we can identify stale
 # processes spawned by Trusted Firmware CI by inspecting its environment.
@@ -194,7 +226,7 @@
 
 # Wait enough time for the UART to show up on the FPGA host so the connection
 # can be stablished.
-sleep 35
+sleep 65
 
 # If it's a test run, skip all the hoops and start a telnet connection to the FPGA.
 if upon "$test_run"; then
@@ -299,6 +331,8 @@
 	fi
 done
 
+ssh "$remote_user@$remote_host" "rm ./$fpga_run_script"
+
 cleanup
 
 if [ "$result" -eq 0 ]; then