[okl4-developer] adding a wombat driver

Jorge Torres jorge.torres.maldonado at gmail.com
Tue Aug 7 15:16:28 EST 2007


Hi okl4.org,

Just in case someone ever has the same question, this are some basic
conclusions on OKlinux driver writing, please correct me if I'm wrong:

*As Ben said sometime ago, Making a driver to bridge between l4, and wombat
is MUCH MUCH more easier than adding new wombat syscalls.
*The easier way is to simply add the new .c driver file in
linux/kernel/arch/l4/drivers folder (say
linux/kernel/arch/l4/drivers/testrv.c).
*Then add obj-$(CONFIG_TESTSRV) += testsrv.o to the
linux/kernel/arch/l4/drivers/Makefile
*Then somewhere on linux/kernel/arch/l4/Kconfig add something like:
menu "TESTSRV"
config TESTSRV
    bool "Use testsrv"
    default y
endmenu
As Hal explained:
*Comment line 106 of linux/kernel/arch/l4/Makefile the one that says:
"include $(KBUILD_SRC)/$(ARCH_DIR)/sys-$(SYSTEM)/Makefile"
*make a kernel configuration file
$ cp linux/kernel/l4linux_config_<arch> linux/kernel/.config
*backup config file:
$ cp linux/kernel/l4linux_config_<arch> linux/kernel/l4linux_config_<arch>_B
$ make menuconfig (one must have libncurses installed to do so)
* just save, since new config is default y.
* Uncomment line 106 of linux/kernel/arch/l4/Makefile

WARNING: remove any linux/kernel/.config* file or else build will error fail
(don't know why??)

And thats it,

A simple driver testdrv.c:

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
MODULE_LICENSE("Dual BSD/GPL");
static int __init mp_init_module(void)
{
    printk(KERN_INFO "This should be printed on Wombat
initialization...\n");
}

static void __exit mp_cleanup_module(void)
{
    printk(KERN_INFO "ci vediamo!\n");
}
module_init(mp_init_module);
module_exit(mp_cleanup_module);

Cheers,

Jorge




On 8/6/07, Jorge Torres <jorge.torres.maldonado at gmail.com> wrote:
>
> Hi Hal, okl4.org,
>
> Thanks, I've made the changes, and I now know that new driver is being
> compiled, I've tested adding an error to driver's code and build halts
> because of such error,  what I'm not so sure  of, is  if the driver is
> being included  to  the  kernel,  I  have this  printk at the  init_module
> function and  nothing happens  on kernel initialization  prints,  do you
> know a way of testing if one's drivers have been executed?
>
> Thank you very much,
>
> Jorge
>
> On 8/5/07, Hal Ashburner < hala at ok-labs.com> wrote:
> >
> > On Sat, 2007-08-04 at 21:02 -0700, Jorge Torres wrote:
> > > Hi okl4.org,
> > >
> > > I'm trying to add a new driver to the wombat system, but I can't make
> > > the build system to add it to the kernel, this is what I do:
> > >
> > > *created a new dir linux/kernel/drivers/testdrv
> > > *on linux/kernel/drivers/Kconfig
> > > [+] source "drivers/testdrv/Kconfig"
> > > *on linux/kernel/drivers/Makefile
> > > [+] obj-$(CONFIG_TESTDRV) += testdrv/
> > > *on linux/kernel/drivers/testdrv
> > > /Makefile
> > > obj-$(CONFIG_TESTDRV)+= testdrv.o
> > > *on linux/kernel/drivers/testdrv/testdrv.c I have a very simple
> > > init-module and cleanup_module code
> > > *on linux/kernel/l4linux_config_ia32
> > > [+] CONFIG_TESTDRV=y
> > > *on linux/kernel/drivers/testdrv/Kconfig
> > > menu "testdrv"
> > > config TESTDRV
> > > trstate "testdrv"
> > > ---help---
> > > blah
> > > endmenu
> > >
> > >
> > > I guess that's all, does someone knows how can I get this driver to
> > > get included onto the system?.
> > >
> > Hi Jorge,
> > You'll need to  adjust the linux config file. For gumstix this is
> > linux/kernel/l4_linux_config_gumstix
> >
> > It may help to do something like the following ($ means command prompt,
> > # means comment)
> >
> > $ cd linux/kernel
> > $cp l4_linux_config_gumstix .config
> > # comment out line 106 of arch/l4/Makefile
> > $make menuconfig
> >
> > # chose your configuration options here - you should see your #
> > additions to Kconfig files if they worked
> >
> > $mv .config l4_linux_config_gumstix_jorgesdriver
> > # uncomment line 106 of arch/l4/Makefile
> >
> > # then edit the SConscript in the same directory to use your
> > # new config file.
> >
> > --
> > Kind regards,
> > Hal Ashburner
> >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20070807/e276ef30/attachment.htm 


More information about the Developer mailing list