add git version numbers for ccat and MINI

This commit is contained in:
bushing 2009-05-10 19:19:57 -07:00
parent 48109e684b
commit 6c08b4b5be
3 changed files with 25 additions and 2 deletions

View File

@ -19,15 +19,20 @@ include ../../common.mk
all: $(TARGET_BIN)
main.o: main.c git_version.h
$(TARGET_BIN): $(TARGET) $(ELFLOADER)
@echo "MAKEBIN $@"
@$(MAKEBIN) $(ELFLOADER) $< $@
upload: $(TARGET_BIN)
@$(WIIDEV)/bin/bootmii -a $<
git_version.h:
echo 'const char git_version[] = "'`./describesimple.sh`'";' > git_version.h
clean: myclean
myclean:
-rm -f $(TARGET_BIN)
-rm -f $(TARGET_BIN) git_version.h

17
describesimple.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
# Check for git and a git repo.
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
comm=`git log --pretty=oneline -n1 ../mini | awk ' { print $1 }'`
if tagver=`git describe --exact-match --match bootmii-\* $comm 2>/dev/null`; then
printf "%s" "BootMii v"`printf "%s" $tagver | awk '{ sub (/bootmii-/, ""); print;}'`
else
printf "%s" ""`printf "%s" \`git describe --abbrev=4 --match bootmii-\* $comm | awk '{ sub (/bootmii-/, ""); print;}'\``
fi
# Are there uncommitted changes?
git update-index --refresh --unmerged > /dev/null
git diff-index --quiet HEAD ../mini || printf "%s" '*'
fi
echo

3
main.c
View File

@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "crypto.h"
#include "nand.h"
#include "boot2.h"
#include "git_version.h"
#define PPC_BOOT_FILE "/bootmii/ppcboot.elf"
@ -51,7 +52,7 @@ u32 _main(void *base)
(void)base;
gecko_init();
gecko_printf("mini v0.2 loading\n");
gecko_printf("mini v0.2 (%s) loading\n", git_version);
gecko_printf("Initializing exceptions...\n");
exception_initialize();