From owner-freebsd-arm@FreeBSD.ORG Mon Feb 11 06:11:04 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 57EB03F4 for ; Mon, 11 Feb 2013 06:11:04 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 2C14786F for ; Mon, 11 Feb 2013 06:11:03 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id r1B6B1rd010805; Mon, 11 Feb 2013 06:11:01 GMT (envelope-from tim@kientzle.com) Received: from [192.168.2.143] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id hmezjkabgapqzfw8nrnc77v8qs; Mon, 11 Feb 2013 06:11:00 +0000 (UTC) (envelope-from tim@kientzle.com) Subject: Re: building RaspPi Images Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: multipart/mixed; boundary="Apple-Mail=_0DC54B77-4C16-4E6E-8F21-53D8FA7DFB88" From: Tim Kientzle In-Reply-To: <7F7AE905-7A08-48EE-8905-8D688266739A@bsdimp.com> Date: Sun, 10 Feb 2013 22:11:00 -0800 Message-Id: <67660AAE-0489-40F1-9729-FF2F0C631DF8@kientzle.com> References: <5116CB50.9080303@ceetonetechnology.com> <7757848F-45C6-4DEF-A4A2-5F900EB10A06@kientzle.com> <20130210012052.4d7e1a46@ivory.local> <58DCA6BE-8C06-4F69-81A2-A3582FBB5B12@kientzle.com> <8087503F-BE98-45B9-888B-044D9DA58B80@bsdimp.com> <20130210212025.009ee482@bender> <1339E085-2B31-485D-9EED-9D0AFB7664C5@kientzle.com> <7F7AE905-7A08-48EE-8905-8D688266739A@bsdimp.com> To: Warner Losh X-Mailer: Apple Mail (2.1283) Cc: freebsd-arm@freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Feb 2013 06:11:04 -0000 --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--