From owner-freebsd-arm@FreeBSD.ORG Tue Sep 5 17:43:39 2006 Return-Path: X-Original-To: freebsd-arm@freebsd.org Delivered-To: freebsd-arm@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 701E516A4DF; Tue, 5 Sep 2006 17:43:39 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9F44443D5A; Tue, 5 Sep 2006 17:43:36 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k85HfaTe013599; Tue, 5 Sep 2006 11:41:36 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 05 Sep 2006 11:41:52 -0600 (MDT) Message-Id: <20060905.114152.-399282970.imp@bsdimp.com> To: andre@freebsd.org From: "M. Warner Losh" In-Reply-To: <44FDAE15.1010400@freebsd.org> References: <44FC3626.701@freebsd.org> <20060904.115205.-626772610.imp@bsdimp.com> <44FDAE15.1010400@freebsd.org> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Tue, 05 Sep 2006 11:41:36 -0600 (MDT) Cc: freebsd-arm@freebsd.org Subject: Re: ARM boot process X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2006 17:43:39 -0000 In message: <44FDAE15.1010400@freebsd.org> Andre Oppermann writes: : M. Warner Losh wrote: : > In message: <44FC3626.701@freebsd.org> : > Andre Oppermann writes: : > : I'm new to the embedded system world and have got some Atmel : > : at91rm9200 eval boards I'm playing with. Most of them came : > : with Linux and some boot loader to it. : > : : > : The supplied boot loaders can't load a FreeBSD arm kernel and : > : complain about wrong magic. : > : > Which kernel were you using? : : After I sent the original email I tried a couple of things and got : some help on developers IRC as well (missing you there lately). : : What I did was to check out the arm tree from p4 and do a 'make : TARGET_ARCH=arm kernel-toolchain' followed by a 'make TARGET_ARCH= : arm KERNCONF=KB920X buildkernel'. The KB920X is modified such that : it includes the hints.at91rm9200. One step I somehow did but can't : reproduce today was the 'make trampoline' target. Every time and way : I try it now fails in elf_trampoline.c because it doesn't have proper : sys/* includes as seen from the kernel compile directory. There I'm : stuck right now. The kernel from yesterday successfully boots on the : KB9202 and mounts root over NFS. The loader is the super-primitive : one that comes with the board. I'm setting mac, ip and tftp server : address, do the tftp download to 0x20000000 and start from that address. OK. : What I've got no clue yet is how to build a MFS image that gets fused : with the kernel so I may skip NFS and boot with only TFTP or even put : it on flash. I've done that, but I'll have to check my notes. I've use mkfs to creaet the ramdisk image, and then frobbed some knob in the config file to included when I built kernel.tramp. : > boot0* is to bootstrap the board. boot0 lets you load an arbitrary : > program to execute. boot0iic allows you to load an image to put in : > the iic eeprom (maybe on only on the KB9202). boot0spi allows you to : > load an image into the SPI part. : > : > bootiic is usually what you put in the iic part to boot. It's fully : > functional. If you have different eeprom parts, you'll need to tweak : > it. : : OK, this looks pretty much like the Kwikbyte loader. Except that it works... :-) There's lots of bugs in the kwikbyte loader. : > bootspi is what I put in the SPI part. It is presently optimized for : > the part that I have, and might need some tweaks. : > : > bootsd will boot off a SD card. It doesn't quite work yet, there's : > some unaligned accesses that I'm still working on sorting out... : : SD is the interesting part. ;-) : : I included the qdmmc driver in my working kernel as well but it fails : to detect an inserted SD (1GB) or MMC (16MB) card. How does the IO pin : setup on the AT91RM9200 work? Where are the IOs assigned to the functions? Chances are good that the I/O stuff isn't configured correctly. We're getting close to the point of needing different I/O config for different boards. All that's done right now in kb920x_machdep.c. In an ideal world, the boot loader would pass us a board type (I think it may already), we'd save it (which we don't right now) and then use it later to do board specific things. : > : For the at91rm9200 a number of boot loaders are in boot/arm/ : > : but so far I haven't figured out which one to use. Eventually : > : I'd like to have it boot from the SD card. : > : > That's not yet in the tree. I'm working on booting off a UFS : > partition. : : Perfect. : : > I've not looked at integrating the SD support with things like redboot : > or uboot yet. : : What does boot2 do? And how can I boot an ARM kernel w/o doing the : trampoline step? Is that possible at all? boot2 doesn't do anything. bootsd is a copy of boot2 that's been augmented to be the only stage. I don't think that we've investigated getting /boot/loader working on the arm. With that, we'd not need the trampoline stuff at all. That's there to trick the kernel into thinking it was booted with /boot/loader. My bootsd code won't care... I'm not sure what this has to do with redboot or uboot support. There I think one would have to boot off a ext2fs partition. : Once I'm up to speed and familiar with ARM/AT91RM9200 I'm ready to help : on improving it. The devices/ports I'll primarily care about and will : use are SPI, TWI, 8bit parallel bus, SD/MMC, SSC, EMAC. Same for us, except not parallel bus. Warner