From owner-freebsd-arm@FreeBSD.ORG Tue Apr 8 13:00:48 2014 Return-Path: Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6B1C96D8; Tue, 8 Apr 2014 13:00:48 +0000 (UTC) Received: from mho-01-ewr.mailhop.org (mho-03-ewr.mailhop.org [204.13.248.66]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EFEA1DFD; Tue, 8 Apr 2014 13:00:47 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1WXVdp-000Nff-74; Tue, 08 Apr 2014 13:00:41 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id s38D0b1M092683; Tue, 8 Apr 2014 07:00:37 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/M1swt0q5HUZywrs83oqPh Subject: Re: Latest u-boot release on BeagleBone Black for FreeBSD From: Ian Lepore To: Xuebing Wang In-Reply-To: <534250BE.9030202@gmail.com> References: <534250BE.9030202@gmail.com> Content-Type: text/plain; charset="us-ascii" Date: Tue, 08 Apr 2014 07:00:37 -0600 Message-ID: <1396962037.81853.405.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: albert.u.boot@aribaud.net, freebsd-arm@FreeBSD.org, u-boot@lists.denx.de, vanbaren@cideas.com, trini@ti.com X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Apr 2014 13:00:48 -0000 On Mon, 2014-04-07 at 15:16 +0800, Xuebing Wang wrote: > Hi u-boot community, > > I am trying to port u-boot (release u-boot-2014.04-rc3.tar.bz2) to > FreeBSD on BeagleBone Black. > > In FreeBSD, there is a u-boot loader (named ubldr), which can call > u-boot API to get fdt (Flat Device Tree) data. Example is: > -- fdt header > > I have to comment out below 3 lines, in order to get correct fdt data in > FreeBSD ubldr from u-boot. Would you please advice what is the best way > to fix this? > > In file common/env_common.c: > const uchar *env_get_addr(int index) > { > // if (gd->env_valid) > // return (uchar *)(gd->env_addr + index); > // else > return &default_environment[index]; > } > Are you using a fairly recent ubldr on the freebsd side? I made some changes around March 1st on how ubldr finds / loads fdt data... It first looks for env vars named fdtaddr then fdt_addr in the u-boot environment. If the variable exists it tries to validate the data at that address as a valid dtb header and if it is, that's the data that is passed to the kernel. Otherwise it next it looks for env vars named fdtfile then fdt_file. If one of those exists it tries to load that filename from the freebsd filesystem in the usual places where kernel and modules are located (/boot/kernel, /boot/modules). It seems strange to me that things work only if you comment out the dynamic environment in u-boot. You said "in order to get the correct fdt data" and I wonder what you mean by that. Do you mean that the u-boot script stuff is loading fdt data, but it's not the freebsd data but rather the linux data? Unfortunately, freebsd isn't able to use linux or vendor-supplied dtb files yet. We're working towards using only documented bindings but right now we still need freebsd-specific extra properties in the dtb. I added the support for fdtfile/fdt_file specifically to handle this situation until we're able to handle the vendor dtb files. If you manipulate your u-boot environment so that fdtaddr and fdt_addr are unset and fdtfile is the name of the appropriate freebsd dtb file (which you must install on your freebsd image along with the kernel), then everything should work out properly. Of course an alternative is to install the freebsd dtb files onto the msdos partition along with u-boot and let u-boot load them and set fdtaddr. If this is what you're doing and it still isn't working, I suspect the problem is in ubldr, not u-boot itself. We'll have to turn on some debugging in sys/boot/fdt/fdt_loader_cmd.c to track that down. -- Ian