summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-02-24 10:31:44 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-02-24 10:40:03 +0100
commitb8cb663ac9fd627c9ee5efca1ca644385680e680 (patch)
treebf4e29685e462e9165c1e7979025803e8462c39b
parent59ec71f83114c4faf26872112819cd7ed4af5f73 (diff)
downloadbarebox-b8cb663ac9fd627c9ee5efca1ca644385680e680.tar.gz
scripts: imx-usb-loader: Fix i.MX8MM
Most things valid for the i.MX8MQ are needed for the i.MX8MM as well, so add a common macro which returns true for both SoCs and use it where appropriate. Also we have to search for the i.MX header in a bigger area as it is at offset 33KiB. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--scripts/imx/imx-image.c11
-rw-r--r--scripts/imx/imx-usb-loader.c2
-rw-r--r--scripts/imx/imx.c3
-rw-r--r--scripts/imx/imx.h6
4 files changed, 13 insertions, 9 deletions
diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index a9323f8..c39ceda 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -28,7 +28,6 @@
#include <fcntl.h>
#include <linux/kernel.h>
#include <sys/file.h>
-#include <mach/imx_cpu_types.h>
#include "../compiler.h"
#include "imx.h"
@@ -701,9 +700,9 @@ static int hab_sign(struct config_data *data)
}
/*
- * For i.MX8, write into the reserved CSF section
+ * For i.MX8M, write into the reserved CSF section
*/
- if (data->cpu_type == IMX_CPU_IMX8MQ)
+ if (cpu_is_mx8m(data))
outfd = open(data->outfile, O_WRONLY);
else
outfd = open(data->outfile, O_WRONLY | O_APPEND);
@@ -714,7 +713,7 @@ static int hab_sign(struct config_data *data)
exit(1);
}
- if (data->cpu_type == IMX_CPU_IMX8MQ) {
+ if (cpu_is_mx8m(data)) {
/*
* For i.MX8 insert the CSF data into the reserved CSF area
* right behind the PBL
@@ -779,7 +778,7 @@ static void *xread_file(const char *filename, size_t *size)
static bool cpu_is_aarch64(const struct config_data *data)
{
- return data->cpu_type == IMX_CPU_IMX8MQ;
+ return cpu_is_mx8m(data);
}
int main(int argc, char *argv[])
@@ -886,7 +885,7 @@ int main(int argc, char *argv[])
exit(1);
if (data.max_load_size && (data.encrypt_image || data.csf)
- && data.cpu_type != IMX_CPU_IMX8MQ) {
+ && !cpu_is_mx8m(&data)) {
fprintf(stderr, "Specifying max_load_size is incompatible with HAB signing/encrypting\n");
exit(1);
}
diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 0d7de7e..8447ca2 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -1332,7 +1332,7 @@ static int process_header(struct usb_work *curr, unsigned char *buf, int cnt,
unsigned *p_header_addr)
{
int ret;
- unsigned header_max = 0x800;
+ unsigned header_max = 0x10000;
unsigned header_inc = 0x400;
unsigned header_offset = 0;
int header_cnt = 0;
diff --git a/scripts/imx/imx.c b/scripts/imx/imx.c
index fd119e3..c820c9a 100644
--- a/scripts/imx/imx.c
+++ b/scripts/imx/imx.c
@@ -24,7 +24,6 @@
#include <errno.h>
#include <sys/stat.h>
#include <linux/kernel.h>
-#include <mach/imx_cpu_types.h>
#include "imx.h"
@@ -353,7 +352,7 @@ static int do_hab_blocks(struct config_data *data, int argc, char *argv[])
/*
* Ensure we only sign the PBL for i.MX8MQ
*/
- if (data->pbl_code_size && data->cpu_type == IMX_CPU_IMX8MQ) {
+ if (data->pbl_code_size && cpu_is_mx8m(data)) {
offset += data->header_gap;
signed_size = roundup(data->pbl_code_size + HEADER_LEN, 0x1000);
if (data->signed_hdmi_firmware_file)
diff --git a/scripts/imx/imx.h b/scripts/imx/imx.h
index 20fb1e8..d466e5d 100644
--- a/scripts/imx/imx.h
+++ b/scripts/imx/imx.h
@@ -1,4 +1,10 @@
#include <mach/imx-header.h>
+#include <mach/imx_cpu_types.h>
+
+static inline int cpu_is_mx8m(const struct config_data *data)
+{
+ return data->cpu_type == IMX_CPU_IMX8MQ || data->cpu_type == IMX_CPU_IMX8MM;
+}
int parse_config(struct config_data *data, const char *filename);