I had just run make oldconfig followed by make xconfig on linux-2.6.35. During make, I got the following compilation error: CC kernel/irq/autoprobe.o kernel/power/snapshot.c: In function ‘init_header_complete’: kernel/power/snapshot.c:1547: error: expected expression before ‘;’ token kernel/power/snapshot.c: In function ‘check_image_kernel’: kernel/power/snapshot.c:1553: error: expected expression before ‘)’ token make[2]: *** [kernel/power/snapshot.o] Error 1 make[1]: *** [kernel/power] Error 2 make[1]: *** Waiting for unfinished jobs.... So, I looked at lines 1547 and 1553 and the problem was that LINUX_VERSION_CODE was left undefined in include/linux/version.h My .config file is attached.
Created attachment 27338 [details] Kernel configuration file My kernel configuration file (.config)
LINUX_VERSION_CODE is defined in a generated file. Yes, that file is include/linux/version.h. What does that file contain in your build tree? I used your .config file and built the kernel in directory tt32, so LINUX_VERSION_CODE is contained in tt32/include/linux/version.h: > cat version.h #define LINUX_VERSION_CODE 132643 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
On my machine (after running make old config and then make xconfig): $ cat ./include/linux/version.h #define LINUX_VERSION_CODE #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) It does not seem to add the the value 132643 to the definition of LINUX_VERSION_CODE So that is why the compilation failed. I tried the mainline: 2.6.35 and stable: 2.6.35 Same result. Which script or executable is supposed to populate this header file with the definition for LINUX_VERSION_CODE ?
It's generated in the top-level Makefile, at line 945 in 2.6.35: define filechk_version.h (echo \#define LINUX_VERSION_CODE $(shell \ expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \ echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) endef include/linux/version.h: $(srctree)/Makefile FORCE $(call filechk,version.h) Just guessing: what shell are you using? Maybe running make with V=1 (verbose) would give us more info also.
I use ksh - and I have been using ksh for many years. I have NEVER had this problem before. I have been building vanilla linux kernels from source tarballs for at 10 years. So I am not sure why that part of the Makefile is not doing it's job in my case. Is there a way to force make to echo every line of the Makefile and every line of shell command and args it invokes? I want to see exactly what is being stuffed into version.h.
Please try building (run 'make') with "V=1" on the command line. You probably need to run "make clean" first. Save the output and post it here and/or on the linux-kbuild@vger.kernel.org mailing list so that other people can look/help.
Unrelated of the exact cause, we should probably just do echo "#define LINUX_VERSION_CODE KERNEL_VERSION($(VERSION), $(PATCHLEVEL), $(SUBLEVEL))" and let the compiler compute the bit shifts.
You are probably right - but I just hate such mysterious behavior of scripts and Makefiles - that for 4 or 5 times, produced the same error, and then on a subsequent try of untarring and ... etc, the build proceeds without errors. That said, I see other problems unrelated to scripts, but more to compiler and linker warning about various things. I should probably open another bug about that. Cheers, JD
After a long time, I can reproduce the problem - and it is caused my my own error. I had edited Makefile and set SUBLEVEL = 35-1 and that is the cause of the error during make. Please close as user error.
oh yeh, this was my mistake as well, I wanted to change the kernel version and added something for sublevel instread of extraversion, thanks for pointing this out!