From 1edb31d2d6a3e3f32b6123f5ca2bc43699e43895 Mon Sep 17 00:00:00 2001 From: Janusz Jankowski Date: Thu, 11 Apr 2019 14:09:02 +0200 Subject: [PATCH] rimage: add option to set imr type Signed-off-by: Janusz Jankowski --- rimage/man_apl.c | 1 - rimage/man_cnl.c | 1 - rimage/manifest.h | 1 + rimage/rimage.c | 11 ++++++++++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rimage/man_apl.c b/rimage/man_apl.c index d03aa54ae..ce634712c 100644 --- a/rimage/man_apl.c +++ b/rimage/man_apl.c @@ -108,7 +108,6 @@ struct fw_image_manifest_v1_8 apl_manifest = { .adsp_file_ext = { .ext_type = 17, .ext_len = sizeof(struct sof_man_adsp_meta_file_ext), - .imr_type = 3, .comp_desc[0] = { .version = 0, .base_offset = MAN_DESC_OFFSET_V1_8, diff --git a/rimage/man_cnl.c b/rimage/man_cnl.c index 545edb98f..4bd08dff0 100644 --- a/rimage/man_cnl.c +++ b/rimage/man_cnl.c @@ -107,7 +107,6 @@ struct fw_image_manifest_v1_8 cnl_manifest = { .adsp_file_ext = { .ext_type = 17, .ext_len = sizeof(struct sof_man_adsp_meta_file_ext), - .imr_type = 3, .comp_desc[0] = { .version = 0, .base_offset = MAN_DESC_OFFSET_V1_8, diff --git a/rimage/manifest.h b/rimage/manifest.h index 6622f521a..c6624b82e 100644 --- a/rimage/manifest.h +++ b/rimage/manifest.h @@ -42,6 +42,7 @@ #define MAN_DESC_OFFSET_V1_8 0x2000 #define MAN_DESC_OFFSET_V1_5 0x284 #define MAN_DESC_OFFSET_V1_5_SUE 0x2000 +#define MAN_DEFAULT_IMR_TYPE 3 #define MAN_CSS_HDR_OFFSET \ (MAN_CSE_HDR_OFFSET + \ diff --git a/rimage/rimage.c b/rimage/rimage.c index 46e14c309..8a64b421d 100644 --- a/rimage/rimage.c +++ b/rimage/rimage.c @@ -45,6 +45,7 @@ static void usage(char *name) fprintf(stdout, "\t -r enable relocatable ELF files\n"); fprintf(stdout, "\t -s MEU signing offset\n"); fprintf(stdout, "\t -p log dictionary outfile\n"); + fprintf(stdout, "\t -i set IMR type\n"); exit(0); } @@ -53,10 +54,11 @@ int main(int argc, char *argv[]) struct image image; const char *mach = NULL; int opt, ret, i, elf_argc = 0; + int imr_type = MAN_DEFAULT_IMR_TYPE; memset(&image, 0, sizeof(image)); - while ((opt = getopt(argc, argv, "ho:p:m:vba:s:k:l:r")) != -1) { + while ((opt = getopt(argc, argv, "ho:p:m:vba:s:k:l:ri:")) != -1) { switch (opt) { case 'o': image.out_file = optarg; @@ -82,6 +84,9 @@ int main(int argc, char *argv[]) case 'r': image.reloc = 1; break; + case 'i': + imr_type = atoi(optarg); + break; case 'h': usage(argv[0]); break; @@ -116,6 +121,10 @@ int main(int argc, char *argv[]) found: + /* set IMR Type in found machine definition */ + if (image.adsp->man_v1_8) + image.adsp->man_v1_8->adsp_file_ext.imr_type = imr_type; + /* parse input ELF files */ image.num_modules = argc - elf_argc; for (i = elf_argc; i < argc; i++) {