Skip to contentSkip to conversation

put UTS_RELEASE in separate utsversion.h file

RFC PATCH In review Sam Ravnborg 3 participants 3 messages Jan 28, 2006 – Jan 30, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 put UTS_RELEASE in separate utsversion.h file

During the last few days I have been toying with a allmodconfig tree and got irritated by all the extra modules being build over and over again.
The root cause was the definition of UTS_RELEASE in version.h. I had enabled automatic appending of git version and it changed each time I committed something resulting in a lot of recompiling. With the following patch the recompile is kept minimal, the most annoying part being all the .mod.c files - but they actually use UTS_RELEASE so this is avoidable.

I have not updated checkversion.pl - Randy can you do that?

I have not applied the patch yet - wanted some feedback from lkml first. Only functional changes is in top-level makefile.
For all users of UTS_RELEASE I simple included utsversion.h.

Note: I do not know if any external stuff(*) uses UTS_RELEASE and expect it to be in version.h!

(*) I here think of glibc, gcc, udev etc. External modules will have to cope with this change like any in-kernel module

Sam

Makefile +15 -9
index ec7e24f..b5b9c25 100644
@@ -842,20 +842,26 @@ include/config/MARKER: scripts/basic/spl
 
 uts_len := 64
 
-define filechk_version.h
+define filechk_utsversion.h
 	if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
-	  echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
-	  exit 1; \
-	fi; \
-	(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
-	  echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
-	 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
-	)
+	  echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2;    \
+	  exit 1;                                                         \
+	fi;                                                               \
+	(echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";)
 endef
 
-include/linux/version.h: $(srctree)/Makefile .config FORCE
+define filechk_version.h
+	(echo \#define LINUX_VERSION_CODE $(shell                             \
+	expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL));     \
+	echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
+endef
+
+include/linux/version.h: .config include/linux/utsversion.h FORCE
 	$(call filechk,version.h)
 
+include/linux/utsversion.h: .config FORCE
+	$(call filechk,utsversion.h)
+
 # ---------------------------------------------------------------------------
 
 .PHONY: depend dep
arch/alpha/boot/bootp.c +1 -0
index ec53c28..b5580d9 100644
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <linux/mm.h>
 
 #include <asm/system.h>
arch/alpha/boot/bootpz.c +1 -0
index a6657f2..8d9a318 100644
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <linux/mm.h>
 
 #include <asm/system.h>
arch/alpha/boot/main.c +1 -0
index 78c9b0b..25ce6b3 100644
@@ -8,6 +8,7 @@
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <linux/mm.h>
 
 #include <asm/system.h>
arch/frv/kernel/setup.c +1 -0
index 5908dea..92bf6ed 100644
@@ -12,6 +12,7 @@
 
 #include <linux/config.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/delay.h>
arch/i386/boot/setup.S +1 -0
index ca668d9..b7c289a 100644
@@ -49,6 +49,7 @@
 #include <linux/config.h>
 #include <asm/segment.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <linux/compile.h>
 #include <asm/boot.h>
 #include <asm/e820.h>
arch/powerpc/platforms/chrp/setup.c +1 -0
index 2dc87aa..36a9996 100644
@@ -28,6 +28,7 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <linux/adb.h>
 #include <linux/module.h>
 #include <linux/delay.h>
arch/powerpc/platforms/powermac/bootx_init.c +1 -0
index fa8b4d7..c8cd384 100644
@@ -14,6 +14,7 @@
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <asm/sections.h>
 #include <asm/prom.h>
 #include <asm/page.h>
arch/ppc/platforms/chrp_setup.c +1 -0
index 48996b7..fc4ad8e 100644
@@ -28,6 +28,7 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <linux/adb.h>
 #include <linux/module.h>
 #include <linux/delay.h>
arch/ppc/syslib/btext.c +1 -0
index 12fa83e..b40fd33 100644
@@ -8,6 +8,7 @@
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 
 #include <asm/sections.h>
 #include <asm/bootx.h>
arch/x86_64/boot/setup.S +1 -0
index 12ea0b6..b8ace49 100644
@@ -48,6 +48,7 @@
 #include <linux/config.h>
 #include <asm/segment.h>
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <linux/compile.h>
 #include <asm/boot.h>
 #include <asm/e820.h>
include/linux/vermagic.h +1 -0
index fadc535..fa91e0d 100644
@@ -1,4 +1,5 @@
 #include <linux/version.h>
+#include <linux/utsversion.h>
 #include <linux/module.h>
 
 /* Simply sanity version stamp for modules. */
init/version.c +1 -0
index 3ddc3ce..fa2a300 100644
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/uts.h>
 #include <linux/utsname.h>
+#include <linux/utsversion.h>
 #include <linux/version.h>
 
 #define version(a) Version_ ## a
#1 lore raw
Quoted 12 lines · Sam Ravnborg

During the last few days I have been toying with a allmodconfig tree and got irritated by all the extra modules being build over and over again.
The root cause was the definition of UTS_RELEASE in version.h. I had enabled automatic appending of git version and it changed each time I committed something resulting in a lot of recompiling. With the following patch the recompile is kept minimal, the most annoying part being all the .mod.c files - but they actually use UTS_RELEASE so this is avoidable.

I have not updated checkversion.pl - Randy can you do that?

Quoted 8 lines

I have not applied the patch yet - wanted some feedback from lkml first. Only functional changes is in top-level makefile.
For all users of UTS_RELEASE I simple included utsversion.h.

Note: I do not know if any external stuff(*) uses UTS_RELEASE and expect it to be in version.h!

(*) I here think of glibc, gcc, udev etc.

udev does not build against any kernel file, nor care about what kernel is installed when built. It also really doesn't check kernel info when it is running either...

I like this patch, as someone who builds with a lot of modules enabled :)

thanks,

greg k-h

#2 lore raw
In reply to Sam Ravnborg
Quoted 4 lines

During the last few days I have been toying with a allmodconfig tree and got irritated by all the extra modules being build over and over again.

Yes I have noticed that too. It was fine with 2.6.15 - I could compile a kernel, move the binary result and the source tree a little around, wrap it up in an rpm package, install it elsewhere, and upon changing options in .config, it only recompiled the important bits. With 2.6.16-rc1 it seems to always rebuild everything. (I doubt CONFIG_NETFILTER_XT_TARGET_CONNMARK influences kernel/exit.o!)

Jan Engelhardt