2013-04-19 18:43:30

by Mathieu Desnoyers

[permalink] [raw]
Subject: [RFC PATCH] Fix: remove stale include/linux/version.h in toplevel Makefile

With a kernel tree that contains a generated include/linux/version.h, if
someone just does a git pull to update to a newer kernel version that
includes

commit 10b63956fce7f369cc37fd4d994f09bd5203efe4

"UAPI: Plumb the UAPI Kbuilds into the user header installation and
checking"

and
commit d183e6f570f3c0c23d253fd262c90244e72d7ffd

"UAPI: Move linux/version.h"

Any newer build will fail to overwrite or remove the stale version.h
file. The new include/generated/uapi/linux/version.h is indeed
generated, but the stale file in include/linux has precedence.

This leads to very unfortunate consequences for any user relying on
version.h to expose the kernel version accurately, since the old "stale"
kernel version will be seen by the build.

Ensure that stale include/linux/version.h is removed whenever the new
version.h is generated.

Signed-off-by: Mathieu Desnoyers <[email protected]>
CC: David Howells <[email protected]>
CC: Arnd Bergmann <[email protected]>
CC: Thomas Gleixner <[email protected]>
CC: "Paul E. McKenney" <[email protected]>
CC: Dave Jones <[email protected]>
CC: Linus Torvalds <[email protected]>
---
Makefile | 2 ++
1 file changed, 2 insertions(+)

Index: linux/Makefile
===================================================================
--- linux.orig/Makefile
+++ linux/Makefile
@@ -823,8 +823,10 @@ endif
# prepare2 creates a makefile if using a separate output directory
prepare2: prepare3 outputmakefile asm-generic

+# Includes removal of stale version.h from earlier kernel versions.
prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
include/config/auto.conf
+ $(Q)rm -f include/linux/version.h
$(cmd_crmodverdir)

archprepare: archheaders archscripts prepare1 scripts_basic


--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com