Kbuild: add KERNELRELEASE to MARS' buildtag

This commit is contained in:
Thomas Schoebel-Theuer 2022-08-10 11:05:51 +02:00
parent 196e486dd5
commit fdb0b598b0
1 changed files with 6 additions and 0 deletions

View File

@ -83,6 +83,9 @@ endif
# 3) if a file 'DISTVERSION' exists (out-of-tree tarball), use its content.
# 4) otherwise "no-buildtag-available"
#
# In addition, the suffix -for-$KERNELRELEASE will be useful
# for sysadmins having to manage a plethora of kernel versions.
#
extra-y += buildtag.h
$(obj)/buildtag.h: $(patsubst $(obj)/buildtag.h,,$(wildcard $(obj)/*.[ch])) $(obj)/*/*.[ch]
$(Q)$(kecho) "MARS: Generating $@"
@ -99,6 +102,9 @@ $(obj)/buildtag.h: $(patsubst $(obj)/buildtag.h,,$(wildcard $(obj)/*.[ch])) $(ob
else \
BUILDTAG="no-buildtag-available"; \
fi; \
if [ "$$KERNELRELEASE" != "" ]; then \
BUILDTAG="$$BUILDTAG-for-$$KERNELRELEASE"; \
fi; \
/bin/echo -e "#define BUILDTAG \"$$BUILDTAG\"";\
/bin/echo -e "#define BUILDHOST \"$$USER@`hostname`\"";\
/bin/echo -e "#define BUILDDATE \"$$(date '+%F %T')\""