initial import
[patches.git] / u-boot-nicer-version-handling.patch
1 diff --git a/Makefile b/Makefile
2 index 2d8cff3..41661e3 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -290,11 +290,15 @@ $(U_BOOT_NAND): $(NAND_SPL) $(obj)u-boot.bin
6 cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
7
8 version:
9 - @echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE); \
10 - echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE); \
11 - echo -n $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion \
12 - $(TOPDIR)) >> $(VERSION_FILE); \
13 - echo "\"" >> $(VERSION_FILE)
14 + @echo -n "#define U_BOOT_VERSION \"U-Boot " > $(VERSION_FILE).tmp; \
15 + echo -n "$(U_BOOT_VERSION)" >> $(VERSION_FILE).tmp; \
16 + echo -n "$(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion $(TOPDIR))" >> $(VERSION_FILE).tmp; \
17 + echo "\"" >> $(VERSION_FILE).tmp
18 + @if ! cmp -s $(VERSION_FILE) $(VERSION_FILE).tmp; then \
19 + mv -f $(VERSION_FILE).tmp $(VERSION_FILE); \
20 + else \
21 + rm -f $(VERSION_FILE).tmp; \
22 + fi
23
24 gdbtools:
25 $(MAKE) -C tools/gdb all || exit 1
26 diff --git a/tools/setlocalversion b/tools/setlocalversion
27 index 9a23825..25072fd 100755
28 --- a/tools/setlocalversion
29 +++ b/tools/setlocalversion
30 @@ -20,3 +20,11 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
31 printf '%s' -dirty
32 fi
33 fi
34 +
35 +# Check for svn and a svn repo.
36 +if rev=`svn info 2>/dev/null | grep '^Revision' | awk '{print $NF}'` ; then
37 + printf -- '-svn%s' $rev
38 +fi
39 +
40 +# Check for any localversion-* files
41 +printf '%s' "`cat localversion-* 2>/dev/null`"