meta-aspeed: otptool: Embed config name in OTP image output filename

We're moving towards support for generating multiple OTP binaries per
platform configuration, so allow for differentiation in the file paths.

Change-Id: Iff01e524013fbf8cfdec0f8d7e7a599ee457514d
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/meta-aspeed/classes/otptool.bbclass b/meta-aspeed/classes/otptool.bbclass
index bb766c1..5262519 100644
--- a/meta-aspeed/classes/otptool.bbclass
+++ b/meta-aspeed/classes/otptool.bbclass
@@ -17,8 +17,12 @@
     elif [ ! -d "${OTPTOOL_KEY_DIR}" ] ; then
         bbfatal "Invalid otptool signing key directory: ${OTPTOOL_KEY_DIR}"
     else
+        otptool_config_slug="$(basename ${OTPTOOL_CONFIG} .json)"
+        otptool_config_outdir="${B}"/"${CONFIG_B_PATH}"/"${otptool_config_slug}"
+        mkdir -p "${otptool_config_outdir}"
         otptool make_otp_image \
             --key_folder ${OTPTOOL_KEY_DIR} \
+            --output_folder "${otptool_config_outdir}" \
             ${OTPTOOL_CONFIG} \
             ${OTPTOOL_EXTRA_OPTS}
 
@@ -26,15 +30,15 @@
             bbfatal "Generated OTP image failed."
         fi
 
-        otptool \
-            print \
-            ${B}/${CONFIG_B_PATH}/otp-all.image
+        otptool print "${otptool_config_outdir}"/otp-all.image
 
         if [ $? -ne 0 ]; then
             bbfatal "Printed OTP image failed."
         fi
 
-        install -m 0644 ${B}/${CONFIG_B_PATH}/otp-* ${DEPLOYDIR}
+        install -m 0644 -T \
+            "${otptool_config_outdir}"/otp-all.image \
+            ${DEPLOYDIR}/"${otptool_config_slug}"-otp-all.image
     fi
 }
 
diff --git a/meta-aspeed/classes/socsec-sign.bbclass b/meta-aspeed/classes/socsec-sign.bbclass
index d81a865..da71b7c 100644
--- a/meta-aspeed/classes/socsec-sign.bbclass
+++ b/meta-aspeed/classes/socsec-sign.bbclass
@@ -63,7 +63,7 @@
 verify_spl_otp() {
     socsec verify \
         --sec_image ${DEPLOYDIR}/${SPL_IMAGE} \
-        --otp_image ${DEPLOYDIR}/otp-all.image
+        --otp_image ${DEPLOYDIR}/"$(basename ${OTPTOOL_CONFIG} .json)"-otp-all.image
 
     if [ $? -ne 0 ]; then
         bbfatal "Verified OTP image failed."