diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2022-08-08 15:15:34 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2022-08-09 06:54:46 +0300 |
commit | b164200092892a85dcf53a73e3bb56050da29834 (patch) | |
tree | 7da6ce3ae91ad2999530d5e9554d0193e12b4440 | |
parent | c1c74d03fed1e9387f2a759157333451ba5c429f (diff) | |
download | openbmc-b164200092892a85dcf53a73e3bb56050da29834.tar.xz |
meta-aspeed: otptool: Multiple configurations
Enable generating multiple OTP binaries by specifying multiple OTP
configuration files.
Change-Id: I1ce81cd2c1d0f501578b927eb31cce5a37cdcf1f
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r-- | meta-aspeed/classes/otptool.bbclass | 59 | ||||
-rw-r--r-- | meta-aspeed/classes/socsec-sign.bbclass | 14 | ||||
-rw-r--r-- | meta-ibm/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04.bbappend | 2 |
3 files changed, 44 insertions, 31 deletions
diff --git a/meta-aspeed/classes/otptool.bbclass b/meta-aspeed/classes/otptool.bbclass index 52625190e8..7da3e6ea81 100644 --- a/meta-aspeed/classes/otptool.bbclass +++ b/meta-aspeed/classes/otptool.bbclass @@ -2,43 +2,54 @@ # to create OTP image # The variables below carry default values to the create_otp() # function below. -OTPTOOL_CONFIG ?= "" +OTPTOOL_CONFIGS ?= "" OTPTOOL_KEY_DIR ?= "" OTPTOOL_EXTRA_OPTS ?= "" OTPTOOL_EXTRA_DEPENDS ?= " socsec-native" DEPENDS += '${@oe.utils.conditional("SOCSEC_SIGN_ENABLE", "1", "${OTPTOOL_EXTRA_DEPENDS}", "", d)}' +do_otptool() { + local otptool_config=$1 + 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} + + if [ $? -ne 0 ]; then + bbfatal "Generated OTP image failed." + fi + + otptool print "${otptool_config_outdir}"/otp-all.image + + if [ $? -ne 0 ]; then + bbfatal "Printed OTP image failed." + fi + + install -m 0644 -T \ + "${otptool_config_outdir}"/otp-all.image \ + ${DEPLOYDIR}/"${otptool_config_slug}"-otp-all.image +} + # Creates the OTP image create_otp_helper() { if [ "${SOC_FAMILY}" != "aspeed-g6" ] ; then bbwarn "OTP creation is only supported on AST2600 boards" - elif [ ! -e "${OTPTOOL_CONFIG}" ] ; then - bbfatal "Invalid otptool config: ${OTPTOOL_CONFIG}" + elif [ -z "${OTPTOOL_CONFIGS}" ] ; then + bbfatal "OTPTOOL_CONFIGS is empty, no otptool configurations available" 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} - - if [ $? -ne 0 ]; then - bbfatal "Generated OTP image failed." - fi + for otptool_config in ${OTPTOOL_CONFIGS} ; do + if [ ! -e ${otptool_config} ] ; then + bbfatal "Invalid otptool config: ${otptool_config}" + fi - otptool print "${otptool_config_outdir}"/otp-all.image - - if [ $? -ne 0 ]; then - bbfatal "Printed OTP image failed." - fi - - install -m 0644 -T \ - "${otptool_config_outdir}"/otp-all.image \ - ${DEPLOYDIR}/"${otptool_config_slug}"-otp-all.image + do_otptool $otptool_config + done fi } diff --git a/meta-aspeed/classes/socsec-sign.bbclass b/meta-aspeed/classes/socsec-sign.bbclass index da71b7c216..2f72c4e36b 100644 --- a/meta-aspeed/classes/socsec-sign.bbclass +++ b/meta-aspeed/classes/socsec-sign.bbclass @@ -61,13 +61,15 @@ sign_spl() { } verify_spl_otp() { - socsec verify \ - --sec_image ${DEPLOYDIR}/${SPL_IMAGE} \ - --otp_image ${DEPLOYDIR}/"$(basename ${OTPTOOL_CONFIG} .json)"-otp-all.image + for otptool_config in ${OTPTOOL_CONFIGS} ; do + socsec verify \ + --sec_image ${DEPLOYDIR}/${SPL_IMAGE} \ + --otp_image ${DEPLOYDIR}/"$(basename ${otptool_config} .json)"-otp-all.image - if [ $? -ne 0 ]; then - bbfatal "Verified OTP image failed." - fi + if [ $? -ne 0 ]; then + bbfatal "Verified OTP image failed." + fi + done } do_deploy:append() { diff --git a/meta-ibm/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04.bbappend b/meta-ibm/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04.bbappend index 2a99328e38..12e9f88201 100644 --- a/meta-ibm/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04.bbappend +++ b/meta-ibm/recipes-bsp/u-boot/u-boot-aspeed-sdk_2019.04.bbappend @@ -2,7 +2,7 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI:append:p10bmc = " file://a3.json file://keys/" -OTPTOOL_CONFIG:p10bmc = "${WORKDIR}/a3.json" +OTPTOOL_CONFIGS:p10bmc = "${WORKDIR}/a3.json" OTPTOOL_KEY_DIR:p10bmc = "${WORKDIR}/keys/" # !!! Do not copy p10bmc's use of little-endian key ordering !!! |