Skip to content

Commit

Permalink
Update fdt-parser to save off larger data images.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Nov 8, 2024
1 parent 763f939 commit 4a3beba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
15 changes: 7 additions & 8 deletions src/update_ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,13 @@ void RAMFUNCTION wolfBoot_start(void)
load_address = fit_load_image(fit, kernel, NULL);
}
if (flat_dt != NULL) {
dts_addr = fit_load_image(fit, flat_dt, NULL);
if (dts_addr != NULL) {
/* check DTS */
ret = wolfBoot_get_dts_size(dts_addr);
if (ret < 0) {
wolfBoot_printf("FIT FDT parsing failed!\n");
/* Allow failure, continue booting */
}
uint8_t *dts_ptr = fit_load_image(fit, flat_dt, (int*)&dts_size);
if (dts_ptr != NULL && wolfBoot_get_dts_size(dts_ptr) >= 0) {
/* relocate to load DTS address */
dts_addr = (uint8_t*)WOLFBOOT_LOAD_DTS_ADDRESS;
wolfBoot_printf("Loading DTS: %p -> %p (%d bytes)\n",
dts_ptr, dts_addr, dts_size);
memcpy(dts_addr, dts_ptr, dts_size);
}
}
}
Expand Down
12 changes: 8 additions & 4 deletions tools/fdt-parser/fdt-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,15 @@ int dts_parse(void* image)
if (plen > 32)
printf("\n%s", &tabs[MAX_DEPTH-depth-1]);
if (plen > 256) {
printf("Truncating to 256 bytes\n");
plen = 256;
char file[260+1];
snprintf(file, sizeof(file), "%s.%s.bin", nstr, pstr);
printf("Saving to file %s\n", file);
write_bin(file, (const uint8_t*)prop->data, plen);
}
else {
print_bin((const uint8_t*)prop->data, plen);
printf("\n");
}
print_bin((const uint8_t*)prop->data, plen);
printf("\n");
}
}
}
Expand Down

0 comments on commit 4a3beba

Please sign in to comment.