From owner-freebsd-embedded@FreeBSD.ORG Mon Oct 13 19:49:49 2008 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10A811065687 for ; Mon, 13 Oct 2008 19:49:49 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id A24258FC0A for ; Mon, 13 Oct 2008 19:49:48 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id m9DJkIg9045094; Mon, 13 Oct 2008 13:46:19 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 13 Oct 2008 13:47:20 -0600 (MDT) Message-Id: <20081013.134720.1079617746.imp@bsdimp.com> To: bms@incunabulum.net From: "M. Warner Losh" In-Reply-To: <48F3A0EE.7040003@incunabulum.net> References: <48F39798.3010606@incunabulum.net> <20081013.125648.1239212699.imp@bsdimp.com> <48F3A0EE.7040003@incunabulum.net> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-embedded@freebsd.org Subject: Re: ELF loader problem with CFE on ASUS WL500g X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 19:49:49 -0000 In message: <48F3A0EE.7040003@incunabulum.net> Bruce M Simpson writes: : M. Warner Losh wrote: : > I thought you could fix this with linker script tweaks... : > : : Not in an automated way. It'll let you set a *fixed* LMA by adding : AT(...) to the PHDR linker script section, but that's not very useful. : Trying to use a non-constant expression produces an error; and : LOADADDR() wants a *section*, not a *segment*. : : The first thing I tried was to use the "load -addr" option in CFE; it : totally ignores this option as it only applies to raw images. : : I tried the GNU ld MEMORY { ... } section, but it changes the VMA as : well as the LMA. : : I seem to remember I had headaches like this when trying to build : FreeBSD with the MinGW toolchain to boot on an SGI Visual Workstation. :-( : > bummer... It sounds a bit like we need to do the normal tricks of : > 'early' boot loaders: turn on the mmu and then jump to . to transition : > from PA to VA addresses... : > : > : It looks like objcopy's --change-section-lma option, with a negative : > : offset, would do what I want, however it will need to be scripted to : > : work on named sections. : > : > You might try to mock-up a test with a newer version of binutils than : > 2.15 we're using? : > : : I tried the attached script, which produces a BFD error: : BFD: kernel.rebased: section `.hash' can't be allocated in segment 3 That sucks. : One common problem with these Broadcom based platforms is that they : almost always ship with CFE, and it's convenient to use the inbuilt ELF : loader for bootstrapping. Correct. I understand that... : Unfortunately CFE comes with bugs attached, and there are usually no : alternative boot loaders available due to Broadcom's less than, shall we : say, "open" attitude towards open source. *ahem* : : So yeah, it sounds like we probably need something like the ARM ELF : trampoline for MIPS ideally. That's what I'm talking about. Using CFE to boot FreeBSD kernel. we're unlikely to be able to put the u-boot syscall features into CFE, so we won't be able to leverage that work... : It would probably also be relatively easy to write a small C tool with : libelf to do the rebasing CFE expects. That's the other alternative... Warner