2004-09-01 13:49:36

by Jan-Benedict Glaw

[permalink] [raw]
Subject: Re: kbuild: Support LOCALVERSION

On Tue, 2004-08-31 21:26:43 +0200, Sam Ravnborg <[email protected]>
wrote in message <[email protected]>:
> The following patch combines the request from several people.
> If you place a file named localversion* in the root of your
> soruce tree or the root of your output tree the text included in this
> file will be appended to KERNELRELEASE.
>
> LOCALVERSION was originally introduced by Ian Wienand <[email protected]>
>
> This allows one to put a short string in localversion identifying this
> particular configuration "-smpacpi", or to identify applied patches
> to the source "-llat-np".
>
> More specifically:
> $(srctree)/localversion-lowlatency contains "-llat"
> $(srctree)/localversion-scheduler-nick constins "-np"
>
> $(objtree)/localversion contains "-smpacpi"
>
> Resulting KERNELRELEASE would be:
> 2.6.8.rc1-smpacpi-llat-np

Basically: I love it. Maybe it would also be good (in the longer term)
to introduce a config name into one of the Kconfig files, which is
preserved in the .config file (eg. SuSE does something like that and
even while I'm not a SuSE user, it's really dandy at some times, esp.
for things like "SMP-4GB", "VAX-KA4x" and the like). It's basically like
adding the defconfig_* name to some of the variables :-)

MfG, JBG
PS: When will the package support show up?

--
Jan-Benedict Glaw [email protected] . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier B?rger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));


Attachments:
(No filename) (1.62 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-09-01 14:54:40

by Sam Ravnborg

[permalink] [raw]
Subject: Re: kbuild: Support LOCALVERSION

On Wed, Sep 01, 2004 at 03:43:41PM +0200, Jan-Benedict Glaw wrote:
> Maybe it would also be good (in the longer term)
> to introduce a config name into one of the Kconfig files, which is
> preserved in the .config file (eg. SuSE does something like that and
> even while I'm not a SuSE user, it's really dandy at some times, esp.
> for things like "SMP-4GB", "VAX-KA4x" and the like). It's basically like
> adding the defconfig_* name to some of the variables :-)

Ian addedconfig CONFIG_LOCALVERSION to a Kconfig file. I will
try to add it and see how it turns out. If Ian does not beat me..

> PS: When will the package support show up?
UML needs to be finised first.
I have several packages related patches queued up. But I want
to give it an extra look since there are several basic issues
I am not satisfied with.

Sam

2004-09-02 10:43:40

by Ian Wienand

[permalink] [raw]
Subject: [PATCH] kbuild: Support LOCALVERSION

On Wed, Sep 01, 2004 at 04:56:47PM +0200, Sam Ravnborg wrote:
> Ian addedconfig CONFIG_LOCALVERSION to a Kconfig file. I will
> try to add it and see how it turns out. If Ian does not beat me..

Ok, here is my attempt. I think it does everything everyone wants

* localversion* files are read first
* config variable is appended last
* LOCALVERSION from the command line overrides all of this
* check is forced on build, since we can't really know when
the config or environment options change.

Thanks,

-i

Add LOCALVERSION so we can append strings that show up in uname
without having to fiddle with the Makefile and EXTRAVERSION, etc.

Signed-off-by: Ian Wienand <[email protected]>

===== Makefile 1.523 vs edited =====
--- 1.523/Makefile 2004-08-25 06:34:30 +10:00
+++ edited/Makefile 2004-09-02 20:32:57 +10:00
@@ -141,7 +141,26 @@

export srctree objtree VPATH TOPDIR

-KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
+nullstring :=
+space := $(nullstring) # end of line
+
+# Take the contents of any files called localversion and the config
+# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. Be
+# careful not to include files twice if building in the source
+# directory. LOCALVERSION from the command line should override all
+# of this
+
+ifeq ($(objtree),$(srctree))
+localversion-files := $(wildcard $(srctree)/localversion*)
+else
+localversion-files := $(wildcard $(objtree)/localversion* $(srctree)/localversion*)
+endif
+
+LOCALVERSION = $(subst $(space),, \
+ $(shell cat /dev/null $(localversion-files)) \
+ $(subst ",,$(CONFIG_LOCALVERSION)))
+
+KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION)

# SUBARCH tells the usermode build what the underlying arch is. That is set
# first, and if a usermode build is happening, the "ARCH=um" on the command
@@ -329,8 +348,8 @@
-fno-strict-aliasing -fno-common
AFLAGS := -D__ASSEMBLY__

-export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
- CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
+export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION LOCALVERSION KERNELRELEASE \
+ ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB LDFLAGS_MODULE CHECK CHECKFLAGS

@@ -747,8 +766,8 @@
# Generate some files
# ---------------------------------------------------------------------------

-# version.h changes when $(KERNELRELEASE) etc change, as defined in
-# this Makefile
+# KERNELRELEASE can change from a few different places, meaning version.h
+# needs to be updated, so this check is forced on all builds

uts_len := 64

@@ -763,7 +782,7 @@
)
endef

-include/linux/version.h: Makefile
+include/linux/version.h: $(srctree)/Makefile $(localversion-files) FORCE
$(call filechk,version.h)

# ---------------------------------------------------------------------------
===== init/Kconfig 1.48 vs edited =====
--- 1.48/init/Kconfig 2004-08-31 18:00:08 +10:00
+++ edited/init/Kconfig 2004-09-02 20:13:01 +10:00
@@ -293,6 +293,16 @@
option replaces shmem and tmpfs with the much simpler ramfs code,
which may be appropriate on small systems without swap.

+config LOCALVERSION
+ string "Local Version"
+ help
+ Append an extra string to the end of your kernel version.
+ This will show up when you type uname, for example.
+ The string you set here will be appended after the contents of
+ any files with a filename matching localversion* in your
+ object and source tree, in that order. Your total string can
+ be a maximum of 64 characters.
+
endmenu # General setup

config TINY_SHMEM


Attachments:
(No filename) (3.65 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments

2004-09-05 19:40:30

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH] kbuild: Support LOCALVERSION

On Thu, Sep 02, 2004 at 08:42:09PM +1000, Ian Wienand wrote:
> On Wed, Sep 01, 2004 at 04:56:47PM +0200, Sam Ravnborg wrote:
> > Ian addedconfig CONFIG_LOCALVERSION to a Kconfig file. I will
> > try to add it and see how it turns out. If Ian does not beat me..
>
> Ok, here is my attempt. I think it does everything everyone wants
>
> * localversion* files are read first
> * config variable is appended last
> * LOCALVERSION from the command line overrides all of this
> * check is forced on build, since we can't really know when
> the config or environment options change.
>
> Thanks,
>
> -i

applied - thanks (your mailer broke the patch but I fixed it up)

Sam