[PATCH] add-build-git-head-info.patch

Andy Green andy at openmoko.com
Sun Jul 27 15:49:11 CEST 2008


This patch adds the branch and truncated head has to the version of the
kernel

# cat /proc/version
Linux version 2.6.26-andy-2.6.26:2b3bf342baac52b9-mokodev (agreen at pads.home.warmcat.com) (gcc version 4.1.2) #878 PREEMPT Sun Jul 27 14:45:25 BST 2008

Note this versioning is visible down /lib/modules

Signed-off-by: Andy Green <andy at openmoko.com>
---

 Makefile |    2 +-
 build    |   10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index e3c5eb6..db2771f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 26
-EXTRAVERSION =
+EXTRAVERSION +=
 NAME = Rotary Wombat
 
 # *DOCUMENTATION*
diff --git a/build b/build
index 5bd3d2d..c0169d8 100755
--- a/build
+++ b/build
@@ -4,7 +4,15 @@ set -x
 
 export CROSS_COMPILE=../../cross/bin/arm-angstrom-linux-gnueabi-
 make ARCH=arm silentoldconfig
-if make -j5 ARCH=arm; then
+
+VERSION=
+if [ -d .git ] ; then
+ HEAD=`git show --pretty=oneline | cut -d' ' -f1 | cut -b1-16`
+ BRANCH=`git branch | grep ^\* | cut -d' ' -f2`
+ VERSION=-$BRANCH:$HEAD
+fi
+
+if make -j5 ARCH=arm EXTRAVERSION="$VERSION"; then
 	${CROSS_COMPILE}objcopy -O binary -R .note -R .comment -S arch/arm/boot/compressed/vmlinux linux.bin
 	mkimage -A arm -O linux -T kernel -C none -a 30008000 -e 30008000 -n "Openmoko Kernel Image Neo1973(GTA02)" -d linux.bin uImage.bin
 	exit 0





More information about the openmoko-kernel mailing list