linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to retrieve version from kernel source (the right way)?
@ 2005-02-09  8:17 Michael Renzmann
  2005-02-09  8:22 ` Brice Goglin
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Michael Renzmann @ 2005-02-09  8:17 UTC (permalink / raw)
  To: linux-kernel

Hi all.

(Please CC: me, I'm not subscribed - although I'm following the list 
through gmane.org)

I'm working on Madwifi (a driver for wireless lan cards with Atheros 
chipset), which isn't part of the kernel (and probably won't ever be due 
to the binary-only HAL). As every third-party device driver madwifi 
needs to know which kernel version it is compiled for, at least for 
determining the proper location to install itself after compilation. 
But... what is the right way to do this?

We used to get the kernel version via "uname -r", but dropped that 
behaviour. Chances are good that one wants to build the driver for a 
kernel version other than the currently running kernel.

Then we started to grep VERSION, PATCHLEVEL, SUBLEVEL and EXTRAVERSION 
from the kernel's Makefile. This failed, since some distributors seem to 
use shell commands for at least one of those. Example from SuSE 9.1:
=== cut ===
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 5
EXTRAVERSION = -$(shell echo $(CONFIG_RELEASE)-$(CONFIG_CFGNAME))
=== cut ===

Newer kernels also allow to set CONFIG_LOCALVERSION in .config.

It seems that include/linux/version.h holds the complete version 
information in UTS_RELEASE. Is it reliable to get the information from 
version.h? Or is there any other preferred method for this?

Bye, Mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to retrieve version from kernel source (the right way)?
  2005-02-09  8:17 How to retrieve version from kernel source (the right way)? Michael Renzmann
@ 2005-02-09  8:22 ` Brice Goglin
  2005-02-09  9:14 ` Christoph Hellwig
  2005-02-09 21:44 ` Sam Ravnborg
  2 siblings, 0 replies; 8+ messages in thread
From: Brice Goglin @ 2005-02-09  8:22 UTC (permalink / raw)
  To: Michael Renzmann; +Cc: linux-kernel

Michael Renzmann a écrit :
> Then we started to grep VERSION, PATCHLEVEL, SUBLEVEL and EXTRAVERSION 
> from the kernel's Makefile. This failed, since some distributors seem to 
> use shell commands for at least one of those. Example from SuSE 9.1:
> === cut ===
> VERSION = 2
> PATCHLEVEL = 6
> SUBLEVEL = 5
> EXTRAVERSION = -$(shell echo $(CONFIG_RELEASE)-$(CONFIG_CFGNAME))
> === cut ===
> 
> Newer kernels also allow to set CONFIG_LOCALVERSION in .config.

And you may also set some "localversion*" files in the source directory.
Their contents will be added too.

Brice


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to retrieve version from kernel source (the right way)?
  2005-02-09  8:17 How to retrieve version from kernel source (the right way)? Michael Renzmann
  2005-02-09  8:22 ` Brice Goglin
@ 2005-02-09  9:14 ` Christoph Hellwig
  2005-02-09 21:44 ` Sam Ravnborg
  2 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2005-02-09  9:14 UTC (permalink / raw)
  To: Michael Renzmann; +Cc: linux-kernel

On Wed, Feb 09, 2005 at 09:17:35AM +0100, Michael Renzmann wrote:
> Hi all.
> 
> (Please CC: me, I'm not subscribed - although I'm following the list 
> through gmane.org)
> 
> I'm working on Madwifi (a driver for wireless lan cards with Atheros 
> chipset), which isn't part of the kernel (and probably won't ever be due 
> to the binary-only HAL).

Why don't you use the reverse-engineered HAL from OpenBSD?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to retrieve version from kernel source (the right way)?
  2005-02-09  8:17 How to retrieve version from kernel source (the right way)? Michael Renzmann
  2005-02-09  8:22 ` Brice Goglin
  2005-02-09  9:14 ` Christoph Hellwig
@ 2005-02-09 21:44 ` Sam Ravnborg
  2005-02-10  7:06   ` Michael Renzmann
  2 siblings, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2005-02-09 21:44 UTC (permalink / raw)
  To: Michael Renzmann; +Cc: linux-kernel

> But... what is the right way to do this?

I think you are looking for:
make kernelrelease

   Sam


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to retrieve version from kernel source (the right way)?
  2005-02-09 21:44 ` Sam Ravnborg
