aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen_build_files.sh2
-rw-r--r--scripts/kconfig/confdata.c17
2 files changed, 16 insertions, 3 deletions
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh
index 92de681ac..8b5b15a1b 100755
--- a/scripts/gen_build_files.sh
+++ b/scripts/gen_build_files.sh
@@ -4,6 +4,8 @@
4# but users complain that many sed implementations 4# but users complain that many sed implementations
5# are misinterpreting --. 5# are misinterpreting --.
6 6
7export LC_ALL=C
8
7test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; } 9test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
8 10
9# cd to objtree 11# cd to objtree
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index d6c1621b8..2f7fa6618 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -342,6 +342,8 @@ int conf_write(const char *name)
342 time_t now; 342 time_t now;
343 int use_timestamp = 1; 343 int use_timestamp = 1;
344 char *env; 344 char *env;
345 char *source_date_epoch;
346 struct tm *build_time;
345 347
346 dirname[0] = 0; 348 dirname[0] = 0;
347 if (name && name[0]) { 349 if (name && name[0]) {
@@ -378,7 +380,16 @@ int conf_write(const char *name)
378 } 380 }
379 sym = sym_lookup("KERNELVERSION", 0); 381 sym = sym_lookup("KERNELVERSION", 0);
380 sym_calc_value(sym); 382 sym_calc_value(sym);
381 time(&now); 383
384 source_date_epoch = getenv("SOURCE_DATE_EPOCH");
385 if (source_date_epoch && *source_date_epoch) {
386 now = strtoull(source_date_epoch, NULL, 10);
387 build_time = gmtime(&now);
388 } else {
389 time(&now);
390 build_time = localtime(&now);
391 }
392
382 env = getenv("KCONFIG_NOTIMESTAMP"); 393 env = getenv("KCONFIG_NOTIMESTAMP");
383 if (env && *env) 394 if (env && *env)
384 use_timestamp = 0; 395 use_timestamp = 0;
@@ -398,14 +409,14 @@ int conf_write(const char *name)
398 if (use_timestamp) { 409 if (use_timestamp) {
399 size_t ret = \ 410 size_t ret = \
400 strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP " 411 strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP "
401 "\"%Y-%m-%d %H:%M:%S %Z\"\n", localtime(&now)); 412 "\"%Y-%m-%d %H:%M:%S %Z\"\n", build_time);
402 /* if user has Factory timezone or some other odd install, the 413 /* if user has Factory timezone or some other odd install, the
403 * %Z above will overflow the string leaving us with undefined 414 * %Z above will overflow the string leaving us with undefined
404 * results ... so let's try again without the timezone. 415 * results ... so let's try again without the timezone.
405 */ 416 */
406 if (ret == 0) 417 if (ret == 0)
407 strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP " 418 strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP "
408 "\"%Y-%m-%d %H:%M:%S\"\n", localtime(&now)); 419 "\"%Y-%m-%d %H:%M:%S\"\n", build_time);
409 } else { /* bbox */ 420 } else { /* bbox */
410 strcpy(buf, "#define AUTOCONF_TIMESTAMP \"\"\n"); 421 strcpy(buf, "#define AUTOCONF_TIMESTAMP \"\"\n");
411 } 422 }