Re: Driver compilation for amd64

From: M. Warner Losh <imp_at_bsdimp.com>
Date: Thu, 06 Jul 2006 00:36:55 -0600 (MDT)
In message: <EF6AF37986D67948AD48624A3E5D93AFAA9326_at_mtce2k01.adaptec.com>
            "Leubner, Achim" <Achim_Leubner_at_adaptec.com> writes:
: Is it possible to cross-compile a driver on an i386 platform for amd64,
: and if possible, how should I do that? 
: 
: 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
Received on Thu Jul 06 2006 - 04:39:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:58 UTC