All of lore.kernel.org
 help / color / mirror / Atom feed
From: universeII at gmx.de <universeII@gmx.de>
To: buildroot@busybox.net
Subject: [Buildroot] Fw: Aw: Re:  Cross-Compiling out-of-tree driver
Date: Fri, 5 Apr 2013 15:57:51 +0200 (CEST)	[thread overview]
Message-ID: <trinity-69443043-25ef-4c34-bd18-cf2e432788e0-1365170271003@3capp-gmx-bs29> (raw)
In-Reply-To: trinity-48f3adad-041a-4437-8b4e-0f18f5b0c02c-1365168640703@3capp-gmx-bs29

?

Gesendet:?Freitag, 05. April 2013 um 15:30 Uhr
Von:?universeII at gmx.de
An:?"Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
Betreff:?Aw: Re: [Buildroot] Cross-Compiling out-of-tree driver

Thomas,
sorry for contacting your directly. I wasn't sure if my email is? shown in the list archive in the correct subtree when replying to the list. Is this correct or how do I reply correctly?
?
Setting KDIR to the right directory does not work sufficiently as I have to set the architecture correctly. I'm trying to cross-compile
for PowerPC architecture but my PC is x86_64.
I tried several recommendation from the internet (setting environment variables) but did not succeed.
What do I have to set in my Makefile to use the cross-compile toolchain from buildroot and tell the gcc to use the PowerPC part of kernel tree instead of x86_64?
?
Regards,
Andreas

?
P.S.: Acutally I just need to copy the .ko file to the target and do insmod/rmmod manually.
?

Gesendet:?Freitag, 05. April 2013 um 15:19 Uhr
Von:?"Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
An:?universeII at gmx.de
Cc:?buildroot at uclibc.org
Betreff:?Re: [Buildroot] Cross-Compiling out-of-tree driver
Andreas,

Please do not reply to me directly: the list should be kept in Cc.
Thanks.

On Fri, 5 Apr 2013 14:54:39 +0200 (CEST), universeII at gmx.de wrote:

> thanks for your quick response. I'm still a little bit confused how to complile the driver.
> I have the dummy driver in an own directory including the Makefile which is just a "normal"
> makefile for compiling a driver out-of-tree.
> Example:
>
> obj-m := dummy_driver.o
> KDIR := /lib/modules/$(shell uname -r)/build
> PWD := $(shell pwd)
>
> default:
> $(MAKE) -C $(KDIR) M=$(PWD) modules
>
>
> I change to the directory and issue a "make" command. I was woundering if it is possible to just set
> KDIR and the gcc approriately to the kernel sources and (cross-compile) tools from buildroot.

Aah, ok, you want to build your module manually outside of Buildroot.
What I showed in my previous e-mail was how to integrate it as a
Buildroot package.

If you want to build your out-of-tree module manually against a Linux
kernel that has been built by Buildroot, then you should just do:

KDIR = /path/to/buildroot/output/build/linux-x.y.z/

that should be enough. Then of course, you should install your module,
so maybe add something like:

DESTDIR = /path/to/buildroot/output/target/

install:
$(MAKE) -C $(KDIR) M=$(PWD) INSTALL_MOD_PATH=$(DESTDIR) modules_install

run "make install" in your module, which should install it in the
output/target/lib/modules/<kernelversion>/ directory. Then, run "make"
again in Buildroot so that your filesystem image gets regenerated to
include the module.

Of course, this is only needed if you want a clean installation of your
module. For quick and dirty testing, you can also just copy the .ko
file to your target, and insmod it.

> I had a look at your patch file and it seems to me that the .mk is somehow included in the
> buildroot make structure (I'm sorry that I do not know so much details how buildroot work internally)?

Yes, my patch shows how to add an out-of-tree kernel driver as a
Buildroot package, so that it is nicely integrated in the Buildroot
build process.

> How do you in this case issue a compilation of your driver?

You just enable your new package in 'make menuconfig', and run the
usual Buildroot 'make' command.

Best regards,

Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  parent reply	other threads:[~2013-04-05 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-05 11:40 [Buildroot] Cross-Compiling out-of-tree driver universeII at gmx.de
2013-04-05 12:01 ` Samuel Martin
2013-04-05 12:07 ` Thomas Petazzoni
     [not found]   ` <trinity-e6e255fe-1d77-40c4-934f-3c35573b2dbc-1365166479514@3capp-gmx-bs29>
2013-04-05 13:19     ` Thomas Petazzoni
     [not found]       ` <trinity-48f3adad-041a-4437-8b4e-0f18f5b0c02c-1365168640703@3capp-gmx-bs29>
2013-04-05 13:57         ` universeII at gmx.de [this message]
2013-04-05 14:03   ` universeII at gmx.de
2013-04-05 14:19     ` [Buildroot] SOLVED: " universeII at gmx.de

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-69443043-25ef-4c34-bd18-cf2e432788e0-1365170271003@3capp-gmx-bs29 \
    --to=universeii@gmx.de \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.