From owner-freebsd-arm@FreeBSD.ORG Mon Feb 18 19:47: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 A0C22FB6 for ; Mon, 18 Feb 2013 19:47:04 +0000 (UTC) (envelope-from kientzle@freebsd.org) 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 5E510212 for ; Mon, 18 Feb 2013 19:47:04 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id r1IJl4Kd064776; Mon, 18 Feb 2013 19:47:04 GMT (envelope-from kientzle@freebsd.org) Received: from [192.168.2.143] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id h43krtw6728yvds5zije6w26qa; Mon, 18 Feb 2013 19:47:03 +0000 (UTC) (envelope-from kientzle@freebsd.org) Subject: Re: RPi hangs in bootloader Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii From: Tim Kientzle In-Reply-To: <51227033.3070304@thieprojects.ch> Date: Mon, 18 Feb 2013 11:47:03 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <51227033.3070304@thieprojects.ch> To: Werner Thie 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, 18 Feb 2013 19:47:04 -0000 > I do not understand the FDT_ERR_BADMAGIC, the page = http://www.denx.de/wiki/DULG/UBootCmdFDT has a lot of those errors = listed in an example session but does not explain what the message = conveys? To help me clarify my own understanding, I wrote a brief explanation of where we are with FDT handling that digs into how RPi boot handles FDT today and points out some of the work that still remains. What FDT is: FDT is a way for the kernel to find out what hardware it's running on; there is a DTS (source) file you can edit that gets compiled into a DTB (binary) file that is actually used to drive the kernel driver setup. FDT was standardized as part of OpenFirmware on PowerPC; it allows the system to boot very quickly and allows people who are changing hardware configurations to quickly adjust the system to match new hardware. How FreeBSD uses FDT: For a while, we've mostly been compiling the FDT into the kernel, but we're trying to move to a better design where the FDT is provided by the boot loader. This will eventually allow us to use a single kernel on multiple systems (the fabled "GENERIC ARM kernel") and make it much easier to configure boards (for example, if you connect a new peripheral via GPIO, you'll be able to "just" edit the DTS, compile a new DTB, and reboot to use that peripheral). How FreeBSD-on-RPi handles FDT: The RPi is closer to this boot process than other platforms (I'm working right now to move BeagleBone in this direction) but it's still evolving. Here's how the RPi handles the FDT when booting FreeBSD: * The RPi boot blocks load the DTB into memory. * The RPi boot blocks edit the DTB with information about graphics = setup * U-Boot runs and discovers some additional system information (but doesn't deal with the FDT) * FreeBSD ubldr runs, finds the DTB in memory [0] and edits it to contain memory configuration and some other related data that it queries from U-Boot. [1] * ubldr tells the FreeBSD kernel how to access the FDT. Tim [0] This is the key part that's still not quite right on RPi; ubldr should request the FDT from U-Boot whereas right now it has special knowledge of how the RPi boot blocks store the FDT in memory. I'm trying right now to teach ubldr how to get an FDT from U-Boot. (U-Boot can get the FDT from the RPi blocks, but we are not using that capability today.) [1] A less-serious weakness of the current process: Either U-Boot or the RPi boot blocks should be doing this editing, instead of ubldr getting the information from U-Boot using a different mechanism.