[PATCH v6] Makefile: Add build time and compiler info string

Jessica Clarke jrtc27 at jrtc27.com
Wed Oct 20 04:20:20 PDT 2021


On 20 Oct 2021, at 12:13, Peter Korsgaard <peter at korsgaard.com> wrote:
> 
>>>>>> "Anup" == Anup Patel <anup.patel at wdc.com> writes:
> 
>> From: Wei Fu <wefu at redhat.com>
>> When we are doing opensbi development, we want to know the build time
>> and compiler info for debug purpose.
> 
>> To enable this message, please add "BUILD_INFO=y", like:
> 
>> ```
>> make BUILD_INFO=y
>> ```
> 
>> NOTE: Using `BUILD_INFO=y` without specifying SOURCE_DATE_EPOCH will
>> violate "reproducible builds". So it's ONLY for development and debug
>> purpose, and should NOT be used in a product which follows "reproducible
>> builds".
> 
>> Signed-off-by: Wei Fu <wefu at redhat.com>
>> Reviewed-by: Anup Patel <anup.patel at wdc.com>
>> Reviewed-by: Alistair Francis <alistair.francis at wdc.com>
>> ---
>> Changes since v5:
>> - BUILD_DATE_EPOCH is non-standard name so rename it back to
>>   SOURCE_DATE_EPOCH
>> - Updated README.md and commit description to clearly state when
>>   BUILD_INFO=y violates reprodcible builds
> 
> ..
> 
>> +# Build Info:
>> +# OPENSBI_BUILD_TIME_STAMP -- the compilation time stamp
>> +# OPENSBI_BUILD_COMPILER_VERSION -- the compiler version info
>> +BUILD_INFO ?= n
>> +ifeq ($(BUILD_INFO),y)
>> +OPENSBI_BUILD_DATE_FMT = +%Y-%m-%d %H:%M:%S %z
>> +ifdef SOURCE_DATE_EPOCH
>> +	OPENSBI_BUILD_TIME_STAMP ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" \
>> +		"$(OPENSBI_BUILD_DATE_FMT)" 2>/dev/null || \
>> +		date -u -r "$(SOURCE_DATE_EPOCH)" \
>> +		"$(OPENSBI_BUILD_DATE_FMT)" 2>/dev/null || \
>> +		date -u "$(OPENSBI_BUILD_DATE_FMT)")
> 
> What is this date -r fallback about? According to the spec,
> SOURCE_DATE_EPOCH is always a unix timestamp, never a filename:

GNU date and BSD date have a different but similar interface.

This is the sequence recommended by the Reproducible Builds project[1].

Jess

[1] https://reproducible-builds.org/docs/source-date-epoch/#makefile




More information about the opensbi mailing list