libc/uname: Add option to disable uname timestamp

Don't include the build timestamp into final binary when the symbol
CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP is defined.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
Alan Carvalho de Assis 2024-03-22 13:02:59 -03:00 committed by Xiang Xiao
parent eaeca78cc8
commit 97e217b0ff
3 changed files with 13 additions and 1 deletions

View File

@ -81,6 +81,15 @@ config LIBC_FTOK_VFS_PATH
---help---
The relative path to where ftok will exist in the root namespace.
config LIBC_UNAME_DISABLE_TIMESTAMP
bool "Disable uname timestamp support"
default n
---help---
Currently uname command will print the timestamp
when the binary was built, and it generates an issue
because two identical built binaries will have differents
hashes/CRC.
choice
prompt "Select memfd implementation"

View File

@ -79,7 +79,9 @@ endif
# To ensure uname information is newest,
# add lib_utsname.o to phony target for force rebuild
#if !defined(CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP)
.PHONY: lib_utsname$(OBJEXT)
#endif
# Add the misc directory to the build

View File

@ -93,7 +93,8 @@ int uname(FAR struct utsname *name)
strlcpy(name->release, CONFIG_VERSION_STRING, sizeof(name->release));
#if defined(__DATE__) && defined(__TIME__)
#if defined(__DATE__) && defined(__TIME__) && \
!defined(CONFIG_LIBC_UNAME_DISABLE_TIMESTAMP)
snprintf(name->version, VERSION_NAMELEN, "%s %s %s",
CONFIG_VERSION_BUILD, __DATE__, __TIME__);
#else