Re: kbuild / KERNELRELEASE not rebuild correctly anymore

From: Sam Ravnborg
Date: Sun Jan 15 2006 - 06:22:06 EST


On Sun, Jan 15, 2006 at 11:41:30AM +0100, Ren? Rebe wrote:
> >
> > So the real fix is to error out when .kernelrelease does not exists.
> > See attached patch.
>
> You expect us to run make prepare before make menuconfig or simillar?
> That sounds a bit odd ...

The kernelrelease depends on the actual configuration.
So without having completed the make *config step kbuild cannot tell the
correct kernelrelease.

Now with the patch attached to last mail kbuild will now error out in
case there is no valid kernelrelease. Thats obviously only a hack, since
we need to error out when .config has been updated and the new
kernelrelease has not been created.

Maybe the better approach would be always to create the .kernelrelease
file as part of the configuration - based on the principle of least
suprise.
See attached patch.

Sam

diff --git a/Makefile b/Makefile
index deedaf7..4ab0141 100644
--- a/Makefile
+++ b/Makefile
@@ -433,6 +433,7 @@ export KBUILD_DEFCONFIG
config %config: scripts_basic outputmakefile FORCE
$(Q)mkdir -p include/linux
$(Q)$(MAKE) $(build)=scripts/kconfig $@
+ $(Q)$(MAKE) .kernelrelease

else
# ===========================================================================
@@ -783,12 +784,13 @@ endif
localver-full = $(localver)$(localver-auto)

# Store (new) KERNELRELASE string in .kernelrelease
+quiet_cmd_kernelrelease = GEN $@
+ cmd_kernelrelease = rm -f $@; echo $(kernelrelease) > $@
+
kernelrelease = \
$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(localver-full)
.kernelrelease: FORCE
- $(Q)rm -f .kernelrelease
- $(Q)echo $(kernelrelease) > .kernelrelease
- $(Q)echo " Building kernel $(kernelrelease)"
+ $(call cmd,kernelrelease)


# Things we need to do before we recursively start building the kernel
@@ -808,6 +810,7 @@ kernelrelease = \
# 1) Check that make has not been executed in the kernel src $(srctree)
# 2) Create the include2 directory, used for the second asm symlink
prepare3: .kernelrelease
+ $(Q)echo " Building kernel $(kernelrelease)"
ifneq ($(KBUILD_SRC),)
@echo ' Using $(srctree) as source for kernel'
$(Q)if [ -f $(srctree)/.config ]; then \
@@ -1301,7 +1304,8 @@ checkstack:
$(PERL) $(src)/scripts/checkstack.pl $(ARCH)

kernelrelease:
- @echo $(KERNELRELEASE)
+ $(if $(wildcard .kernelrelease), $(Q)echo $(KERNELRELEASE), \
+ $(error kernelrelease not valid - run 'make *config' to update it))
kernelversion:
@echo $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/