public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* howto make define seen in all files?
@ 2013-08-18  3:56 lkml
  2013-08-19 20:26 ` Michal Marek
  0 siblings, 1 reply; 2+ messages in thread
From: lkml @ 2013-08-18  3:56 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: Text/Plain, Size: 373 bytes --]

Hi, I want to provide a general defined macro like __MY__TIME__ (for 
determinictic build) and that symbol should be seen as #define or -D... to gcc 
in all files;

Value of __MY_TIME__ is determined once, at start of build.

I was using file scripts/mkcompile_h as in the attached .diff patch, worked in 
3.2.48 but in 3.2.50 files do not see the value _MY_BUILD__TIME__


[-- Attachment #2: linux-3.2.48-deterministic-build.diff --]
[-- Type: text/x-patch, Size: 3616 bytes --]

diff -uprN a/arch/x86/math-emu/errors.c b/arch/x86/math-emu/errors.c
--- a/arch/x86/math-emu/errors.c	2013-06-29 05:06:45.000000000 +0200
+++ b/arch/x86/math-emu/errors.c	2013-07-25 15:46:14.922972587 +0200
@@ -332,7 +332,7 @@ asmlinkage void FPU_exception(int n)
 	if ((~control_word & n & CW_Exceptions) || (n == EX_INTERNAL)) {
 #ifdef PRINT_MESSAGES
 		/* My message from the sponsor */
-		printk(FPU_VERSION " " __DATE__ " (C) W. Metzenthen.\n");
+		printk(FPU_VERSION " " _MY_BUILD__DATE__ " (C) W. Metzenthen.\n");
 #endif /* PRINT_MESSAGES */
 
 		/* Get a name string for error reporting */
diff -uprN a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c	2013-06-29 05:06:45.000000000 +0200
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c	2013-07-25 15:46:06.990972484 +0200
@@ -43,7 +43,7 @@ int brcmf_msg_level;
 #ifdef BCMDBG
 static const char brcmf_version[] =
 	"Dongle Host Driver, version " BRCMF_VERSION_STR "\nCompiled on "
-	__DATE__ " at " __TIME__;
+	_MY_BUILD__TIME__ " at " _MY_BUILD__DATE__;
 #else
 static const char brcmf_version[] =
 	"Dongle Host Driver, version " BRCMF_VERSION_STR;
diff -uprN a/drivers/staging/rts5139/rts51x_scsi.c b/drivers/staging/rts5139/rts51x_scsi.c
--- a/drivers/staging/rts5139/rts51x_scsi.c	2013-06-29 05:06:45.000000000 +0200
+++ b/drivers/staging/rts5139/rts51x_scsi.c	2013-07-25 15:46:03.808972463 +0200
@@ -2067,7 +2067,7 @@ int proc_info(struct Scsi_Host *host, ch
 	SPRINTF("       Vendor: Realtek Corp.\n");
 	SPRINTF("      Product: RTS51xx USB Card Reader\n");
 	SPRINTF("      Version: %s\n", DRIVER_VERSION);
-	SPRINTF("        Build: %s\n", __TIME__);
+	SPRINTF("        Build: %s\n", _MY_BUILD__TIME__);
 
 	/*
 	 * Calculate start of next buffer, and return value.
diff -uprN a/drivers/staging/wlags49_h2/wl_version.h b/drivers/staging/wlags49_h2/wl_version.h
--- a/drivers/staging/wlags49_h2/wl_version.h	2013-06-29 05:06:45.000000000 +0200
+++ b/drivers/staging/wlags49_h2/wl_version.h	2013-07-25 15:46:19.639972804 +0200
@@ -130,7 +130,7 @@ err: define bus type;
 #endif  /* BUS_XXX */
 
 #ifdef DBG
-#define MODULE_DATE         __DATE__ " " __TIME__
+#define MODULE_DATE         _MY_BUILD__DATE__ " " _MY_BUILD__TIME__
 #else
 #define MODULE_DATE         "07/18/2004 13:30:00"
 #endif // DBG
diff -uprN a/fs/ubifs/super.c b/fs/ubifs/super.c
--- a/fs/ubifs/super.c	2013-06-29 05:06:45.000000000 +0200
+++ b/fs/ubifs/super.c	2013-07-25 15:46:11.783972639 +0200
@@ -1435,7 +1435,7 @@ static int mount_ubifs(struct ubifs_info
 	ubifs_msg("reserved for root:  %llu bytes (%llu KiB)",
 		c->report_rp_size, c->report_rp_size >> 10);
 
-	dbg_msg("compiled on:         " __DATE__ " at " __TIME__);
+	dbg_msg("compiled on:         " _MY_BUILD__DATE__ " at " _MY_BUILD__TIME__);
 	dbg_msg("min. I/O unit size:  %d bytes", c->min_io_size);
 	dbg_msg("max. write size:     %d bytes", c->max_write_size);
 	dbg_msg("LEB size:            %d bytes (%d KiB)",
diff -uprN a/scripts/mkcompile_h b/scripts/mkcompile_h
--- a/scripts/mkcompile_h	2013-06-29 05:06:45.000000000 +0200
+++ b/scripts/mkcompile_h	2013-07-25 15:45:47.194972240 +0200
@@ -42,6 +42,11 @@ if [ -z "$KBUILD_BUILD_TIMESTAMP" ]; the
 else
 	TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
 fi
+
+# create _MY_BUILD__TIME__ instead __TIME__ (and DATE) deterministic build
+_MY_BUILD__TIME__=`date  -d "$TIMESTAMP"  "+%H:%M:%S"`
+_MY_BUILD__DATE__=`date  -d "$TIMESTAMP"  "+%b %d %Y"`
+
 if test -z "$KBUILD_BUILD_USER"; then
 	LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
 else

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: howto make define seen in all files?
  2013-08-18  3:56 howto make define seen in all files? lkml
@ 2013-08-19 20:26 ` Michal Marek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Marek @ 2013-08-19 20:26 UTC (permalink / raw)
  To: lkml@tigusoft.pl; +Cc: linux-kernel

Dne 18.8.2013 05:56, lkml@tigusoft.pl napsal(a):
> Hi, I want to provide a general defined macro like __MY__TIME__ (for 
> determinictic build) and that symbol should be seen as #define or -D... to gcc 
> in all files;
> 
> Value of __MY_TIME__ is determined once, at start of build.
> 
> I was using file scripts/mkcompile_h as in the attached .diff patch, worked in 
> 3.2.48 but in 3.2.50 files do not see the value _MY_BUILD__TIME__

Just drop the remaining occurrences of __TIME__ and __DATA__, it's not
worth the hassle to define new macros.

Michal


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-19 20:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-18  3:56 howto make define seen in all files? lkml
2013-08-19 20:26 ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox