mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-24 07:06:42 +00:00
move git hash into /etc/config instead of Linux kernel version and track clean/dirty status (#398)
This commit is contained in:
parent
958c26e0f5
commit
492b94afb5
27
Makefile
27
Makefile
@ -49,6 +49,12 @@ CONFIG_HEADS ?= y
|
|||||||
# Some things want usernames, we use the current checkout
|
# Some things want usernames, we use the current checkout
|
||||||
# so that they are reproducible
|
# so that they are reproducible
|
||||||
GIT_HASH := $(shell git rev-parse HEAD)
|
GIT_HASH := $(shell git rev-parse HEAD)
|
||||||
|
GIT_STATUS := $(shell \
|
||||||
|
if git diff --exit-code >/dev/null ; then \
|
||||||
|
echo clean ; \
|
||||||
|
else \
|
||||||
|
echo dirty ; \
|
||||||
|
fi)
|
||||||
|
|
||||||
# Timestamps should be in ISO format
|
# Timestamps should be in ISO format
|
||||||
DATE=`date --rfc-3339=seconds`
|
DATE=`date --rfc-3339=seconds`
|
||||||
@ -177,8 +183,8 @@ define do-cpio =
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define do-copy =
|
define do-copy =
|
||||||
$(call do,INSTALL ,$1 => $2',\
|
$(call do,INSTALL ,$1 => $2,\
|
||||||
if ! cmp --quiet "$1" "$2" ; then \
|
if cmp --quiet "$1" "$2" ; then \
|
||||||
echo "$(DATE) UNCHANGED $(1:$(pwd)/%=%)" ; \
|
echo "$(DATE) UNCHANGED $(1:$(pwd)/%=%)" ; \
|
||||||
fi ; \
|
fi ; \
|
||||||
cp -a "$1" "$2" ; \
|
cp -a "$1" "$2" ; \
|
||||||
@ -476,17 +482,26 @@ $(build)/$(initrd_dir)/heads.cpio: FORCE
|
|||||||
$(build)/$(initrd_dir)/tools.cpio: \
|
$(build)/$(initrd_dir)/tools.cpio: \
|
||||||
$(initrd_bins) \
|
$(initrd_bins) \
|
||||||
$(initrd_libs) \
|
$(initrd_libs) \
|
||||||
|
$(initrd_tmp_dir)/etc/config \
|
||||||
|
|
||||||
|
$(call do-cpio,$@,$(initrd_tmp_dir))
|
||||||
|
@$(RM) -rf "$(initrd_tmp_dir)"
|
||||||
|
|
||||||
|
$(initrd_tmp_dir)/etc/config: FORCE
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
$(call do,INSTALL,$(CONFIG), \
|
$(call do,INSTALL,$(CONFIG), \
|
||||||
mkdir -p "$(initrd_tmp_dir)/etc" ; \
|
|
||||||
export \
|
export \
|
||||||
| grep ' CONFIG_' \
|
| grep ' CONFIG_' \
|
||||||
| sed -e 's/^declare -x /export /' \
|
| sed -e 's/^declare -x /export /' \
|
||||||
-e 's/\\\"//g' \
|
-e 's/\\\"//g' \
|
||||||
> "$(initrd_tmp_dir)/etc/config" \
|
> $@ \
|
||||||
|
)
|
||||||
|
$(call do,HASH,$(GIT_HASH) $(GIT_STATUS), \
|
||||||
|
echo export GIT_HASH=\'$(GIT_HASH)\' \
|
||||||
|
>> $@ ; \
|
||||||
|
echo export GIT_STATUS=$(GIT_STATUS) \
|
||||||
|
>> $@ ; \
|
||||||
)
|
)
|
||||||
$(call do-cpio,$@,$(initrd_tmp_dir))
|
|
||||||
@$(RM) -rf "$(initrd_tmp_dir)"
|
|
||||||
|
|
||||||
# Ensure that the initrd depends on all of the modules that produce
|
# Ensure that the initrd depends on all of the modules that produce
|
||||||
# binaries for it
|
# binaries for it
|
||||||
|
@ -92,7 +92,7 @@ linux_target := \
|
|||||||
AFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
AFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
||||||
CFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
CFLAGS_KERNEL="$(EXTRA_FLAGS)" \
|
||||||
CFLAGS_MODULE="$(EXTRA_FLAGS)" \
|
CFLAGS_MODULE="$(EXTRA_FLAGS)" \
|
||||||
KBUILD_BUILD_USER="$(GIT_HASH)" \
|
KBUILD_BUILD_USER=$(notdir $(linux_kconfig)) \
|
||||||
KBUILD_BUILD_HOST=linuxboot \
|
KBUILD_BUILD_HOST=linuxboot \
|
||||||
KBUILD_BUILD_TIMESTAMP="1970-00-00" \
|
KBUILD_BUILD_TIMESTAMP="1970-00-00" \
|
||||||
KBUILD_BUILD_VERSION=0 \
|
KBUILD_BUILD_VERSION=0 \
|
||||||
|
Loading…
Reference in New Issue
Block a user