Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Feb 2013 22:11:00 -0800
From:      Tim Kientzle <tim@kientzle.com>
To:        Warner Losh <imp@bsdimp.com>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: building RaspPi Images
Message-ID:  <67660AAE-0489-40F1-9729-FF2F0C631DF8@kientzle.com>
In-Reply-To: <7F7AE905-7A08-48EE-8905-8D688266739A@bsdimp.com>
References:  <5116CB50.9080303@ceetonetechnology.com> <7757848F-45C6-4DEF-A4A2-5F900EB10A06@kientzle.com> <20130210012052.4d7e1a46@ivory.local> <58DCA6BE-8C06-4F69-81A2-A3582FBB5B12@kientzle.com> <E691571B-EA19-4485-BB02-7486685B44C7@bsdimp.com> <EB4A0D67-9813-47DA-B3DB-F1309B2773F5@kientzle.com> <8087503F-BE98-45B9-888B-044D9DA58B80@bsdimp.com> <20130210212025.009ee482@bender> <ADEA1B10-6C17-43C8-B364-8819593D312E@bsdimp.com> <1339E085-2B31-485D-9EED-9D0AFB7664C5@kientzle.com> <7F7AE905-7A08-48EE-8905-8D688266739A@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_0DC54B77-4C16-4E6E-8F21-53D8FA7DFB88
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252

>=20
>>> The stand alone interface should, in theory, provide us with the =
DTB, but the code that is in ubldr doesn't seem to be reliably getitng =
this image.
>>=20
>> I don't think anyone has spent time on this.  We've
>> just been focused on "making it work" and the compiled-in
>> DTB does work for any single board.
>=20
> Ah, that makes sense. I just know the theory, not the practice.  I =
haven't had time for armv6 stuff=85

I started taking a look at this tonight.  It appears
we can get the FDT through the U-Boot API.

In particular, U-Boot exposes an environment
variable "fdtaddr" with the address of the FDT
blob in memory.  The attached (entirely untested)
patch might do the trick.

Hopefully I'll have time this week to rebuild all
the boot bits and test this.

Cheers,

Tim


--Apple-Mail=_0DC54B77-4C16-4E6E-8F21-53D8FA7DFB88
Content-Disposition: attachment;
	filename=t.diff
Content-Type: application/octet-stream;
	name="t.diff"
Content-Transfer-Encoding: 7bit

Index: fdt/fdt_loader_cmd.c
===================================================================
--- fdt/fdt_loader_cmd.c	(revision 246647)
+++ fdt/fdt_loader_cmd.c	(working copy)
@@ -238,23 +238,30 @@
 fdt_setup_fdtp()
 {
 	struct preloaded_file *bfp;
+	char *s, *p;
 	vm_offset_t va;
 
-	bfp = file_findfile(NULL, "dtb");
-	if (bfp == NULL) {
-		if ((va = fdt_find_static_dtb()) == 0) {
-			command_errmsg = "no device tree blob found!";
-			return (1);
+	if (bfp = file_findfile(NULL, "dtb") != NULL) {
+		return fdt_load_dtb(bfp->f_addr);
+	} 
+
+	/* Experiment:  See if we can get something reasonable out of U-Boot. */
+	/* (But don't try to use this yet.) */
+	s = ub_env_get("fdtaddr");
+	if (s != NULL && *s != '\0') {
+		va = strtoul(s, &p, 16);
+		if (**p == '\0') {
+			printf("U-Boot has offered us a device tree at: 0x%08lX\n", (unsigned long)va);
+			/* TODO: Try loading DTB */
 		}
-	} else {
-		/* Dynamic blob has precedence over static. */
-		va = bfp->f_addr;
 	}
 
-	if (fdt_load_dtb(va) != 0)
-		return (1);
-	
-	return (0);
+	if (va = fdt_find_static_dtb() != 0) {
+		return (fdt_load_dtb(va));
+	}
+
+	command_errmsg = "no device tree blob found!";
+	return (1);
 }
 
 #define fdt_strtovect(str, cellbuf, lim, cellsize) _fdt_strtovect((str), \

--Apple-Mail=_0DC54B77-4C16-4E6E-8F21-53D8FA7DFB88
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=windows-1252




--Apple-Mail=_0DC54B77-4C16-4E6E-8F21-53D8FA7DFB88--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?67660AAE-0489-40F1-9729-FF2F0C631DF8>