script: fix hardcoded cmsis path

At present, clone_repos.sh for the SCP repository and to update
cmsis submodule in it, changes directory using 'cd cmsis'.
This is hardcoded and can break if the path is changed by the
SCP firmware repository.

This change uses 'git submodule status' command to get the exact
location of the submodule so that the script will continue to work
on the cmsis irrespective of the location availabe in the SCP firmware
repo.

Signed-off-by: Girish Pathak <girish.pathak@arm.com>
Change-Id: Ie3b9e9027c3d38196af261e15e02bb7f7bb716c5
diff --git a/script/build_package.sh b/script/build_package.sh
index f4ea34b..26294e0 100755
--- a/script/build_package.sh
+++ b/script/build_package.sh
@@ -1136,8 +1136,10 @@
 
 	pushd "$scp_root"
 
+	eval cmsis_dir="$(git submodule status | awk 'NR==1{print $2}')"
+
 	# Use filer submodule as a reference if it exists
-	if [ -d "$SCP_CHECKOUT_LOC/cmsis" ]; then
+	if [ -d "$SCP_CHECKOUT_LOC/$cmsis_dir" ]; then
 		cmsis_reference="--reference $SCP_CHECKOUT_LOC/cmsis"
 	fi
 
diff --git a/script/clone_repos.sh b/script/clone_repos.sh
index 0f0b3bc..c05046e 100755
--- a/script/clone_repos.sh
+++ b/script/clone_repos.sh
@@ -439,8 +439,11 @@
 		cmsis_reference="--reference $cmsis_ref_repo"
 	fi
 	git submodule -q update $cmsis_reference --init
+
+	eval cmsis_dir="$(git submodule status | awk 'NR==1{print $2}')"
+
 	# Workaround while fixing permissions on /arm/projectscratch/ssg/trusted-fw/ref-repos/cmsis
-	cd cmsis
+	cd $cmsis_dir
 	code_cov_emit_param "CMSIS" "URL" "$(git remote -v | grep fetch |  awk '{print $2}')"
 	code_cov_emit_param "CMSIS" "COMMIT" "$(git rev-parse HEAD)"
 	code_cov_emit_param "CMSIS" "REFSPEC" "master"