Signed-off-by: Bastian Krause <b...@pengutronix.de> --- rules/templates/template-barebox-imx-habv4-make | 2 +- scripts/lib/ptxd_lib_imx_hab.sh | 15 +++++++++++++-- 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 -- 2.26.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de