Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tools/rimage/src/include/rimage/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ void module_close(struct module *module);
* @param module module structure
* @param mem_cfg memory configration structure
* @param verbose verbose logging selection
* @param ignore_detached do not mark detached sections
* @return error code
*/
void module_parse_sections(struct module *module, const struct memory_config *mem_cfg,
bool verbose);
bool verbose, bool ignore_detached);

/**
* Read module section to memory buffer
Expand Down
3 changes: 3 additions & 0 deletions tools/rimage/src/include/rimage/rimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ struct image {

/* Output image is a loadable module */
bool loadable_module;

/* Do not mark detached sections */
bool ignore_detached;
};

struct memory_zone {
Expand Down
5 changes: 3 additions & 2 deletions tools/rimage/src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ static enum module_section_type get_section_type(const struct elf_section_header
}
}

void module_parse_sections(struct module *module, const struct memory_config *mem_cfg, bool verbose)
void module_parse_sections(struct module *module, const struct memory_config *mem_cfg, bool verbose,
bool ignore_detached)
{
const uint32_t valid = (SHF_WRITE | SHF_ALLOC | SHF_EXECINSTR);
uint16_t i;
Expand Down Expand Up @@ -344,7 +345,7 @@ void module_parse_sections(struct module *module, const struct memory_config *me
out_section->size = sect->data.size;
out_section->type = get_section_type(sect);
out_section->rom = section_is_rom(mem_cfg, sect);
out_section->detached = section_is_detached(mem_cfg, sect);
out_section->detached = !ignore_detached && section_is_detached(mem_cfg, sect);
out_section->address = sect->data.vaddr;
out_section->load_address = find_physical_address(&module->elf, sect->data.vaddr);

Expand Down
10 changes: 8 additions & 2 deletions tools/rimage/src/rimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ static void usage(char *name)
fprintf(stdout, "\t -y verify signed file\n");
fprintf(stdout, "\t -q resign binary\n");
fprintf(stdout, "\t -p set PV bit\n");
fprintf(stdout, "\t -d ignore detached sections\n");
}

int main(int argc, char *argv[])
Expand All @@ -50,7 +51,7 @@ int main(int argc, char *argv[])

image.imr_type = MAN_DEFAULT_IMR_TYPE;

while ((opt = getopt(argc, argv, "ho:va:s:k:ri:f:b:ec:y:q:pl")) != -1) {
while ((opt = getopt(argc, argv, "ho:va:s:k:ri:f:b:ec:y:q:pld")) != -1) {
switch (opt) {
case 'o':
image.out_file = optarg;
Expand Down Expand Up @@ -101,6 +102,10 @@ int main(int argc, char *argv[])
case 'l':
image.loadable_module = true;
break;
case 'd':
/* ignore detached sections */
image.ignore_detached = true;
break;
default:
/* getopt's default error message is good enough */
return 1;
Expand Down Expand Up @@ -225,7 +230,8 @@ int main(int argc, char *argv[])
if (ret < 0)
goto out;

module_parse_sections(&image.module[i].file, &image.adsp->mem, image.verbose);
module_parse_sections(&image.module[i].file, &image.adsp->mem, image.verbose,
image.ignore_detached);

/* When there is more than one module, then first one is bootloader.
* Does not apply to building a image of a loadable module. */
Expand Down
Loading