summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-05-01 21:39:15 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-05-02 10:37:52 +0200
commit61eb23d44ebf5aa17f3367d35ae1609bc8497f48 (patch)
tree9a9c4ad0f697725133848530277a94131a50ee3b
parentebde5ae5ac1fa96211b974f444ceed4bc39c3d49 (diff)
downloadbarebox-61eb23d44ebf5aa17f3367d35ae1609bc8497f48.tar.gz
barebox-61eb23d44ebf5aa17f3367d35ae1609bc8497f48.tar.xz
uimage/file_to_sdram: fix resource allocation
file_to_sdram is used to load an initrd. The resource size is then used to pass the initrd size to Linux. This means that the resource size must exactly match the initrd size. Currently this is not the case since we request the sdram region in chunks of 8 Kbytes. Fix this by adjusting the resource size when the file is loaded. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/uimage.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/uimage.c b/common/uimage.c
index 4933c40583..945f3d6b0f 100644
--- a/common/uimage.c
+++ b/common/uimage.c
@@ -404,8 +404,12 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr)
res = NULL;
goto out;
}
- if (now < BUFSIZ)
+
+ if (now < BUFSIZ) {
+ release_sdram_region(res);
+ res = request_sdram_region("image", adr, ofs + now);
goto out;
+ }
release_sdram_region(res);