File tree Expand file tree Collapse file tree 8 files changed +60
-22
lines changed Expand file tree Collapse file tree 8 files changed +60
-22
lines changed Original file line number Diff line number Diff line change @@ -87,12 +87,12 @@ linux.bin.ub linux.bin.gz: linux.bin
8787linux.bin : vmlinux
8888linux.bin linux.bin.gz linux.bin.ub :
8989 $(Q )$(MAKE ) $(build ) =$(boot ) $(boot ) /$@
90- @echo ' Kernel: $(boot)/$@ is ready' ' (#' ` cat .version ` ' )'
90+ @echo ' Kernel: $(boot)/$@ is ready' ' (#' ` $( srctree ) /scripts/kversion.sh --show ` ' )'
9191
9292PHONY += simpleImage.$(DTB )
9393simpleImage.$(DTB ) : vmlinux
9494 $(Q )$(MAKE ) $(build ) =$(boot ) $(addprefix $(boot ) /$@ ., ub unstrip strip)
95- @echo ' Kernel: $(boot)/$@ is ready' ' (#' ` cat .version ` ' )'
95+ @echo ' Kernel: $(boot)/$@ is ready' ' (#' ` $( srctree ) /scripts/kversion.sh --show ` ' )'
9696
9797define archhelp
9898 echo '* linux.bin - Create raw binary'
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ cmd_image = $(obj)/tools/build $(obj)/setup.bin $(obj)/vmlinux.bin \
8080
8181$(obj ) /bzImage : $(obj ) /setup.bin $(obj ) /vmlinux.bin $(obj ) /tools/build FORCE
8282 $(call if_changed,image)
83- @$(kecho ) ' Kernel: $@ is ready' ' (#' ` cat .version ` ' )'
83+ @$(kecho ) ' Kernel: $@ is ready' ' (#' ` $( srctree ) /scripts/kversion.sh --show ` ' )'
8484
8585OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note -R .comment -S
8686$(obj ) /vmlinux.bin : $(obj ) /compressed/vmlinux FORCE
Original file line number Diff line number Diff line change @@ -31,8 +31,14 @@ $(obj)/version.o: include/generated/compile.h
3131 chk_compile.h = :
3232 quiet_chk_compile.h = echo ' CHK $@ '
3333silent_chk_compile.h = :
34- include/generated/compile.h : FORCE
34+ include/generated/compile.h : kversion FORCE
3535 @$($(quiet ) chk_compile.h)
3636 $(Q )$(CONFIG_SHELL ) $(srctree ) /scripts/mkcompile_h $@ \
3737 " $( UTS_MACHINE) " " $( CONFIG_SMP) " " $( CONFIG_PREEMPT) " \
3838 " $( CONFIG_PREEMPT_RT) " " $( CC) $( KBUILD_CFLAGS) "
39+
40+ quiet_cmd_kversion = CALL $<
41+ cmd_kversion = $(CONFIG_SHELL ) $< --update
42+
43+ kversion : $(srctree ) /scripts/kversion.sh FORCE
44+ $(call cmd,kversion)
Original file line number Diff line number Diff line change 1+ #! /bin/sh -e
2+
3+ show_version () {
4+ local dotversion=" $1 " ; shift
5+
6+ # Check if special build version is requested
7+ if [ -n " $KBUILD_BUILD_VERSION " ]; then
8+ echo " $KBUILD_BUILD_VERSION "
9+ else
10+ cat $dotversion 2> /dev/null || echo 1
11+ fi
12+ }
13+
14+ update_version () {
15+ local dotversion=" $1 " ; shift
16+
17+ # Don't update local version if special build version is requested
18+ if [ -n " $KBUILD_BUILD_VERSION " ]; then return ; fi
19+
20+ if [ -r $dotversion ]; then
21+ local version=" $( expr 0$( cat $dotversion ) + 1) "
22+ echo " $version " > $dotversion
23+ else
24+ rm -f $dotversion
25+ echo " 1" > $dotversion
26+ fi
27+ }
28+
29+ VERSION_FILE_NAME=" .version"
30+
31+ show=
32+ update=
33+ while [ " $# " -ge " 1" ]; do
34+ case " $1 " in
35+ --show) show=1 ;;
36+ --update) update=1 ;;
37+ --) break ;;
38+ esac
39+ shift
40+ done
41+
42+ if [ -n " $1 " ]; then VERSION_FILE_NAME=" $1 " ; fi
43+
44+ if [ -n " $show " ]; then show_version " $VERSION_FILE_NAME " ; fi
45+ if [ -n " $update " ]; then update_version " $VERSION_FILE_NAME " ; fi
Original file line number Diff line number Diff line change 228228# We need access to CONFIG_ symbols
229229. include/config/auto.conf
230230
231- # Update version
232- info GEN .version
233- if [ -r .version ]; then
234- VERSION=$( expr 0$( cat .version) + 1)
235- echo $VERSION > .version
236- else
237- rm -f .version
238- echo 1 > .version
239- fi ;
240-
241231# final build of init/
242232${MAKE} -f " ${srctree} /scripts/Makefile.build" obj=init
243233
Original file line number Diff line number Diff line change @@ -28,12 +28,6 @@ set -f
2828LC_ALL=C
2929export LC_ALL
3030
31- if [ -z " $KBUILD_BUILD_VERSION " ]; then
32- VERSION=$( cat .version 2> /dev/null || echo 1)
33- else
34- VERSION=$KBUILD_BUILD_VERSION
35- fi
36-
3731if [ -z " $KBUILD_BUILD_TIMESTAMP " ]; then
3832 TIMESTAMP=` date`
3933else
5044 LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST
5145fi
5246
47+ VERSION=$( $srctree /scripts/kversion.sh --show)
48+
5349UTS_VERSION=" #$VERSION "
50+
5451CONFIG_FLAGS=" "
5552if [ -n " $SMP " ] ; then CONFIG_FLAGS=" SMP" ; fi
5653if [ -n " $PREEMPT " ] ; then CONFIG_FLAGS=" $CONFIG_FLAGS PREEMPT" ; fi
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ if [ -n "$KDEB_PKGVERSION" ]; then
9090 packageversion=$KDEB_PKGVERSION
9191 revision=${packageversion##* -}
9292else
93- revision=$( cat .version 2> /dev/null || echo 1 )
93+ revision=$( $srctree /scripts/kversion.sh --show )
9494 packageversion=$version -$revision
9595fi
9696sourcename=$KDEB_SOURCENAME
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
4242 Name: kernel
4343 Summary: The Linux Kernel
4444 Version: $__KERNELRELEASE
45- Release: $( cat .version 2> /dev/null || echo 1 )
45+ Release: $( $srctree /scripts/kversion.sh --show )
4646 License: GPL
4747 Group: System Environment/Kernel
4848 Vendor: The Linux Community
You can’t perform that action at this time.
0 commit comments