Skip to contentSkip to conversation

"PREEMPT" in UTS_VERSION

PATCH In review Matt Mackall 2 participants 3 messages Feb 9, 2005 – Mar 14, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 "PREEMPT" in UTS_VERSION

Add PREEMPT to UTS_VERSION where enabled as is done for SMP to make preempt kernels easily identifiable.

scripts/mkcompile_h +2 -0
Index: mm1/scripts/mkcompile_h
===================================================================
@@ -2,6 +2,7 @@
 ARCH=$2
 SMP=$3
 CC=$4
+PREEMPT=$5
 
 # If compile.h exists already and we don't own autoconf.h
 # (i.e. we're not the same user who did make *config), don't
@@ -27,6 +28,7 @@
 
 UTS_VERSION="#$VERSION"
 if [ -n "$SMP" ] ; then UTS_VERSION="$UTS_VERSION SMP"; fi
+if [ -n "$PREEMPT" ] ; then UTS_VERSION="$UTS_VERSION PREEMPT"; fi
 UTS_VERSION="$UTS_VERSION `LC_ALL=C LANG=C date`"
 
 # Truncate to maximum length
init/Makefile +1 -1
Index: mm1/init/Makefile
===================================================================
@@ -25,4 +25,4 @@
 
 include/linux/compile.h: FORCE
 	@echo '  CHK     $@'
-	@$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
+	@$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)" "$(CONFIG_PREEMPT)"
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#1 lore raw
Quoted 2 lines · Matt Mackall

Add PREEMPT to UTS_VERSION where enabled as is done for SMP to make preempt kernels easily identifiable.

I have the following patch in my tree now. It has the advantage that compile.h gets updated when you change the PREEMPT setting.

How many scripts parsing the output of uname -v will break because of this?

Sam

===== init/Makefile 1.28 vs edited =====

init/Makefile +2 -1
@@ -25,4 +25,5 @@
 
 include/linux/compile.h: FORCE
 	@echo '  CHK     $@'
-	@$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
+	"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(CFLAGS)"

===== scripts/mkcompile_h 1.17 vs edited =====

scripts/mkcompile_h +8 -4
@@ -1,7 +1,8 @@
 TARGET=$1
 ARCH=$2
 SMP=$3
-CC=$4
+PREEMPT=$4
+CC=$5
 
 # If compile.h exists already and we don't own autoconf.h
 # (i.e. we're not the same user who did make *config), don't
@@ -26,8 +27,10 @@
 
 
 UTS_VERSION="#$VERSION"
-if [ -n "$SMP" ] ; then UTS_VERSION="$UTS_VERSION SMP"; fi
-UTS_VERSION="$UTS_VERSION `LC_ALL=C LANG=C date`"
+CONFIG_FLAGS=""
+if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
+if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
+UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`"
 
 # Truncate to maximum length
 
@@ -37,7 +40,8 @@
 # Generate a temporary compile.h
 
 ( echo /\* This file is auto generated, version $VERSION \*/
-
+  if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi
+  
   echo \#define UTS_MACHINE \"$ARCH\"
 
   echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
#2 lore raw
Quoted 8 lines · Sam Ravnborg
Quoted 2 lines · Matt Mackall

Add PREEMPT to UTS_VERSION where enabled as is done for SMP to make preempt kernels easily identifiable.

I have the following patch in my tree now. It has the advantage that compile.h gets updated when you change the PREEMPT setting.

How many scripts parsing the output of uname -v will break because of this?

None that wouldn't have already broken from free-form extraversion and vendor version crap, I suspect.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.