mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* bootm fixes
@ 2012-04-18  9:09 Steffen Trumtrar
  2012-04-18  9:09 ` [PATCH 1/2] bootm: Fix check for ret-value Steffen Trumtrar
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steffen Trumtrar @ 2012-04-18  9:09 UTC (permalink / raw)
  To: barebox

Hi all,

here are some bootm patches.
----------------------------------------------------------------
Steffen Trumtrar (2):
      bootm: Fix check for ret-value
      bootm: Align oftree

 commands/bootm.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] bootm: Fix check for ret-value
  2012-04-18  9:09 bootm fixes Steffen Trumtrar
@ 2012-04-18  9:09 ` Steffen Trumtrar
  2012-04-18  9:09 ` [PATCH 2/2] bootm: Align oftree Steffen Trumtrar
  2012-04-18 18:38 ` bootm fixes Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Steffen Trumtrar @ 2012-04-18  9:09 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

The intention of this code was to check the return value of fdt_open_into. Fix
this.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 commands/bootm.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index 1e1dc52..4f4cbb3 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -202,10 +202,9 @@ static int bootm_open_oftree(struct image_data *data, char *oftree, int num)
 	}
 
 	fdt = xrealloc(fdt, size + 0x8000);
-	fdt_open_into(fdt, fdt, size + 0x8000);
-
-	if (!fdt) {
-		printf("unable to read %s\n", oftree);
+	ret = fdt_open_into(fdt, fdt, size + 0x8000);
+	if (ret) {
+		printf("unable to parse %s\n", oftree);
 		return -ENODEV;
 	}
 
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] bootm: Align oftree
  2012-04-18  9:09 bootm fixes Steffen Trumtrar
  2012-04-18  9:09 ` [PATCH 1/2] bootm: Fix check for ret-value Steffen Trumtrar
@ 2012-04-18  9:09 ` Steffen Trumtrar
  2012-04-18 18:38 ` bootm fixes Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Steffen Trumtrar @ 2012-04-18  9:09 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

Arm needs 64-Bit alignment of the oftree as mentioned in the documentation
Documentation/arm/Booting.

Other architectures may need a bigger alignment so align to 4K.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 commands/bootm.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index 4f4cbb3..c89a3cc 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -150,7 +150,7 @@ static int bootm_open_initrd_uimage(struct image_data *data)
 static int bootm_open_oftree(struct image_data *data, char *oftree, int num)
 {
 	enum filetype ft;
-	struct fdt_header *fdt;
+	struct fdt_header *fdt, *fixfdt;
 	int ret;
 	size_t size;
 
@@ -201,21 +201,25 @@ static int bootm_open_oftree(struct image_data *data, char *oftree, int num)
 				file_type_to_string(ft));
 	}
 
-	fdt = xrealloc(fdt, size + 0x8000);
-	ret = fdt_open_into(fdt, fdt, size + 0x8000);
+	fixfdt = xmemalign(4096, size + 0x8000);
+	memcpy(fixfdt, fdt, size);
+
+	free(fdt);
+
+	ret = fdt_open_into(fixfdt, fixfdt, size + 0x8000);
 	if (ret) {
 		printf("unable to parse %s\n", oftree);
 		return -ENODEV;
 	}
 
-	ret = of_fix_tree(fdt);
+	ret = of_fix_tree(fixfdt);
 	if (ret)
 		return ret;
 
 	if (bootm_verbose(data) > 1)
-		fdt_print(fdt, "/");
+		fdt_print(fixfdt, "/");
 
-	data->oftree = fdt;
+	data->oftree = fixfdt;
 
 	return ret;
 }
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bootm fixes
  2012-04-18  9:09 bootm fixes Steffen Trumtrar
  2012-04-18  9:09 ` [PATCH 1/2] bootm: Fix check for ret-value Steffen Trumtrar
  2012-04-18  9:09 ` [PATCH 2/2] bootm: Align oftree Steffen Trumtrar
@ 2012-04-18 18:38 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2012-04-18 18:38 UTC (permalink / raw)
  To: Steffen Trumtrar; +Cc: barebox

On Wed, Apr 18, 2012 at 11:09:18AM +0200, Steffen Trumtrar wrote:
> Hi all,
> 
> here are some bootm patches.

Applied, thanks.

Sascha

> ----------------------------------------------------------------
> Steffen Trumtrar (2):
>       bootm: Fix check for ret-value
>       bootm: Align oftree
> 
>  commands/bootm.c |   19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-18 18:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-18  9:09 bootm fixes Steffen Trumtrar
2012-04-18  9:09 ` [PATCH 1/2] bootm: Fix check for ret-value Steffen Trumtrar
2012-04-18  9:09 ` [PATCH 2/2] bootm: Align oftree Steffen Trumtrar
2012-04-18 18:38 ` bootm fixes Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox