summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBastian Krause <bst@pengutronix.de>2020-05-15 16:26:33 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2020-05-15 17:22:07 +0200
commit3e150564474af6cd16ef804d7226ef5237c74c11 (patch)
tree5bdd50604f1e6860da737244fb3d13be0393e435
parentf67dc22691a8671ea3306f768712d3185f453077 (diff)
downloadptxdist-3e150564474af6cd16ef804d7226ef5237c74c11.tar.gz
ptxdist-3e150564474af6cd16ef804d7226ef5237c74c11.tar.xz
ptxd_lib_imx_hab/template-barebox-imx-habv4: make number of SRKs configurable
Signed-off-by: Bastian Krause <bst@pengutronix.de> Message-Id: <20200515142641.812-8-bst@pengutronix.de> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--rules/templates/template-barebox-imx-habv4-make2
-rw-r--r--scripts/lib/ptxd_lib_imx_hab.sh15
2 files changed, 14 insertions, 3 deletions
diff --git a/rules/templates/template-barebox-imx-habv4-make b/rules/templates/template-barebox-imx-habv4-make
index d8086f0cf..ec402afa1 100644
--- a/rules/templates/template-barebox-imx-habv4-make
+++ b/rules/templates/template-barebox-imx-habv4-make
@@ -74,7 +74,7 @@ $(STATEDIR)/barebox-@package@.compile:
@$(call targetinfo)
@$(call world/env, BAREBOX_@PACKAGE@) \
- ptxd_make_imx_habv4_gen_table "imx-habv4-srk%d"
+ ptxd_make_imx_habv4_gen_table "imx-habv4-srk%d" 4
@$(call world/compile, BAREBOX_@PACKAGE@)
diff --git a/scripts/lib/ptxd_lib_imx_hab.sh b/scripts/lib/ptxd_lib_imx_hab.sh
index 781c1b3f6..d1e2aba99 100644
--- a/scripts/lib/ptxd_lib_imx_hab.sh
+++ b/scripts/lib/ptxd_lib_imx_hab.sh
@@ -9,10 +9,12 @@
#
# ptxd_make_imx_habv4_gen_table - generate the srk fuse file and srk table for i.MX HABv4
#
-# usage: ptxd_make_imx_habv4_gen_table <template>
+# usage: ptxd_make_imx_habv4_gen_table <template> [<srk_count>]
#
# template: the role template to access the keys. Must contain a "%d" which is
# used as index
+# srk_count: the number of keys (keys with index 1..srk_count will be used),
+# defaults to 4
#
# The output files are generated in the package build dir:
#
@@ -24,13 +26,22 @@
#
ptxd_make_imx_habv4_gen_table_impl() {
local template="${1}"
+ local srk_count="${2}"
local table_bin="${pkg_build_dir}/imx-srk-table.bin"
local srk_fuse_bin="${pkg_build_dir}/imx-srk-fuse.bin"
local -a certs
+ if [ -z "${srk_count}" ]; then
+ srk_count=4
+ fi
+
+ if [ "${srk_count}" -gt 4 ]; then
+ ptxd_bailout "HABv4 allows only 4 certificates"
+ fi
+
echo -e "generating $(basename ${table_bin}) and $(basename ${srk_fuse_bin})\n"
- for i in 1 2 3 4; do
+ for i in $(seq ${srk_count}); do
certs[${#certs[*]}]="$(cs_get_ca "$(printf "${template}" ${i})")"
done