Messages in this thread Patch in this message | | | From | Ian Wienand <> | Date | Mon, 23 Aug 2004 11:47:18 +1000 | Subject | Adding LOCALVERSION to build |
| |
Hi,
If you are wanting to build multiple versions of the same kernel to test things out, it would be really handy to have a LOCALVERSION variable that could be easily overridden. I used to just play with EXTRAVERSION, but that has become increasingly inappropriate and it really would be nicer to just be able to do make O=outputdir LOCALVERSION=aversion and have it appended so uname reports something useful.
I just tried the attached, which works but having a dummy dependency to make the version.h check run all the time is a bit ugly. I can't think of another way to indicate to make to update version.h if I compile once with LOCALVERSION variable set from the command line, and once without.
Anyway, is the general idea workable?
-i ianw@gelato.unsw.edu.au http://www.gelato.unsw.edu.au ===== Makefile 1.513 vs edited ===== --- 1.513/Makefile 2004-08-14 20:54:03 +10:00 +++ edited/Makefile 2004-08-23 11:40:57 +10:00 @@ -141,7 +141,12 @@ export srctree objtree VPATH TOPDIR -KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) +# Take config variable for localversion unless overridden on the command line +ifneq ($(CONFIG_LOCALVERSION),"") + LOCALVERSION=$(subst ",,$(CONFIG_LOCALVERSION)) +endif + +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 @@ -722,7 +727,10 @@ ) endef -include/linux/version.h: Makefile +.localversion.tmp: +#dummy, only need to update if localversion has changed + +include/linux/version.h: Makefile .localversion.tmp $(call filechk,version.h) # --------------------------------------------------------------------------- ===== init/Kconfig 1.45 vs edited ===== --- 1.45/init/Kconfig 2004-07-28 07:43:46 +10:00 +++ edited/init/Kconfig 2004-08-23 11:24:52 +10:00 @@ -285,6 +285,11 @@ If unsure, say N. +config LOCALVERSION + string "Local Version" + help + Add a special extra string to identify this kernel locally. + endmenu # General setup [unhandled content-type:application/pgp-signature] | |