From owner-freebsd-current@FreeBSD.ORG Thu Jul 6 10:55:59 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 86BCC16A4DA for ; Thu, 6 Jul 2006 10:55:59 +0000 (UTC) (envelope-from Achim_Leubner@adaptec.com) Received: from mail-gw3.adaptec.com (mail-gw3.adaptec.com [216.52.22.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 471AA43D53 for ; Thu, 6 Jul 2006 10:55:59 +0000 (GMT) (envelope-from Achim_Leubner@adaptec.com) Received: from mtce2k01.adaptec.com (mtce2k01.adaptec.com [162.62.174.18]) by mail-gw3.adaptec.com (Spam Firewall) with ESMTP id 853D8E9647; Thu, 6 Jul 2006 03:55:58 -0700 (PDT) content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 Date: Thu, 6 Jul 2006 12:55:57 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Driver compilation for amd64 Thread-Index: AcagxuHrq78vE530SEW42pCxrrGuiQAI61xA From: "Leubner, Achim" To: "M. Warner Losh" X-Virus-Scanned: by Barracuda Spam Firewall at adaptec.com Cc: freebsd-current@freebsd.org Subject: RE: Driver compilation for amd64 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2006 10:55:59 -0000 Thanks for your description, it works great! Thanks, Achim -----Original Message----- From: M. Warner Losh [mailto:imp@bsdimp.com]=20 Sent: Donnerstag, 6. Juli 2006 08:37 To: Leubner, Achim Cc: freebsd-current@freebsd.org Subject: Re: Driver compilation for amd64 In message: "Leubner, Achim" writes: : Is it possible to cross-compile a driver on an i386 platform for amd64, : and if possible, how should I do that?=20 :=20 : Any help is greatly appreciated. First, you must setup a cross environment: setenv TARGET amd64 setenv TARGET_ARCH amd64 setenv MAKEOBJDIRPREFIX /somewhere/obj cd /usr/src make kernel-toolchain At this point, you have two choices: (1) use the make buildkernel target and build a kernel + modules. This can be streamlined with options like NO_KERNELCLEAN, etc. We use this at work when we're developing 'base' kernel functionality for the arm port we're undertaking. (2) use the 'make buildenv' functionality. This target puts you in a proper build environment to do things by hand. You need to have done all the steps above, and each time you need to build stuff, you'll have to use the first 4 commands above followed by 'make buildenv'. You can then build your module, or whatever else you want, since cc and friends will generate code for amd64. I use both methods extensively for different types of development. They work great. I have an armenv script: cd $HOME/p4/imp_arm setenv TARGET arm setenv TARGET_ARCH arm setenv MAKEOBJDIRPREFIX $HOME/obj make buildenv which pops me into an environment I can build in. You'll need to customize it for your environment, clearly, but it should give you the main parts you need to do this sort of thing. I usually go the other way: build i386 on my fast amd64 box. Good luck Warner