From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] Cross-Compiling out-of-tree driver
Date: Fri, 5 Apr 2013 15:19:17 +0200 [thread overview]
Message-ID: <20130405151917.598647db@skate> (raw)
In-Reply-To: <trinity-e6e255fe-1d77-40c4-934f-3c35573b2dbc-1365166479514@3capp-gmx-bs29>
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
next prev parent reply other threads:[~2013-04-05 13:19 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 [this message]
[not found] ` <trinity-48f3adad-041a-4437-8b4e-0f18f5b0c02c-1365168640703@3capp-gmx-bs29>
2013-04-05 13:57 ` [Buildroot] Fw: Aw: " universeII at gmx.de
2013-04-05 14:03 ` [Buildroot] " 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=20130405151917.598647db@skate \
--to=thomas.petazzoni@free-electrons.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox