diff mbox

[5/7] Conditionals for CONFIG_RANDOM_INIT and CONFIG_RANDOM_GCM

Message ID 1446906642-19372-5-git-send-email-sandyinchina@gmail.com (mailing list archive)
State Not Applicable
Delegated to: Herbert Xu
Headers show

Commit Message

Sandy Harris Nov. 7, 2015, 2:30 p.m. UTC
Signed-off-by: Sandy Harris <sandyinchina@gmail.com>
---
 drivers/char/Makefile | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

Comments

kernel test robot Nov. 7, 2015, 5:11 p.m. UTC | #1
Hi Sandy,

[auto build test ERROR on: char-misc/char-misc-testing]
[also build test ERROR on: v4.3 next-20151106]

url:    https://github.com/0day-ci/linux/commits/Sandy-Harris/A-couple-of-generated-files/20151107-223540
config: arm64-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

Note: the linux-review/Sandy-Harris/A-couple-of-generated-files/20151107-223540 HEAD 4d000f20486e81f999bc1f5499f0cfb36b37db02 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

>> drivers/char/random_gcm.c:286:35: fatal error: generated/random_init.h: No such file or directory
    #include <generated/random_init.h>
                                      ^
   compilation terminated.

vim +286 drivers/char/random_gcm.c

da17cbfa Sandy Harris 2015-11-07  270  #define CREATE_TRACE_POINTS
da17cbfa Sandy Harris 2015-11-07  271  #include <trace/events/random.h>
da17cbfa Sandy Harris 2015-11-07  272  
da17cbfa Sandy Harris 2015-11-07  273  /* #define ADD_INTERRUPT_BENCH */
da17cbfa Sandy Harris 2015-11-07  274  
da17cbfa Sandy Harris 2015-11-07  275  #ifndef CONFIG_RANDOM_INIT
da17cbfa Sandy Harris 2015-11-07  276  #error This version needs CONFIG_RANDOM_INIT
da17cbfa Sandy Harris 2015-11-07  277  #endif
da17cbfa Sandy Harris 2015-11-07  278  #ifndef CONFIG_RANDOM_GCM
da17cbfa Sandy Harris 2015-11-07  279  #error This version should not be compiled if CONFIG_RANDOM_GCM is not set
da17cbfa Sandy Harris 2015-11-07  280  #endif
da17cbfa Sandy Harris 2015-11-07  281  
da17cbfa Sandy Harris 2015-11-07  282  /*
da17cbfa Sandy Harris 2015-11-07  283   * Configuration information
da17cbfa Sandy Harris 2015-11-07  284   */
da17cbfa Sandy Harris 2015-11-07  285  
da17cbfa Sandy Harris 2015-11-07 @286  #include <generated/random_init.h>
da17cbfa Sandy Harris 2015-11-07  287  
da17cbfa Sandy Harris 2015-11-07  288  #define EXTRACT_SIZE		16	/* 128-bit GCM hash */
da17cbfa Sandy Harris 2015-11-07  289  #define SEC_XFER_SIZE		512
da17cbfa Sandy Harris 2015-11-07  290  #define DEBUG_RANDOM_BOOT 0
da17cbfa Sandy Harris 2015-11-07  291  
da17cbfa Sandy Harris 2015-11-07  292  #define LONGS(x) (((x) + sizeof(unsigned long) - 1)/sizeof(unsigned long))
da17cbfa Sandy Harris 2015-11-07  293  
da17cbfa Sandy Harris 2015-11-07  294  /*

:::::: The code at line 286 was first introduced by commit
:::::: da17cbfaa5c53120c6c5797cf2dc6bd4123b6869 Different version of driver using hash from AES-GCM Compiled if CONFIG_RANDOM_GCM=y

:::::: TO: Sandy Harris <sandyinchina@gmail.com>
:::::: CC: 0day robot <fengguang.wu@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index d8a7579..7d095e5 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -2,7 +2,30 @@ 
 # Makefile for the kernel character device drivers.
 #
 
-obj-y				+= mem.o random.o
+obj-y				+= mem.o
+
+ifeq ($(CONFIG_RANDOM_GCM),y)
+  random_c		= random_gcm.c
+  random_o		= random_gcm.o
+  random_no		= random.o
+else
+  random_c		= random.c
+  random_o		= random.o
+  random_no		= random_gcm.o
+endif
+obj-y				+= $(random_o)
+
+# remove the generated file after use so that
+# a fresh one is built (by scripts/gen_random)
+# for every compile
+# remove random_no so it will not get linked
+ifeq ($(CONFIG_RANDOM_INIT),y)
+init-file = include/generated/random_init.h
+$(random_o): $(random_c) $(init-file)
+	$(CC) $< -o $@
+	$(Q) rm --force $(init-file) $(random_no)
+endif
+
 obj-$(CONFIG_TTY_PRINTK)	+= ttyprintk.o
 obj-y				+= misc.o
 obj-$(CONFIG_ATARI_DSP56K)	+= dsp56k.o