@ 2005-02-10  7:06   ` Michael Renzmann
       [not found]     ` <200502100854.37606.agruen@suse.de>
  2005-02-10 18:42     ` Sam Ravnborg
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Renzmann @ 2005-02-10  7:06 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel

Hi.

Sam Ravnborg wrote:
>>But... what is the right way to do this?
> I think you are looking for:
> make kernelrelease

otaku@gimli linux-2.6.10 $ make kernelrelease
make: *** No rule to make target `kernelrelease'.  Stop.
otaku@gimli linux-2.6.10 $ cd ..
otaku@gimli src $ cd linux-2.4.28
otaku@gimli linux-2.4.28 $ make kernelrelease
make: *** No rule to make target `kernelrelease'.  Stop.
otaku@gimli linux-2.4.28 $

I don't think this will help.

Including the kernel's Makefile also is no option, I think ("rulespace 
pollution").

Bye, Mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to retrieve version from kernel source (the right way)?
       [not found]     ` <200502100854.37606.agruen@suse.de>
@ 2005-02-10  8:29       ` Michael Renzmann
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Renzmann @ 2005-02-10  8:29 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: linux-kernel

Hi.

Andreas Gruenbacher wrote:
> A backward-compatible replacement for the new kernelrelease (which was added 
> only 8 weeks ago) rule is:
> 
> echo -e 'foo:\n\t@echo $(KERNELRELEASE)\ninclude Makefile' \
>     | make -f-

Thanks a lot, that works great!

Bye, Mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to retrieve version from kernel source (the right way)?
  2005-02-10  7:06   ` Michael Renzmann
       [not found]     ` <200502100854.37606.agruen@suse.de>
@ 2005-02-10 18:42     ` Sam Ravnborg
  2005-02-10 19:07       ` Michael Renzmann
  1 sibling, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2005-02-10 18:42 UTC (permalink / raw)
  To: Michael Renzmann; +Cc: Sam Ravnborg, linux-kernel

On Thu, Feb 10, 2005 at 08:06:34AM +0100, Michael Renzmann wrote:
> Hi.
> 
> Sam Ravnborg wrote:
> >>But... what is the right way to do this?
> >I think you are looking for:
> >make kernelrelease
> 
> otaku@gimli linux-2.6.10 $ make kernelrelease
> make: *** No rule to make target `kernelrelease'.  Stop.
> otaku@gimli linux-2.6.10 $ cd ..
> otaku@gimli src $ cd linux-2.4.28
> otaku@gimli linux-2.4.28 $ make kernelrelease
> make: *** No rule to make target `kernelrelease'.  Stop.
> otaku@gimli linux-2.4.28 $
> 
> I don't think this will help.
> 
> Including the kernel's Makefile also is no option, I think ("rulespace 
> pollution").

I works with the 2.6 kernel.

	Sam

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to retrieve version from kernel source (the right way)?
  2005-02-10 18:42     ` Sam Ravnborg
@ 2005-02-10 19:07       ` Michael Renzmann
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Renzmann @ 2005-02-10 19:07 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: linux-kernel

Hi.

Sam Ravnborg wrote:
>>otaku@gimli linux-2.6.10 $ make kernelrelease
>>make: *** No rule to make target `kernelrelease'.  Stop.
> I works with the 2.6 kernel.

As Andreas Gruenbacher pointed out, this feature has been implemented 
just about 8 weeks ago. He also gave the following snippet as a backward 
compatible solution:

=== cut ===
echo -e 'foo:\n\t@echo $(KERNELRELEASE)\ninclude Makefile' \
     | make -f-
=== cut ===

This works fine.

Thanks to everyone for your tips and answers.

Bye, Mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-02-10 19:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-09  8:17 How to retrieve version from kernel source (the right way)? Michael Renzmann
2005-02-09  8:22 ` Brice Goglin
2005-02-09  9:14 ` Christoph Hellwig
2005-02-09 21:44 ` Sam Ravnborg
2005-02-10  7:06   ` Michael Renzmann
     [not found]     ` <200502100854.37606.agruen@suse.de>
2005-02-10  8:29       ` Michael Renzmann
2005-02-10 18:42     ` Sam Ravnborg
2005-02-10 19:07       ` Michael Renzmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).