Move definition of LINUX_PACKAGE_ID to new header <generated/package.h>

svn path=/dists/sid/linux/; revision=19288
This commit is contained in:
Ben Hutchings 2012-07-24 00:28:08 +00:00
parent 58eb042b32
commit f24a365c2a
1 changed files with 58 additions and 9 deletions

View File

@ -22,7 +22,15 @@ the kernel version string.
--- a/init/version.c
+++ b/init/version.c
@@ -37,12 +37,12 @@ struct uts_namespace init_uts_ns = {
@@ -11,6 +11,7 @@
#include <linux/uts.h>
#include <linux/utsname.h>
#include <generated/utsrelease.h>
+#include <generated/package.h>
#include <linux/version.h>
#ifndef CONFIG_KALLSYMS
@@ -37,12 +38,12 @@ struct uts_namespace init_uts_ns = {
};
EXPORT_SYMBOL_GPL(init_uts_ns);
@ -41,7 +49,7 @@ the kernel version string.
" (" LINUX_COMPILER ") %s\n";
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -73,8 +73,25 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
@@ -73,8 +73,18 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
@ -51,17 +59,10 @@ the kernel version string.
+ DISTRIBUTION=${DISTRIBUTION:-Debian}
+
+ if [ "$DISTRIBUTION_OFFICIAL_BUILD" ]; then
+ echo \#define LINUX_PACKAGE_ID \" \($DISTRIBUTION $DISTRIBUTION_VERSION\)\"
+ echo \#define LINUX_COMPILE_BY \"unknown\"
+ echo \#define LINUX_COMPILE_HOST \"$DISTRIBUTION\"
+ echo \#define LINUX_COMPILE_ID \" \($DISTRIBUTION_MAINTAINER\)\"
+ else
+ if [ -e version.$DISTRIBUTION ]; then
+ DISTRIBUTION_VERSION=$(cut -d" " -f1 version.$DISTRIBUTION)
+ else
+ DISTRIBUTION_VERSION=unknown
+ fi
+ echo \#define LINUX_PACKAGE_ID \" \($DISTRIBUTION_VERSION\)\"
+ echo \#define LINUX_COMPILE_BY \"`echo $LINUX_COMPILE_BY | $UTS_TRUNCATE`\"
+ echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\"
+ echo \#define LINUX_COMPILE_ID \" \(\" LINUX_COMPILE_BY \"@\" LINUX_COMPILE_HOST \"\)\"
@ -69,3 +70,51 @@ the kernel version string.
echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
) > .tmpcompile
--- a/Makefile
+++ b/Makefile
@@ -976,7 +976,7 @@ endif
prepare2: prepare3 outputmakefile asm-generic
prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
- include/config/auto.conf
+ include/config/auto.conf include/generated/package.h
$(cmd_crmodverdir)
archprepare: archscripts prepare1 scripts_basic
@@ -1008,12 +1008,36 @@ define filechk_version.h
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
endef
+DISTRIBUTION := $(shell lsb_release -is 2>/dev/null)
+ifeq ($(DISTRIBUTION),)
+DISTRIBUTION := Debian
+endif
+
+ifneq ($(DISTRIBUTION_OFFICIAL_BUILD),)
+define filechk_package.h
+ echo \#define LINUX_PACKAGE_ID \" \($(DISTRIBUTION) $(DISTRIBUTION_VERSION)\)\"
+endef
+else
+ifneq ($(wildcard version.$(DISTRIBUTION)),)
+define filechk_package.h
+ echo \#define LINUX_PACKAGE_ID \" \($$(cut -d" " -f1 version.$(DISTRIBUTION))\)\"
+endef
+else
+define filechk_package.h
+ echo \#define LINUX_PACKAGE_ID \" \(unknown\)\"
+endef
+endif
+endif
+
include/linux/version.h: $(srctree)/Makefile FORCE
$(call filechk,version.h)
include/generated/utsrelease.h: include/config/kernel.release FORCE
$(call filechk,utsrelease.h)
+include/generated/package.h: $(srctree)/Makefile FORCE
+ $(call filechk,package.h)
+
PHONY += headerdep
headerdep:
$(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \