How to manage build process under autotools for kernel module - Linux

This is a discussion on How to manage build process under autotools for kernel module - Linux ; Hi. I administrate an open source project ( http://openxdas.sf.net ). This is an auditing system based on an Open Group standard called XDAS. OpenXDAS provides a user-space daemon and audit instrumentation library. I'd like to provide a kernel-space instrumentation library ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: How to manage build process under autotools for kernel module

  1. How to manage build process under autotools for kernel module

    Hi.

    I administrate an open source project (http://openxdas.sf.net). This is
    an auditing system based on an Open Group standard called XDAS.
    OpenXDAS provides a user-space daemon and audit instrumentation
    library. I'd like to provide a kernel-space instrumentation library
    also, so that kernel modules can be instrumented for audit using this
    same API.

    I've written kernel modules for NetWare for years, so I'm not
    intimidated by the thought of writing code for the Linux kernel, and I
    believe I understand the basics of how to write such a module.

    My problem is packaging - I've never written a kernel module as an open
    source project, and so I just don't know what's being done out there to
    distribute such code. The user space portion of my project is based on
    autotools, but as for the kernel module portion - well, I'm open to
    suggestion ...

    Can anyone refer me to some existing open source projects that do this,
    so that I can see how they set up their build system, and how they
    distribute their components?

    Thanks in advance,
    John Calcote
    Sr. Software Eng.
    Novell, Inc.


  2. Re: How to manage build process under autotools for kernel module

    On Tue, 18 Sep 2006, john.calcote@gmail.com wrote:

    > My problem is packaging - I've never written a kernel module as an open
    > source project, and so I just don't know what's being done out there to
    > distribute such code. The user space portion of my project is based on
    > autotools, but as for the kernel module portion - well, I'm open to
    > suggestion ...


    If you are using 2.6 kernel, it is common that the out-of-tree modules
    also use the Kbuild (linux kernel build system). Let's say you have
    hello.c and want to compile it against currently running kernel's source
    as a module. The only Makefile you needs should then be something similar
    to:

    obj-m += hello.o

    all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

    clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

    issuing 'make' will the use the kernel build system, headers,
    configuration, etc. to build and link your hello.c into hello.ko.

    --
    Jiri Kosina

  3. Re: How to manage build process under autotools for kernel module

    Jiri,

    Thank you. I've read the kernel-HOWTO for the 2.6 kernel, and have
    already picked up this useful bit of information. The problem is not
    building - it's packaging.

    How do I structure the release of my project so it contains the proper
    build sequence for people downloading my package in either src-rpm
    format, or simple tar.gz format. Where do I put the kernel-specific
    source files, and how do I tie this simple Makefile you suggested into
    my project's autotools build system. For instance, should I add a
    subdirectory called linux-kernel beneath my libxdas directory like
    this:

    openxdas/
    Makefile.am (root-level)
    libxdas/
    Makefile.am (calls linux-kernel/Makefile)
    src/
    include/
    linux-kernel/
    Makefile
    ...other kernel-specific sources...

    Furthermore, should this kernel module be a specific target, or should
    it be tied into "all" for autotools - if so, what should be done about
    Solaris, or other Unix platforms that support autotools, but don't run
    on the linux-kernel. I'm guessing that such a tie-in with the "all"
    target would be platform-specific for linux, right?

    This is why I asked for other project references - there must be some
    project out there that has both user-space and kernel-space components.
    A Google search for such projects lacks the proper meta-data keywords -
    who looks for projects based on whether they contain components in both
    kernel and user space?!

    Thanks,
    John


+ Reply to Thread