[Buildroot] [PATCH] Makefile: generate KBUILD_BUILD_TIMESTAMP date whith LANG=C

Jean-Baptiste Tredez jean-baptiste.tredez at basystemes.fr
Tue Dec 6 10:48:02 UTC 2016


Le 06/12/2016 à 11:33, Thomas Petazzoni a écrit :
> Hello,
>
> On Tue,  6 Dec 2016 11:10:01 +0100, Jean-Baptiste Trédez wrote:
>> Fix kernel reproducible build if LANG=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 :
>> - LANG=C date -d"$(LANG=C date)" : ok
>> - LANG=C date -d"$(LANG=fr_FR.UTF-8 date)" : error
>>
>> Signed-off-by: Jean-Baptiste Trédez <jean-baptiste.tredez at basystemes.fr>
> Indeed, seems like the LANG/LC_ALL variables exported in the main
> Makefile are not used in the $(shell ...) sub-shells.
>
> However, are you sure it works with LANG=C ? It seems like LC_ALL=C is
> needed instead:
>
> thomas at skate:/tmp$ LANG=C date
> mardi 6 décembre 2016, 11:31:52 (UTC+0100)
> thomas at skate:/tmp$ LC_ALL=C date
> Tue Dec  6 11:31:59 CET 2016
$ date
mardi 6 décembre 2016, 11:36:21 (UTC+0100)
$ LANG=C date
Tue Dec  6 11:36:49 CET 2016
$ LC_ALL=C date
Tue Dec  6 11:36:57 CET 2016

It works fine on my machine with LANG=C. I will change to LC_ALL=C.
>
> I also tested with the following test makefile:
>
> ====
>
> export LC_ALL=C
>
> foo = $(shell LC_ALL=C date)
>
> all:
> 	date
> 	echo "$(foo)"
>
> ====
>
> And indeed, the "export LC_ALL" is enough for the direct "date" call to
> work. But for the date call whose output is stored in the "foo"
> variable, passing again LC_ALL in the sub-shell is necessary.
>
> Thomas




More information about the buildroot mailing list