public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schlemmer <azarah@nosferatu.za.org>
To: Andreas Gruenbacher <agruen@suse.de>
Cc: arjanv@redhat.com, Sam Ravnborg <sam@ravnborg.org>,
	Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
	Linux Kernel Mailing Lists <linux-kernel@vger.kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Kai Germaschewski <kai@germaschewski.name>
Subject: Re: [PATCH 0/2] kbuild updates
Date: Mon, 21 Jun 2004 00:39:01 +0200	[thread overview]
Message-ID: <1087771141.14794.89.camel@nosferatu.lan> (raw)
In-Reply-To: <200406210026.43988.agruen@suse.de>

[-- Attachment #1: Type: text/plain, Size: 3828 bytes --]

On Mon, 2004-06-21 at 00:26, Andreas Gruenbacher wrote:
> On Sunday 20 June 2004 23:52, Martin Schlemmer wrote:
> > On Sun, 2004-06-20 at 23:42, Arjan van de Ven wrote:
> > > > Given, but to 'use' the kbuild infrastructure, you must still call it
> > > > via:
> > > >
> > > >   make -C _path_to_sources M=`pwd`
> > >
> > > I see no problem with requiring this though; requiring a correct
> > > makefile is perfectly fine with me, and this is the only and documented
> > > way for 2.6 already.
> > > (And it's also the only way to build modules against Fedora Core 2
> > > kernels by the way)
> >
> > I did not mean I have a problem with that.  Say you take svgalib, and
> > you want the build system to automatically compile the kernel module,
> > you might do something like:
> >
> > ---
> > build_2_6_module:
> > 	@make -C /lib/modules/`uname -r`/build M=`PWD`
> > ---
> >
> > will break with proposed patch ...
> 
> No it won't.
> 
> You always need to figure out $(objtree) to build external modules, with or 
> without a separate output directory. Many modules don't need to know 
> $(srctree) explicitly at all.
> 
> In case you want to do something depending on the sources/confguration, there 
> are two ways:
>   - follow the new source symlink,
>   - let kbuild take you to $(srctree): When the makefile in the M directory
>     is included, the current working directory is $(srctree). besides, all the
>     usual variables like $(srctree), $(objtree), CONFIG_* variables, etc. are
>     all available. That's a good time to check for features, etc.
> 

But my original concern (that the only way to figure where the source
are for the running kernel will be broken) is still valid.  And to do
all that you mentioned above, you still need to figure out _where_ the
kernel source are ...

> > And the point I wanted to make was that AFIAK
> > '/lib/modules/`uname -r`/build' is an interface to figure
> > out where the _sources_ for the current running kernel are
> > located.
> 
> That's a misconception. At the minimum, you want to be able to build the 
> module. Directly messing with the sources is usually wrong. I know external 
> module authors like to do that nevertheless; in a few cases it's actually 
> useful. Most of the time it really is not. Most external modules have totally 
> braindead/broken makefiles.
> 

I never said anything about messing with the source.  But anything that
needs access to the running kernel's headers need to know where the
sources are - and that could have been figured out by looking at the
'build' symlink.

Say you maintain an opensource (just to throw out the 'its closed
source, so screw them' arguments) external module that supports both
2.4 and 2.6, and easy way to implement it is to have:

makefile - make will first look for this, and then process it.
           in here you check what kernel is running (via uname -r
           or whatever), and then create the proper 'Makefile'
           symlink, and then call make with arguments to properly
           handle the external module build process for that
           version kernel.

Makefile-pre_M_flag - 100% valid kbuild Makefile for kernels that
                      do not support M=

Makefile-post_M_flag - 100% valid kbuild Makefile for kernels
                       supporting M=

Makefile-2_4 - 100% valid kbuild/whatever Makefile for 2.4 kernels
               (Ok, I am not so sure about how 2.4 handles things
               these days anymore ...)

now the clueless user just calls 'make && make install' and it should
work perfectly.

Or you create an install.sh that does things properly, or whatever,
but point remains that you need to know where the source are ...


Thanks,

-- 
Martin Schlemmer

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-06-20 23:12 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-20 21:19 [PATCH 0/2] kbuild updates Sam Ravnborg
2004-06-20 21:21 ` [PATCH 1/2] kbuil: add deb-pkg target Sam Ravnborg
2004-06-20 21:22 ` [PATCH 0/2] kbuild updates Sam Ravnborg
2004-06-20 21:23 ` [PATCH 2/2] kbuild: Improved external module support Sam Ravnborg
2004-06-20 21:25   ` Arjan van de Ven
2004-06-20 21:31     ` Martin Schlemmer
2004-06-20 21:45     ` Sam Ravnborg
2004-06-20 21:38       ` Arjan van de Ven
2004-06-21  1:41   ` Petr Vandrovec
2004-06-21  9:01   ` Geert Uytterhoeven
2004-06-21 21:57     ` Sam Ravnborg
2004-06-20 21:30 ` [PATCH 0/2] kbuild updates Martin Schlemmer
2004-06-20 21:42   ` Arjan van de Ven
2004-06-20 21:52     ` Martin Schlemmer
2004-06-20 22:26       ` Andreas Gruenbacher
2004-06-20 22:39         ` Martin Schlemmer [this message]
2004-06-20 23:51           ` Andreas Gruenbacher
2004-06-21 22:31             ` Sam Ravnborg
2004-06-21 22:33               ` Martin Schlemmer
2004-06-21 22:50               ` Andreas Gruenbacher
2004-06-21 23:03                 ` Sam Ravnborg
2004-06-20 22:03   ` Sam Ravnborg
2004-06-20 22:16     ` Martin Schlemmer
2004-06-20 22:26       ` Alistair John Strachan
2004-06-20 22:54         ` Martin Schlemmer
2004-06-21 22:46           ` Sam Ravnborg
2004-06-21 22:33         ` Sam Ravnborg
2004-06-21 22:29           ` Martin Schlemmer
2004-06-21 22:56             ` Andreas Gruenbacher
2004-06-20 22:18     ` Sam Ravnborg
2004-06-20 22:25       ` Martin Schlemmer
2004-06-21 22:48         ` Sam Ravnborg
2004-06-22  5:29       ` Jari Ruusu
2004-06-22  9:20         ` Andreas Gruenbacher
2004-06-22 18:23           ` Jari Ruusu
2004-06-22 18:44         ` Sam Ravnborg
2004-06-21  0:29     ` Hannu Savolainen
2004-06-21  1:27       ` Andreas Gruenbacher
2004-06-21  6:47       ` Arjan van de Ven
2004-06-21  8:02         ` Hannu Savolainen
     [not found] <29hJN-3Jl-35@gated-at.bofh.it>
     [not found] ` <29icN-42R-13@gated-at.bofh.it>
     [not found]   ` <29imu-4ad-31@gated-at.bofh.it>
     [not found]     ` <29iwc-4g7-27@gated-at.bofh.it>
2004-06-20 22:36       ` Pascal Schmidt
     [not found] <539000871@toto.iv>
2004-06-22  1:39 ` Peter Chubb
2004-06-22  5:20   ` Sam Ravnborg
2004-06-22  8:36     ` Andreas Gruenbacher

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=1087771141.14794.89.camel@nosferatu.lan \
    --to=azarah@nosferatu.za.org \
    --cc=agruen@suse.de \
    --cc=akpm@osdl.org \
    --cc=arjanv@redhat.com \
    --cc=geert@linux-m68k.org \
    --cc=kai@germaschewski.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=torvalds@osdl.org \
    /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