aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2015-06-03 19:17:12 -0400
committerGerd Hoffmann <kraxel@redhat.com>2015-06-12 08:51:40 +0200
commit33d4d4f83089c3d0abeddff680860325fd31706f (patch)
tree3764ae7fe1d0087690e7b6a6a295d45742ec3a6f
parentdbd4a8791915f6cadb67d37d97e2768a21d8846e (diff)
downloadseabios-33d4d4f83089c3d0abeddff680860325fd31706f.zip
seabios-33d4d4f83089c3d0abeddff680860325fd31706f.tar.gz
seabios-33d4d4f83089c3d0abeddff680860325fd31706f.tar.bz2
build: Support "make VERSION=xyz" to override the default build version
Add a build option to explicitly set the version information compiled into the seabios and seavgabios binaries. This may assist in reproducible builds or to better link builds to distribution packages. If the new "VERSION=" parameter is not provided then the default build version remains unchanged. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> (cherry picked from commit 624e812764beda88b47c0018b1cee3b86d5c59eb)
-rw-r--r--Makefile4
-rwxr-xr-xscripts/buildversion.sh16
2 files changed, 12 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index a4d945c..83cdff3 100644
--- a/Makefile
+++ b/Makefile
@@ -154,7 +154,7 @@ $(OUT)romlayout.o: src/romlayout.S $(OUT)autoconf.h $(OUT)asm-offsets.h
$(OUT)romlayout16.lds: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)ccode16.o $(OUT)romlayout.o scripts/layoutrom.py scripts/buildversion.sh
@echo " Building ld scripts"
- $(Q)./scripts/buildversion.sh $(OUT)version.c
+ $(Q)BUILD_VERSION="$(VERSION)" ./scripts/buildversion.sh $(OUT)version.c
$(Q)$(CC) $(CFLAGS32FLAT) -c $(OUT)version.c -o $(OUT)version.o
$(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode32flat.o $(OUT)version.o -o $(OUT)code32flat.o
$(Q)$(LD) $(LD32BIT_FLAG) -r $(OUT)ccode16.o $(OUT)romlayout.o -o $(OUT)code16.o
@@ -226,7 +226,7 @@ $(OUT)vgaentry.o: vgasrc/vgaentry.S $(OUT)autoconf.h $(OUT)asm-offsets.h
$(OUT)vgarom.o: $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgasrc/vgalayout.lds scripts/buildversion.sh
@echo " Linking $@"
- $(Q)./scripts/buildversion.sh $(OUT)vgaversion.c VAR16
+ $(Q)BUILD_VERSION="$(VERSION)" ./scripts/buildversion.sh $(OUT)vgaversion.c VAR16
$(Q)$(CC) $(CFLAGS16) -c $(OUT)vgaversion.c -o $(OUT)vgaversion.o
$(Q)$(LD) --gc-sections -T $(OUT)vgasrc/vgalayout.lds $(OUT)vgaccode16.o $(OUT)vgaentry.o $(OUT)vgaversion.o -o $@
diff --git a/scripts/buildversion.sh b/scripts/buildversion.sh
index e5ce96c..516aff5 100755
--- a/scripts/buildversion.sh
+++ b/scripts/buildversion.sh
@@ -4,14 +4,18 @@ OUTFILE="$1"
VAR16MODE="$2"
# Extract version info
-if [ -d .git -o -f .git ]; then
- VERSION="`git describe --tags --long --dirty`"
-elif [ -f .version ]; then
- VERSION="`cat .version`"
+if [ -z "$BUILD_VERSION" ]; then
+ if [ -d .git -o -f .git ]; then
+ VERSION="`git describe --tags --long --dirty`"
+ elif [ -f .version ]; then
+ VERSION="`cat .version`"
+ else
+ VERSION="?"
+ fi
+ VERSION="${VERSION}-`date +"%Y%m%d_%H%M%S"`-`hostname`"
else
- VERSION="?"
+ VERSION="$BUILD_VERSION"
fi
-VERSION="${VERSION}-`date +"%Y%m%d_%H%M%S"`-`hostname`"
echo "Version: ${VERSION}"
# Build header file