From owner-freebsd-arch@FreeBSD.ORG Mon Feb 14 22:01:12 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 93E5016A4EA for ; Mon, 14 Feb 2005 22:01:10 +0000 (GMT) Received: from mail23.sea5.speakeasy.net (mail23.sea5.speakeasy.net [69.17.117.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8926443D1F for ; Mon, 14 Feb 2005 22:01:09 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: (qmail 4237 invoked from network); 14 Feb 2005 22:01:09 -0000 Received: from server.baldwin.cx ([216.27.160.63]) (envelope-sender )AES256-SHA encrypted SMTP for ; 14 Feb 2005 22:01:08 -0000 Received: from [10.50.40.202] (gw1.twc.weather.com [216.133.140.1]) (authenticated bits=0) by server.baldwin.cx (8.13.1/8.13.1) with ESMTP id j1EM0w7S046745; Mon, 14 Feb 2005 17:01:03 -0500 (EST) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: freebsd-arch@FreeBSD.org, John-Mark Gurney Date: Mon, 14 Feb 2005 15:11:33 -0500 User-Agent: KMail/1.6.2 References: <20050213001752.GA40468@funkthat.com> <20050213062910.GC83950@dragon.nuxi.com> <20050213080508.GB40468@funkthat.com> In-Reply-To: <20050213080508.GB40468@funkthat.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200502141511.34400.jhb@FreeBSD.org> X-Spam-Status: No, score=-102.8 required=4.2 tests=ALL_TRUSTED, USER_IN_WHITELIST autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on server.baldwin.cx cc: David O'Brien Subject: Re: buildenv target X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Feb 2005 22:01:12 -0000 On Sunday 13 February 2005 03:05 am, John-Mark Gurney wrote: > David O'Brien wrote this message on Sat, Feb 12, 2005 at 22:29 -0800: > > On Sat, Feb 12, 2005 at 04:17:52PM -0800, John-Mark Gurney wrote: > > > Does anyone object to adding a buildenv target to our Makefile, so that > > > when crossbuilding you can get the tools setup in a shell. Useful for > > > doing crossbuild testing w/ a cross-built world eaiser. > > > > .. > > > > > so: > > > bash-2.05b$ which config > > > /usr/sbin/config > > > bash-2.05b$ make buildenv TARGET_ARCH=arm > > > Entering world for arm:arm > > > bash-2.05b$ which config > > > /usr/obj/arm/usr/home/jmg/arm/src/i386/legacy/usr/sbin/config > > > > I don't quite follow what you're going to do with in it. > > The problem is the more we bend this to do what the random person wants > > to do we build a garantium thing that is hard to change w/o breaking some > > "established" behavior. Much like the huge mess we had in binutils to > > support cross assembling to non-FreeBSD platforms. > > what you can do with it is: > cd ~jmg/arm/src/sys/arm/conf > config TS7200 > cd ../../compile/TS7200 > make depend && make -j 4 > > and now hack to your hearts content on an arm kernel on your i386 box > with out having to do things like cognet suggests on his arm text file > (from http://people.freebsd.org/~cognet/freebsd_arm.txt): > make TARGET_ARCH=arm TOOLS_PREFIX=/usr/cross depend all > make TARGET_ARCH=arm TOOLS_PREFIX=/usr/cross DESTDIR=/usr/cross install > Then go in /usr/src/gnu/usr.bin/binutils, and do : > make TARGET_ARCH=arm TOOLS_PREFIX=/usr/cross depend all > make TARGET_ARCH=arm TOOLS_PREFIX=/usr/cross DESTDIR=/usr/cross install > You should get what is needed to cross-compile a kernel. > You need to set the following environment varibles for cross-compiling : > export CC=/usr/cross/usr/bin/gcc > export AS=/usr/cross/usr/bin/as > export NM=/usr/cross/usr/bin/nm > export RANLIB=/usr/cross/usr/bin/ranlib > export LD=/usr/cross/usr/bin/ld > export OBJCOPY=/usr/cross/usr/bin/objcopy > export SIZE=/usr/cross/usr/bin/size > export MACHINE=arm > export MACHINE_ARCH=arm > Then you can compile the kernel the usual way, ie : > cd /sys/arm/conf > config IQ31244 > cd ../compile/IQ31244 && make depend all > > so, you now do: > make buildworld TARGET_ARCH=arm > make buildenv TARGET_ARCH=arm > and build your kernel as you normally would... a bit easier, wouldn't > you say? Did you know that you can just do: make kernel-toolchain TARGET_ARCH=arm make buildkernel TARGeT_ARCH=arm KERNCONF=TS7200 That's rather easy. You can even cross-build against a different kernel tree (I use this a lot for my p4 trees). For example: make TARGET_ARCH=amd64 KERNCONF=LINT KERNSRCDIR=/home/john/work/p4/proc \ buildkernel NO_MODULES=yes With repeated builds (e.g. when fixing compile errors) adding NO_KERNELCLEAN=yes NO_KERNELDEPEND=yes is good as well. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org