* [Buildroot] kernel drivers
@ 2013-02-11 20:13 Zoran Djordjevic
2013-02-11 20:52 ` Dimitrios Siganos
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Zoran Djordjevic @ 2013-02-11 20:13 UTC (permalink / raw)
To: buildroot
My question is mostly theoretical, so I will be much obliged if I'll be pointed at some links, although
(as Buildroot user) I am interested in the way I can do things with Buildroot. What I would like to
know is how can I incorporate some new kernel driver (having it's source) into kernel build? First, where
should I put it in kernel source tree, then can I compile it independently, without rebuilding whole kernel
(I imagine modules can do the job)?
How can I compile it as a module or to be more precise, do I write driver in some special way to be a module?
(I see that Buildroot offers some driver to be choosed for module compiling or to be part of monolitic kernel).
?
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130211/7cafa2ca/attachment.html>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] kernel drivers
2013-02-11 20:13 [Buildroot] kernel drivers Zoran Djordjevic
@ 2013-02-11 20:52 ` Dimitrios Siganos
2013-02-11 21:11 ` Grant Edwards
2013-02-12 8:12 ` Stephan Hoffmann
2 siblings, 0 replies; 4+ messages in thread
From: Dimitrios Siganos @ 2013-02-11 20:52 UTC (permalink / raw)
To: buildroot
Hi Zoran,
Your question is not really buildroor specific, it is more linux kernel
specific. You need to learn how to write linux drivers. I can recommend
this open source book:
http://lwn.net/Kernel/LDD3
There are two options:
* Incorporate it into linux kernel sources (this can be linked in
statically or it can be a module). You choose linked in or module from
linux menuconfig, which at buildroot level you involve like this:
make linux-menuconfig
* The other way is to have your driver sources outside of the kernel and
build it as a module. This is the easiest way to start with. Have a look
at the package 'lttng-modules' for a simple example of this method.
But make sure you read the relevant chapters in LDD first.
Regards,
Dimitris
On 11/02/13 20:13, Zoran Djordjevic wrote:
> My question is mostly theoretical, so I will be much obliged if I'll be
> pointed at some links, although
> (as Buildroot user) I am interested in the way I can do things with
> Buildroot. What I would like to
> know is how can I incorporate some new kernel driver (having it's
> source) into kernel build? First, where
> should I put it in kernel source tree, then can I compile it
> independently, without rebuilding whole kernel
> (I imagine modules can do the job)?
> How can I compile it as a module or to be more precise, do I write
> driver in some special way to be a module?
> (I see that Buildroot offers some driver to be choosed for module
> compiling or to be part of monolitic kernel).
>
> Regards
>
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] kernel drivers
2013-02-11 20:13 [Buildroot] kernel drivers Zoran Djordjevic
2013-02-11 20:52 ` Dimitrios Siganos
@ 2013-02-11 21:11 ` Grant Edwards
2013-02-12 8:12 ` Stephan Hoffmann
2 siblings, 0 replies; 4+ messages in thread
From: Grant Edwards @ 2013-02-11 21:11 UTC (permalink / raw)
To: buildroot
On 2013-02-11, Zoran Djordjevic <djdjdjole@yahoo.com> wrote:
> What I would like to know is how can I incorporate some new kernel
> driver (having it's source) into kernel build?
IMO, the easiest way to work on kernel stuff is to not use buildroot
to build the kernel. I do my kernel development outside of buildroot.
[There have probably been recent changes I don't know about that make
kernel development using buildroot easier, but it used to be a bit
awkward.] When you are finished testing your kernel changes, you can
do one of two things:
1) Combine your kernel with the root filesystem built by buildroot.
If you're using U-Boot, this is trivial: you can create a "multi"
uImage file (outfile.uImage) that contains the kernel image
(vmlinuz) and the root filesystem image (rootfs.cpio.gz):
mkimage -A arm -O Linux -T multi -C none -n "My kernel+rootfs image" -d zImage:rootfs.cpio.gz outfile.uImage
2) Zip up the modified kernel sources and configure buildroot to use them
to build your "production" kernel along with your rootfs.
> First, where should I put it in kernel source tree, then can I
> compile it independently, without rebuilding whole kernel (I imagine
> modules can do the job)?
You can either develop it as a module or as an in-kernel driver. In
either case, you don't have to rebuild the whole kernel when you make
changes to your driver.
If you develop it in-kernel when you modify your driver you _will_
have to recompile it and re-link the kernel (e.g. "make vmlinuz") and
then reboot to try out the new kernel.
If you develop it as a module, you can unload/reload the module to do
your testing. To save on resources, many embedded systems don't
support module loading/unloading (it's your memory, your choice).
> How can I compile it as a module or to be more precise, do I write
> driver in some special way to be a module?
Yes, drivers that are to be buildable as modules have to be written in
a special way. But, the extra code required to be module is simple
and it's not difficult to do.
Some of these references are getting a bit old, but still have a lot
of good info. Also don't foreget about /usr/src/linux/Documentation.
http://lwn.net/Kernel/LDD3/
http://www.amazon.com/Linux-Device-Drivers-3rd-Edition/dp/0596005903
http://www.amazon.com/Linux-Kernel-Development-3rd-Edition/dp/0672329468
http://www.amazon.com/Writing-Linux-Device-Drivers-exercises/dp/1448672384
http://www.amazon.com/Essential-Device-Drivers-Sreekrishnan-Venkateswaran/dp/0132396556
http://www.linuxforu.com/tag/linux-device-drivers/
http://oldpapyrus.wordpress.com/2012/04/29/writing-linux-device-driver-tutorials/
--
Grant Edwards grant.b.edwards Yow! hubub, hubub, HUBUB,
at hubub, hubub, hubub, HUBUB,
gmail.com hubub, hubub, hubub.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] kernel drivers
2013-02-11 20:13 [Buildroot] kernel drivers Zoran Djordjevic
2013-02-11 20:52 ` Dimitrios Siganos
2013-02-11 21:11 ` Grant Edwards
@ 2013-02-12 8:12 ` Stephan Hoffmann
2 siblings, 0 replies; 4+ messages in thread
From: Stephan Hoffmann @ 2013-02-12 8:12 UTC (permalink / raw)
To: buildroot
Am 11.02.2013 21:13, schrieb Zoran Djordjevic:
> My question is mostly theoretical, so I will be much obliged if I'll be pointed at some links, although
> (as Buildroot user) I am interested in the way I can do things with Buildroot. What I would like to
> know is how can I incorporate some new kernel driver (having it's source) into kernel build? First, where
> should I put it in kernel source tree, then can I compile it independently, without rebuilding whole kernel
> (I imagine modules can do the job)?
Hello Zoran,
there are some topics not already mentioned by Dimitros' and Grant's
replies:
* If you put your driver into the kernel tree it has to be GPL
* Nowadays editing the kernel outside of buildroot and building it with
buildroot is easy thanks to the source override feature
* There are some samples of "out-of-kerneltree" drivers in buildroot
that can be used as a guideline for this, e.g. package/owl-linux/
Reards
Stephan
> How can I compile it as a module or to be more precise, do I write driver in some special way to be a module?
> (I see that Buildroot offers some driver to be choosed for module compiling or to be part of monolitic kernel).
>
> Regards
>
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130212/fb0e7ea2/attachment.html>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-12 8:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-11 20:13 [Buildroot] kernel drivers Zoran Djordjevic
2013-02-11 20:52 ` Dimitrios Siganos
2013-02-11 21:11 ` Grant Edwards
2013-02-12 8:12 ` Stephan Hoffmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox