Skip to content
Snippets Groups Projects
Commit b5bb0eb2 authored by Jonas Höglund's avatar Jonas Höglund
Browse files

Extract image to file.

parent 34c12c48
No related branches found
No related tags found
No related merge requests found
......@@ -101,7 +101,7 @@ static int extract_image(char *buf, char *name, char *out)
return -1;
}
printf("Extracting: %s to %s.\n", name, out);
printf("Extracting %s to %s.\n", name, out);
/* Get offset of image. Try both relative and absolute offset. */
val = fdt_getprop(buf, noffset, "data-offset", NULL);
......@@ -112,15 +112,13 @@ static int extract_image(char *buf, char *name, char *out)
} else {
/* Absolute offset */
val = fdt_getprop(buf, noffset, "data-position", NULL);
if (!val) {
printf("Error: could get offset of image: %s.\n", name);
return -1;
}
data_offset = fdt32_to_cpu(*val);
}
if (!val) {
printf("Error: could get offset of image: %s.\n", name);
return -1;
}
data_offset = fdt32_to_cpu(*val);
/* Size */
val = fdt_getprop(buf, noffset, "data-size", NULL);
if (!val) {
......@@ -129,7 +127,6 @@ static int extract_image(char *buf, char *name, char *out)
}
data_size = fdt32_to_cpu(*val);
printf("Offset:0x%08x Size:0x%08x\n", data_offset, data_size);
fd = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0666);
if (fd < 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment