Skip to contentSkip to conversation

Makefile: generate KBUILD_BUILD_TIMESTAMP date whith LC_ALL=C

PATCH New Jean-Baptiste Trédez 2 participants 2 messages Dec 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Makefile: generate KBUILD_BUILD_TIMESTAMP date whith LC_ALL=C

Fix kernel reproducible build if LANG=fr_FR.UTF-8 or LC_ALL=fr_FR.UTF-8 in host system.

when building linux kernel, scripts/gen_initramfs_list.sh do 'date -d"$KBUILD_BUILD_TIMESTAMP" +%s' In buildroot makefile, KBUILD_BUILD_TIMESTAMP="$(shell date -d @$(SOURCE_DATE_EPOCH))" if LANG=fr_FR.UTF-8 in host system, it does not work :
- LC_ALL=C date -d"$(LC_ALL=C date)" : ok
- LC_ALL=C date -d"$(LC_ALL=fr_FR.UTF-8 date)" : error

LANG/LC_ALL variables exported in the main Makefiles are not used in the $(shell ...) sub-shells.

---
Changes in v2:
- use LC_ALL=C instead of LANG=C

 linux/linux.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux/linux.mk +1 -1
index a63d1f3..2b776a9 100644
@@ -99,7 +99,7 @@ LINUX_MAKE_ENV += \
 	KBUILD_BUILD_VERSION=1 \
 	KBUILD_BUILD_USER=buildroot \
 	KBUILD_BUILD_HOST=buildroot \
-	KBUILD_BUILD_TIMESTAMP="$(shell date -d @$(SOURCE_DATE_EPOCH))"
+	KBUILD_BUILD_TIMESTAMP="$(shell LC_ALL=C date -d @$(SOURCE_DATE_EPOCH))"
 endif
 
 # Get the real Linux version, which tells us where kernel modules are
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/1 Makefile: generate KBUILD_BUILD_TIMESTAMP date whith LC_ALL=C

Hello,

Quoted 8 lines · Jean-Baptiste Tr?dez

Fix kernel reproducible build if LANG=fr_FR.UTF-8 or LC_ALL=fr_FR.UTF-8 in host system.

when building linux kernel, scripts/gen_initramfs_list.sh do 'date -d"$KBUILD_BUILD_TIMESTAMP" +%s' In buildroot makefile, KBUILD_BUILD_TIMESTAMP="$(shell date -d @$(SOURCE_DATE_EPOCH))" if LANG=fr_FR.UTF-8 in host system, it does not work :
- LC_ALL=C date -d"$(LC_ALL=C date)" : ok
- LC_ALL=C date -d"$(LC_ALL=fr_FR.UTF-8 date)" : error

Quoted 6 lines

LANG/LC_ALL variables exported in the main Makefiles are not used in the $(shell ...) sub-shells.

---
Changes in v2:
- use LC_ALL=C instead of LANG=C

Applied to master, after tweaking the commit title and commit log a bit.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com