Commit 2244cbd8a9185c197ec5ba5de175aec288697223

Authored by Sam Ravnborg
1 parent 296e0855b0

kbuild: create .kernelrelease at *config step

To enable 'make kernelrelease' earlier now create .kernelrelease when
one of the *config targets are used.
Also introduce KERNELVERSION - only user is kconfig.
KERNELVERSION was needed to display kernel version in menuconfig -
KERNELRELEASE is not valid until configuration has completed.
kconfig files modified to use KERNELVERSION.
Bug reported by: Rene Rebe <rene@exactcode.de>

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

Showing 5 changed files with 15 additions and 14 deletions Side-by-side Diff

... ... @@ -338,8 +338,9 @@
338 338  
339 339 # Read KERNELRELEASE from .kernelrelease (if it exists)
340 340 KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null)
  341 +KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
341 342  
342   -export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE \
  343 +export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \
343 344 ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
344 345 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
345 346 HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
... ... @@ -434,6 +435,7 @@
434 435 config %config: scripts_basic outputmakefile FORCE
435 436 $(Q)mkdir -p include/linux
436 437 $(Q)$(MAKE) $(build)=scripts/kconfig $@
  438 + $(Q)$(MAKE) .kernelrelease
437 439  
438 440 else
439 441 # ===========================================================================
440 442  
... ... @@ -784,12 +786,10 @@
784 786 localver-full = $(localver)$(localver-auto)
785 787  
786 788 # Store (new) KERNELRELASE string in .kernelrelease
787   -kernelrelease = \
788   - $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(localver-full)
  789 +kernelrelease = $(KERNELVERSION)$(localver-full)
789 790 .kernelrelease: FORCE
790   - $(Q)rm -f .kernelrelease
791   - $(Q)echo $(kernelrelease) > .kernelrelease
792   - $(Q)echo " Building kernel $(kernelrelease)"
  791 + $(Q)rm -f $@
  792 + $(Q)echo $(kernelrelease) > $@
793 793  
794 794  
795 795 # Things we need to do before we recursively start building the kernel
... ... @@ -899,7 +899,7 @@
899 899 )
900 900 endef
901 901  
902   -include/linux/version.h: $(srctree)/Makefile FORCE
  902 +include/linux/version.h: $(srctree)/Makefile .config FORCE
903 903 $(call filechk,version.h)
904 904  
905 905 # ---------------------------------------------------------------------------
906 906  
... ... @@ -1302,9 +1302,10 @@
1302 1302 $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
1303 1303  
1304 1304 kernelrelease:
1305   - @echo $(KERNELRELEASE)
  1305 + $(if $(wildcard .kernelrelease), $(Q)echo $(KERNELRELEASE), \
  1306 + $(error kernelrelease not valid - run 'make *config' to update it))
1306 1307 kernelversion:
1307   - @echo $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
  1308 + @echo $(KERNELVERSION)
1308 1309  
1309 1310 # FIXME Should go into a make.lib or something
1310 1311 # ===========================================================================
scripts/kconfig/confdata.c
... ... @@ -375,7 +375,7 @@
375 375 if (!out_h)
376 376 return 1;
377 377 }
378   - sym = sym_lookup("KERNELRELEASE", 0);
  378 + sym = sym_lookup("KERNELVERSION", 0);
379 379 sym_calc_value(sym);
380 380 time(&now);
381 381 env = getenv("KCONFIG_NOTIMESTAMP");
scripts/kconfig/gconf.c
... ... @@ -276,7 +276,7 @@
276 276 NULL);
277 277  
278 278 sprintf(title, _("Linux Kernel v%s Configuration"),
279   - getenv("KERNELRELEASE"));
  279 + getenv("KERNELVERSION"));
280 280 gtk_window_set_title(GTK_WINDOW(main_wnd), title);
281 281  
282 282 gtk_widget_show(main_wnd);
scripts/kconfig/mconf.c
... ... @@ -1051,7 +1051,7 @@
1051 1051 conf_parse(av[1]);
1052 1052 conf_read(NULL);
1053 1053  
1054   - sym = sym_lookup("KERNELRELEASE", 0);
  1054 + sym = sym_lookup("KERNELVERSION", 0);
1055 1055 sym_calc_value(sym);
1056 1056 sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"),
1057 1057 sym_get_string_value(sym));
scripts/kconfig/symbol.c
... ... @@ -61,10 +61,10 @@
61 61 if (p)
62 62 sym_add_default(sym, p);
63 63  
64   - sym = sym_lookup("KERNELRELEASE", 0);
  64 + sym = sym_lookup("KERNELVERSION", 0);
65 65 sym->type = S_STRING;
66 66 sym->flags |= SYMBOL_AUTO;
67   - p = getenv("KERNELRELEASE");
  67 + p = getenv("KERNELVERSION");
68 68 if (p)
69 69 sym_add_default(sym, p);
70 70