Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Sep 2011 12:09:37 +0300
From:      Aleksandr Rybalko <ray@dlink.ua>
To:        John-Mark Gurney <jmg@funkthat.com>
Cc:        freebsd-arm@freebsd.org, satish kondapalli <nitw.satish@gmail.com>
Subject:   Re: How to cross compile a  kernel module?
Message-ID:  <20110930120937.fee3590e.ray@dlink.ua>
In-Reply-To: <20110929232933.GC14645@funkthat.com>
References:  <1317195615589-4848235.post@n5.nabble.com> <20110928133448.65441459.ray@dlink.ua> <1317290169064-4852474.post@n5.nabble.com> <20110929131256.28cf6240.ray@dlink.ua> <20110929232933.GC14645@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 Sep 2011 16:29:33 -0700
John-Mark Gurney <jmg@funkthat.com> wrote:

>> Aleksandr Rybalko wrote this message on Thu, Sep 29, 2011 at 13:12
>> +0300:
>> > On Thu, 29 Sep 2011 02:56:09 -0700 (PDT)
>> > satish kondapalli <nitw.satish@gmail.com> wrote:
>> > 
>> > >> Thanks Aleksandr,
>> > >> After adding "MODULES_OVERRIDE" option in the  kernel config, my
>> > >> module got compiled.
>> > >> 
>> > >> But every time while building my module, the entire kernel also
>> > >> compiled. is there any better mechanism to just cross compile
>> > >> the module with out building the entire Kernel.
>> > 
>> > To avoid recompile all things - do make KERNFAST=configname kernel.
>> > 
>> > Maybe someone also show better way to cross compile one module,
>> > but I don't know.
>> 
>> I haven't tested this in a long time, but if you do:
>> make buildenv
>> 
>> from the root of your tree, it should setup your path w/ all the
>> necessary cross-tools in your path, etc...  Then you can go into the
>> module directory and do a make manually..

Yep, indeed, worked! 
SRC=/usr/src
OBJ=/usr/obj
cd  ${SRC}

make TARGET=arm TARGET_ARCH=armeb TARGET_CPU=xscale buildenv

# There is check ${PATH} to have toolchain in that dirs
if [ ! -x ${OBJ}/${TARGET}.${TARGET_ARCH}/${SRC}/tmp/usr/bin/cc ]; then
	make kernel-toolchain
fi

# Or just do make -DNO_CLEAN kernel-toolchain

cd sys/modules/module/you/need
make

Thank you John-Mark!

>> 
>> -- 
>>   John-Mark Gurney				Voice: +1 415 225
>> 5579
>> 
>>      "All that I will do, has been done, All that I have, has not."


-- 
Alexandr Rybalko <ray@dlink.ua> 
aka Alex RAY <ray@ddteam.net>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110930120937.fee3590e.ray>