[ale] cross compiling
Boris Borisov
bugyatl at gmail.com
Tue May 6 10:36:39 EDT 2014
Apparently I didn't had to pass any additional parameters to the Makefile.
Make with entering kernel source directory knows what architecture kernel
was built so it built module for the same .... Smart
On Mon, May 5, 2014 at 10:43 PM, Boris Borisov <bugyatl at gmail.com> wrote:
> thank you for detailed answer ! Could not touch computer all afternoon
> so I'm checking now. Today manually add line before 79. KERNDIR :=
> /user/linux-2.6.24.3 dirty way but worked. so far got driver but for
> x86. In the morning will try to pass parameters to compiler ARCH=mips
> and CROSS_COMPILE=mips-linux- and should work. Now is too late can put
> my thoughts together :)
>
> Thanks again
>
> On 5/5/14, Ed Cashin <ecashin at noserose.net> wrote:
> > Responses will interleave with selected quotes below.
> >
> > On Mon, May 5, 2014 at 11:00 AM, Boris Borisov <bugyatl at gmail.com>
> wrote:
> >> I'm trying to get my way around cross-compiling. I have host Debian 7.5
> >> and
> >> the toolchain for mips. I'm working with patched 2.6.24.3 kernel because
> >> that is what runs on my device. So far I got how to compile the kernel
> >> for
> >> mips.
> >
> > Congratulations. It isn't always easy to build old kernels. I used
> > to use VMs running old versions of RHEL to build old kernels. It also
> > isn't always easy to cross compile!
> >
> >> My question is how you are compiling module that is not in kernel tree.
> >
> > I have some experience with that. I checked out the rt73 sources from
> > sourceforge.
> >
> > ...
> >> Since the module package has its own Makefile: do you make changes in
> >> this
> >> Makefile or you start make with extra parameters?
> >
> > Maybe it's helpful to break down how the parts of the build relate.
> > Sorry if you know all this, but the Module/Makefile inside rt73 looks
> > for the kernel sources via the expected "build" symlink:
> >
> > 79 ifdef KERNDIR
> > 80 KERNEL_SOURCES := $(KERNDIR)
> > 81 else
> > 82 KERNEL_SOURCES := /lib/modules/$(shell uname -r)/build
> > 83 endif
> >
> > ... so you can do 'make KERNDIR=/path/to/my/sources' ... to specify your
> > own.
> >
> > It uses the KERNEL_SOURCES to build parameters for the build command:
> >
> > 115 KBUILD_PARAMS := -C $(KERNEL_SOURCES) SUBDIRS=$(CURDIR)
> > $(KERNEL_OUTPUT)
> >
> > Notice the "-C" option. That's going to cause make to change
> > directories to the kernel sources and to use the Makefile there. So
> > this is a recursive make, where it starts out in the rt73 sources but
> > quickly changes to the kernel sources.
> >
> > When it's (the child) make running on the Makefile in the kernel
> > sources, it's being told to build the modules in the subdirectories
> > $(SUBDIRS), which is set to be rt73's Module/ subdirectory.
> >
> > Back when rt73 invoked this child make, it passed on the EXTRA_CFLAGS:
> >
> > 127 module:
> > 128 @$(MAKE) $(KBUILD_PARAMS)
> > 'EXTRA_CFLAGS=$(EXTRA_CFLAGS)' modules; \
> > 129 $(MODULE_CHECK)
> >
> > ... and that suggests that you can supply EXTRA_CFLAGS from your
> > invocation inside rt73's Module/ subdirectory. You can also edit
> > Module/Makefile if you like.
> >
> > With that example, you can probably think of ways to get other
> > variables to show up in the kernel build as well.
> >
> > --
> > Ed Cashin <ecashin at noserose.net>
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://mail.ale.org/mailman/listinfo/ale
> > See JOBS, ANNOUNCE and SCHOOLS lists at
> > http://mail.ale.org/mailman/listinfo
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20140506/5b04d126/attachment.html>
More information about the Ale
mailing list