Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- arch/arm/lib/armlinux.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c index 2415c29..ec9ad8e 100644 --- a/arch/arm/lib/armlinux.c +++ b/arch/arm/lib/armlinux.c @@ -241,7 +241,7 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[]) const char *commandline = getenv("bootargs"); int fd, ret; struct zimage_header header; - void *zimage; + void *zimage, *m; if (argc != 2) { barebox_cmd_usage(cmdtp); @@ -263,11 +263,15 @@ static int do_bootz(struct command *cmdtp, int argc, char *argv[]) zimage = xmalloc(header.end); memcpy(zimage, &header, sizeof(header)); - - ret = read(fd, zimage + sizeof(header), header.end - sizeof(header)); - if (ret < header.end - sizeof(header)) { - printf("could not read %s\n", argv[1]); - goto err_out1; + m = memmap(fd, PROT_READ); + if (m != (void *)-1) { + memcpy(zimage, m, header.end); + } else { + ret = read(fd, zimage + sizeof(header), header.end - sizeof(header)); + if (ret < header.end - sizeof(header)) { + printf("could not read %s\n", argv[1]); + goto err_out1; + } } theKernel = zimage; -- 1.7.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox