* kbuild: Support LOCALVERSION
@ 2004-08-31 19:26 Sam Ravnborg
2004-09-01 1:08 ` Ian Wienand
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Sam Ravnborg @ 2004-08-31 19:26 UTC (permalink / raw)
To: linux-kernel, Andrew Morton; +Cc: Ian Wienand, Christoph Hellwig
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 <ianw@gelato.unsw.edu.au>
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
Note that you no longer need to modify your Makefile to identify
your kernel so no rejects when applying new patches.
If you add a new localversion* file, or change a existing one kbuild
will pick up this and do the proper rebuild next time you run make.
Only issue is that KERNELRELEASE needs to be <= 64 chars - so keep the names short.
kbuild errors out if you are above limit.
$ cat localviersion-long
very-long-version-in-localversion-file-exceeding-64-chars-for-sure
Example:
CHK include/linux/version.h
"2.6.9-rc1-very-long-version-in-localversion-file-exceeding-64-chars-for-sure" exceeds 64 characters
make: *** [include/linux/version.h] Error 1
Where do we document this?
[This is deliberately not pushed to my bk tree - want some comments first].
Sam
===== Makefile 1.526 vs edited =====
--- 1.526/Makefile 2004-08-30 21:23:05 +02:00
+++ edited/Makefile 2004-08-31 21:05:38 +02:00
@@ -141,7 +141,14 @@ VPATH := $(srctree)
export srctree objtree VPATH TOPDIR
-KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
+nullstring :=
+space := $(nullstring) # end of line
+
+LOCALVERSION := $(subst $(space),, \
+ $(shell cat /dev/null $(objtree)/localversion* \
+ $(if $(KBUILD_SRC),$(srctree)/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 +336,8 @@ CFLAGS := -Wall -Wstrict-prototypes -W
-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
@@ -763,7 +770,8 @@ define filechk_version.h
)
endef
-include/linux/version.h: Makefile
+include/linux/version.h: $(srctree)/Makefile \
+ $(objtree)/localversion* $(srctree)/localversion*
$(call filechk,version.h)
# ---------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: kbuild: Support LOCALVERSION 2004-08-31 19:26 kbuild: Support LOCALVERSION Sam Ravnborg @ 2004-09-01 1:08 ` Ian Wienand 2004-09-01 1:24 ` Ian Wienand 2004-09-01 11:44 ` Geert Uytterhoeven 2004-09-01 13:43 ` Jan-Benedict Glaw 2 siblings, 1 reply; 10+ messages in thread From: Ian Wienand @ 2004-09-01 1:08 UTC (permalink / raw) To: linux-kernel, Andrew Morton, Christoph Hellwig [-- Attachment #1: Type: text/plain, Size: 1197 bytes --] On Tue, Aug 31, 2004 at 09:26:43PM +0200, Sam Ravnborg wrote: > 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. With this patch *without* a localversion file I get ianw@baci:/tmp/kbuild-test$ make cat: /tmp/kbuild-test/localversion*: No such file or directory make: *** No rule to make target `/tmp/kbuild-test/localversion*', needed by `include/linux/version.h'. Stop. However, with the right files there it works as you describe. The interaction with LOCALVERSION from the command line (i.e. make LOCALVERSION=aversion) is still a bit funny too, since it won't cause version.h to be rebuilt. Is it going to just be a case of "you can't specify LOCALVERSION" from the command line? My original patch also had a Kconfig option which would be inserted; I figured this might be good because if you're creating a bunch of different configs you are probably in [menu|x]config to change the options, so it might be convenient to just set it via a string in there. Would anyone else like to see that? -i [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kbuild: Support LOCALVERSION 2004-09-01 1:08 ` Ian Wienand @ 2004-09-01 1:24 ` Ian Wienand 2004-09-01 5:11 ` Sam Ravnborg 0 siblings, 1 reply; 10+ messages in thread From: Ian Wienand @ 2004-09-01 1:24 UTC (permalink / raw) To: linux-kernel, Andrew Morton, Christoph Hellwig [-- Attachment #1.1: Type: text/plain, Size: 496 bytes --] On Wed, Sep 01, 2004 at 11:08:40AM +1000, Ian Wienand wrote: > With this patch *without* a localversion file I get > > ianw@baci:/tmp/kbuild-test$ make > cat: /tmp/kbuild-test/localversion*: No such file or directory > make: *** No rule to make target `/tmp/kbuild-test/localversion*', needed by `include/linux/version.h'. Stop. > > However, with the right files there it works as you describe. Sorry to reply to myself, but I forgot to include a suggested patch (attached). -i [-- Attachment #1.2: Makefile.localversion.diff --] [-- Type: text/plain, Size: 1531 bytes --] ===== Makefile 1.523 vs edited ===== --- 1.523/Makefile 2004-08-25 06:34:30 +10:00 +++ edited/Makefile 2004-09-01 11:17:27 +10:00 @@ -141,7 +141,14 @@ export srctree objtree VPATH TOPDIR -KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) +nullstring := +space := $(nullstring) # end of line +localversion-files := $(wildcard $(objtree)/localversion* $(srctree)/localversion*) + +LOCALVERSION := $(subst $(space),, \ + $(shell cat /dev/null $(localversion-files))) + +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 +336,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 @@ -763,7 +770,7 @@ ) endef -include/linux/version.h: Makefile +include/linux/version.h: $(srctree)/Makefile $(localversion-files) $(call filechk,version.h) # --------------------------------------------------------------------------- [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kbuild: Support LOCALVERSION 2004-09-01 1:24 ` Ian Wienand @ 2004-09-01 5:11 ` Sam Ravnborg 0 siblings, 0 replies; 10+ messages in thread From: Sam Ravnborg @ 2004-09-01 5:11 UTC (permalink / raw) To: Ian Wienand; +Cc: linux-kernel, Andrew Morton, Christoph Hellwig On Wed, Sep 01, 2004 at 11:24:22AM +1000, Ian Wienand wrote: > Sorry to reply to myself, but I forgot to include a suggested patch > (attached). > Thanks for the fix. > @@ -763,7 +770,7 @@ > ) > endef > > -include/linux/version.h: Makefile > +include/linux/version.h: $(srctree)/Makefile $(localversion-files) > $(call filechk,version.h) > We could just make this: include/linux/version.h: FORCE $(call filechk,version.h) Then version.h would be updated also if LOCALVERSION is specified on the command line. Only issue is that it will always be checked - but the same goes for a few other files. Sam ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kbuild: Support LOCALVERSION 2004-08-31 19:26 kbuild: Support LOCALVERSION Sam Ravnborg 2004-09-01 1:08 ` Ian Wienand @ 2004-09-01 11:44 ` Geert Uytterhoeven 2004-09-01 13:14 ` Sam Ravnborg 2004-09-01 13:43 ` Jan-Benedict Glaw 2 siblings, 1 reply; 10+ messages in thread From: Geert Uytterhoeven @ 2004-09-01 11:44 UTC (permalink / raw) To: Sam Ravnborg Cc: Linux Kernel Development, Andrew Morton, Ian Wienand, Christoph Hellwig On Tue, 31 Aug 2004, Sam Ravnborg wrote: > 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 Wouldn't it make more sense the other way around (i.e. first append $(srctree)/localversion-*, then append $(objtree)/localversion*)? Hmm, from a second thought the order depends on what your most interested in: building kernels with different configs, or building kernels from different sources. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kbuild: Support LOCALVERSION 2004-09-01 11:44 ` Geert Uytterhoeven @ 2004-09-01 13:14 ` Sam Ravnborg 0 siblings, 0 replies; 10+ messages in thread From: Sam Ravnborg @ 2004-09-01 13:14 UTC (permalink / raw) To: Geert Uytterhoeven Cc: Sam Ravnborg, Linux Kernel Development, Andrew Morton, Ian Wienand, Christoph Hellwig > On Tue, 31 Aug 2004, Sam Ravnborg wrote: >> 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 > > Wouldn't it make more sense the other way around (i.e. first append > $(srctree)/localversion-*, then append $(objtree)/localversion*)? > > Hmm, from a second thought the order depends on what your most interested > in: > building kernels with different configs, or building kernels from > different > sources. > My rationale was that the config used would vary more than the source. I also thought about sorting the files - but if Andrew for example start using this it would maybe come in the middle. Therefore this more simple approach. Sam ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kbuild: Support LOCALVERSION 2004-08-31 19:26 kbuild: Support LOCALVERSION Sam Ravnborg 2004-09-01 1:08 ` Ian Wienand 2004-09-01 11:44 ` Geert Uytterhoeven @ 2004-09-01 13:43 ` Jan-Benedict Glaw 2004-09-01 14:56 ` Sam Ravnborg 2 siblings, 1 reply; 10+ messages in thread From: Jan-Benedict Glaw @ 2004-09-01 13:43 UTC (permalink / raw) To: linux-kernel, Andrew Morton, Ian Wienand, Christoph Hellwig [-- Attachment #1: Type: text/plain, Size: 1699 bytes --] On Tue, 2004-08-31 21:26:43 +0200, Sam Ravnborg <sam@ravnborg.org> wrote in message <20040831192642.GA15855@mars.ravnborg.org>: > 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 <ianw@gelato.unsw.edu.au> > > 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 jbglaw@lug-owl.de . +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)); [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: kbuild: Support LOCALVERSION 2004-09-01 13:43 ` Jan-Benedict Glaw @ 2004-09-01 14:56 ` Sam Ravnborg 2004-09-02 10:42 ` [PATCH] " Ian Wienand 0 siblings, 1 reply; 10+ messages in thread From: Sam Ravnborg @ 2004-09-01 14:56 UTC (permalink / raw) To: linux-kernel, Andrew Morton, Ian Wienand, Christoph Hellwig 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] kbuild: Support LOCALVERSION 2004-09-01 14:56 ` Sam Ravnborg @ 2004-09-02 10:42 ` Ian Wienand 2004-09-05 19:43 ` Sam Ravnborg 0 siblings, 1 reply; 10+ messages in thread From: Ian Wienand @ 2004-09-02 10:42 UTC (permalink / raw) To: linux-kernel, Andrew Morton, Christoph Hellwig [-- Attachment #1: Type: text/plain, Size: 3837 bytes --] 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 <ianw@gelato.unsw.edu.au> ===== 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 [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] kbuild: Support LOCALVERSION 2004-09-02 10:42 ` [PATCH] " Ian Wienand @ 2004-09-05 19:43 ` Sam Ravnborg 0 siblings, 0 replies; 10+ messages in thread From: Sam Ravnborg @ 2004-09-05 19:43 UTC (permalink / raw) To: Ian Wienand; +Cc: linux-kernel, Andrew Morton, Christoph Hellwig 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 ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-09-05 19:40 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-08-31 19:26 kbuild: Support LOCALVERSION Sam Ravnborg 2004-09-01 1:08 ` Ian Wienand 2004-09-01 1:24 ` Ian Wienand 2004-09-01 5:11 ` Sam Ravnborg 2004-09-01 11:44 ` Geert Uytterhoeven 2004-09-01 13:14 ` Sam Ravnborg 2004-09-01 13:43 ` Jan-Benedict Glaw 2004-09-01 14:56 ` Sam Ravnborg 2004-09-02 10:42 ` [PATCH] " Ian Wienand 2004-09-05 19:43 ` Sam Ravnborg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®