[PATCH v2 22/29] scripts: imx: add hab_qspi support

Marco Felsch m.felsch at pengutronix.de
Tue Oct 17 07:51:24 PDT 2023


Add 'hab_qspi' command which can be specified by .imxcfg board config
files to request building HAB compatible QSPI images.

Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
---
Changelog:
v2:
- new patch
- v1-link: https://lore.barebox.org/barebox/20231010143314.2031253-1-m.felsch@pengutronix.de/T/#t

 include/mach/imx/imx-header.h |  1 +
 scripts/imx/imx.c             | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/include/mach/imx/imx-header.h b/include/mach/imx/imx-header.h
index 372dee6cb8e9..d0381f4763ee 100644
--- a/include/mach/imx/imx-header.h
+++ b/include/mach/imx/imx-header.h
@@ -120,6 +120,7 @@ struct config_data {
 	char *signed_hdmi_firmware_file;
 	int encrypt_image;
 	size_t dek_size;
+	bool hab_qspi_support;
 };
 
 #define MAX_RECORDS_DCD_V2 1024
diff --git a/scripts/imx/imx.c b/scripts/imx/imx.c
index 50f44d5cb896..12c0df063469 100644
--- a/scripts/imx/imx.c
+++ b/scripts/imx/imx.c
@@ -299,6 +299,23 @@ static int do_max_load_size(struct config_data *data, int argc, char *argv[])
 	return 0;
 }
 
+static int do_hab_qspi(struct config_data *data, int argc, char *argv[])
+{
+	/*
+	 * Force 'hab_qspi' to specified before any 'hab' to ensure correct CSF
+	 * generation.
+	 */
+	if (data->csf) {
+		fprintf(stderr,
+			"'hab_qspi' must be specified before any 'hab' command\n");
+		return -EINVAL;
+	}
+
+	data->hab_qspi_support = true;
+
+	return 0;
+}
+
 static int hab_add_str(struct config_data *data, const char *str)
 {
 	data->csf = strcata(data->csf, str);
@@ -709,6 +726,9 @@ struct command cmds[] = {
 	}, {
 		.name = "hab_encrypt_blocks",
 		.parse = do_hab_encrypt_blocks,
+	}, {
+		.name = "hab_qspi",
+		.parse = do_hab_qspi,
 	}, {
 		.name = "super_root_key",
 		.parse = do_super_root_key,
-- 
2.39.2




More information about the barebox mailing list