Skip to contentSkip to conversation

Please pull u-boot.git 'device_tree' branch

U-Boot-Users Kumar Gala 2 participants 3 messages Oct 25, 2006 – Oct 26, 2006

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

Please pull from 'device_tree' branch of git.kernel.org:/pub/scm/boot/u-boot/galak/u-boot.git

to receive the following updates:

  common/cmd_bootm.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++------
  1 file changed, 55 insertions(+), 6 deletions(-)

Kumar Gala:
Added support for Multi-Image files that contain a device tree

common/cmd_bootm.c +55 -6
index e8895c6..ab3c32c 100644
@@ -531,6 +531,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl
  	image_header_t *hdr = &header;
  #ifdef CONFIG_OF_FLAT_TREE
  	char	*of_flat_tree = NULL;
+	ulong	of_data = 0;
  #endif
 
  	if ((s = getenv ("initrd_high")) != NULL) {
@@ -745,11 +746,8 @@ #ifdef CONFIG_OF_FLAT_TREE
 
  		if  (*(ulong *)of_flat_tree == OF_DT_HEADER) {
  #ifndef CFG_NO_FLASH
-			if (addr2info((ulong)of_flat_tree) != NULL) {
-				printf ("Cannot modify flat device tree stored in flash\n" \
-					"Copy to memory before using the bootm command\n");
-				return;
-			}
+			if (addr2info((ulong)of_flat_tree) != NULL)
+				of_data = (ulong)of_flat_tree;
  #endif
  		} else if (ntohl(hdr->ih_magic) == IH_MAGIC) {
  			printf("## Flat Device Tree Image at %08lX\n", hdr);
@@ -804,7 +802,39 @@ #endif
  		}
  		printf ("   Booting using flat device tree at 0x%x\n",
  				of_flat_tree);
-	} else if(getenv("disable_of") == NULL) {
+	} else if ((hdr->ih_type==IH_TYPE_MULTI) && (len_ptr[1]) && (len_ptr[2])) {
+		u_long tail    = ntohl(len_ptr[0]) % 4;
+		int i;
+
+		/* skip kernel length, initrd length, and terminator */
+		of_data = (ulong)(&len_ptr[3]);
+		/* skip any additional image length fields */
+		for (i=2; len_ptr[i]; ++i)
+			of_data += 4;
+		/* add kernel length, and align */
+		of_data += ntohl(len_ptr[0]);
+		if (tail) {
+			of_data += 4 - tail;
+		}
+
+		/* add initrd length, and align */
+		tail = ntohl(len_ptr[1]) % 4;
+		of_data += ntohl(len_ptr[1]);
+		if (tail) {
+			of_data += 4 - tail;
+		}
+
+		if (((struct boot_param_header *)of_data)->magic != OF_DT_HEADER) {
+			printf ("ERROR: image is not a flat device tree\n");
+			return;
+		}
+
+		if (((struct boot_param_header *)of_data)->totalsize != ntohl(len_ptr[2])) {
+			printf ("ERROR: flat device tree size does not agree with image\n");
+			return;
+		}
+
+	} else if (getenv("disable_of") == NULL) {
  		printf ("ERROR: bootm needs flat device tree as third argument\n");
  		return;
  	}
@@ -900,6 +930,25 @@ #endif
  	(*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
 
  #else
+	/* move of_flat_tree if needed */
+	if (of_data) {
+		ulong of_start, of_len;
+		of_len = ((struct boot_param_header *)of_data)->totalsize;
+		/* provide extra 8k pad */
+		if (initrd_start)
+			of_start = initrd_start - of_len - 8192;
+		else
+			of_start  = (ulong)kbd - of_len - 8192;
+		of_start &= ~(4096 - 1);	/* align on page */
+		debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n",
+			of_data, of_data + of_len - 1, of_len, of_len);
+
+		of_flat_tree = (char *)of_start;
+		printf ("   Loading Device Tree to %08lx, end %08lx ... ",
+			of_start, of_start + of_len - 1);
+		memmove ((void *)of_start, (void *)of_data, of_len);
+	}
+
  	ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
  	/* ft_dump_blob(of_flat_tree); */
#1 lore raw
Quoted 10 lines · In message <[email protected]> you wrote:

Please pull from 'device_tree' branch of git.kernel.org:/pub/scm/boot/u-boot/galak/u-boot.git

to receive the following updates:

  common/cmd_bootm.c |   61 +++++++++++++++++++++++++++++++++++++++++++++++------
  1 file changed, 55 insertions(+), 6 deletions(-)

Kumar Gala:
Added support for Multi-Image files that contain a device tree

Ummm ... I pulled, but got no new commits. Especially...

common/cmd_bootm.c

Quoted 2 lines
common/cmd_bootm.c +0 -0
index e8895c6..ab3c32c 100644

... I didn't see neither e8895c6 nor ab3c32c ?

Of course I could apply your patch (and will do if you want), but I'd rather be able to pull from your repo.

Am I missing something? Maybe this is in some other branch?

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Brain: an apparatus with which we think we think.    - Ambrose Bierce
author
#2 lore raw
Quoted 21 lines · Wolfgang Denk

In message <[email protected]> you

Quoted 11 lines · wrote:

Please pull from 'device_tree' branch of git.kernel.org:/pub/scm/boot/u-boot/galak/u-boot.git

to receive the following updates:

  common/cmd_bootm.c |   61 +++++++++++++++++++++++++++++++++++++++ 
++++++++------
  1 file changed, 55 insertions(+), 6 deletions(-)

Kumar Gala:
Added support for Multi-Image files that contain a device tree

Ummm ... I pulled, but got no new commits. Especially...

common/cmd_bootm.c

Quoted 2 lines
common/cmd_bootm.c +0 -0
index e8895c6..ab3c32c 100644

... I didn't see neither e8895c6 nor ab3c32c ?

Quoted 4 lines

Of course I could apply your patch (and will do if you want), but I'd rather be able to pull from your repo.

Am I missing something? Maybe this is in some other branch?

Hmm, maybe its the extra colon. Try this url:

git://git.kernel.org/pub/scm/boot/u-boot/galak/u-boot.git

If I do a fresh git clone of that URL, and git checkout device_tree I get the change.

- kumar