Emit build information file into KFS /etc/build.info
authorDavide Libenzi <dlibenzi@google.com>
Sun, 13 Dec 2015 21:58:20 +0000 (13:58 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 16 Dec 2015 21:27:59 +0000 (16:27 -0500)
Emit build information file into KFS /etc/build.info

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
Makefile

index 3dcc2c0..5c18040 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -610,11 +610,21 @@ utestclean:
        @$(MAKE) -C user/utest clean
 
 # KFS related stuff
-PHONY += fill-kfs unfill-kfs
+PHONY += fill-kfs unfill-kfs create-build-file
 xcc-gcc-libs = $(XCC_TARGET_ROOT)/../lib/
 xcc-so-files = $(addprefix $(XCC_TARGET_LIB), *.so*) \
                $(addprefix $(xcc-gcc-libs), *.so*)
 
+KERNEL_ELF_PATH=$(abspath $(KERNEL_OBJ))-64b
+create-build-file:
+ifneq ($(INVARIANT_BUILD),1)
+               @echo "KernelPath: $(KERNEL_ELF_PATH)" > kern/kfs/etc/build.info
+               @echo "KernelSize: $(shell stat -c %s $(KERNEL_ELF_PATH))" >> \
+                       kern/kfs/etc/build.info
+               @echo "Date: `date`" >> kern/kfs/etc/build.info
+               @echo "Host: `hostname`" >> kern/kfs/etc/build.info
+endif
+
 $(OBJDIR)/.dont-force-fill-kfs:
        $(Q)rm -rf $(addprefix $(FIRST_KFS_PATH)/lib/, $(notdir $(xcc-so-files)))
        @echo "Cross Compiler 'so' files removed from KFS"
@@ -624,7 +634,7 @@ $(OBJDIR)/.dont-force-fill-kfs:
        @echo "User space tests removed from KFS"
        @touch $(OBJDIR)/.dont-force-fill-kfs
 
-fill-kfs: $(OBJDIR)/.dont-force-fill-kfs install-libs tests
+fill-kfs: $(OBJDIR)/.dont-force-fill-kfs install-libs tests create-build-file
        @mkdir -p $(FIRST_KFS_PATH)/lib
        $(Q)cp -uP $(xcc-so-files) $(FIRST_KFS_PATH)/lib
        @echo "Cross Compiler 'so' files installed to KFS"