aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--external/pflash/Makefile20
-rw-r--r--external/pflash/pflash.c5
2 files changed, 21 insertions, 4 deletions
diff --git a/external/pflash/Makefile b/external/pflash/Makefile
index f951a58..73f5ed6 100644
--- a/external/pflash/Makefile
+++ b/external/pflash/Makefile
@@ -12,7 +12,7 @@ endif
CFLAGS = -O2 -Wall -I.
LDFLAGS = -lrt
-OBJS = pflash.o progress.o ast-sf-ctrl.o
+OBJS = pflash.o progress.o ast-sf-ctrl.o version.o
OBJS += libflash/libflash.o libflash/libffs.o libflash/ecc.o
OBJS += $(ARCH_OBJS)
EXE = pflash
@@ -30,6 +30,22 @@ links:
ln -sf ../../ccan .
ln -sf ../../hw/sfc-ctrl.c .
ln -sf ../../hw/ast-bmc/ast-sf-ctrl.c
+ ln -sf ../../make_version.sh
+
+PFLASH_VERSION ?= $(shell ./make_version.sh $(EXE))
+
+.PHONY: VERSION-always
+.version: VERSION-always
+ @echo $(PFLASH_VERSION) > $@.tmp
+ @cmp -s $@ $@.tmp || cp $@.tmp $@
+ @rm -f $@.tmp
+
+version.c: make_version.sh .version
+ @(if [ "a$(PFLASH_VERSION)" = "a" ]; then \
+ echo "#error You need to set SKIBOOT_VERSION environment variable" > $@ ;\
+ else \
+ echo "const char version[] = \"$(PFLASH_VERSION)\";" ;\
+ fi) > $@
$(OBJS) : links
@@ -40,4 +56,4 @@ clean:
rm -f $(OBJS) $(EXE) *.o *.d libflash/test/test_flash libflash/test/*.o
distclean: clean
rm -f *.c~ *.h~ *.sh~ Makefile~ config.mk~ libflash/*.c~ libflash/*.h~
- rm -f libflash ccan sfc-ctrl.c ast-sf-ctrl.c
+ rm -f libflash ccan sfc-ctrl.c ast-sf-ctrl.c .version .version.tmp
diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index fb783a2..6a6f284 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -23,7 +23,8 @@
#define __aligned(x) __attribute__((aligned(x)))
-#define PFLASH_VERSION "0.8.6"
+/* Full pflash version number (possibly includes gitid). */
+extern const char version[];
static bool must_confirm = true;
static bool dummy_run;
@@ -437,7 +438,7 @@ static void flash_access_setup_pnor(bool use_lpc, bool use_sfc, bool need_write)
static void print_version(void)
{
- printf("Palmetto Flash tool " PFLASH_VERSION "\n");
+ printf("Open-Power Flash tool %s\n", version);
}
static void print_help(const char *pname)