Skip to contentSkip to conversation

make kernelrelease ignoring LOCALVERSION_AUTO

DISCUSSION James Cloos 3 participants 7 messages Nov 20, 2005 – Nov 21, 2005 Kbuild

lore
Share & tools
lore
#0 lore raw

I use $(make kernelrelease) in my kernel install script to get the version string for the filenames in /boot and the grub menu items.

The partial hash string CONFIG_LOCALVERSION_AUTO=y adds is no longer showing up in the version kernelrelease echos, although it does show up in the version string used by $(make modules_install).

I even added an @echo $MODLIB to the kernelrelease rule and got only:

,----

| :; make kernelrelease
| 2.6.15-rc2-lug2
| /lib/modules/2.6.15-rc2-lug2

`----

whereas modules_install shows this:

,----

| :; make -n modules_install
| if [ -z "`/sbin/depmod -V 2>/dev/null | grep module-init-tools`" ]; then \
|         echo "Warning: you may need to install module-init-tools"; \
|         echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
|         sleep 1; \
| fi
| rm -rf /lib/modules/2.6.15-rc2-lug2-g3bedff1d/kernel
| rm -f /lib/modules/2.6.15-rc2-lug2-g3bedff1d/source
| mkdir -p /lib/modules/2.6.15-rc2-lug2-g3bedff1d/kernel
| ln -s /usr/src/linux-2.6-git /lib/modules/2.6.15-rc2-lug2-g3bedff1d/source
| if [ ! /usr/src/linux-2.6-git -ef  /lib/modules/2.6.15-rc2-lug2-g3bedff1d/build ]; then \
|         rm -f /lib/modules/2.6.15-rc2-lug2-g3bedff1d/build ; \
|         ln -s /usr/src/linux-2.6-git /lib/modules/2.6.15-rc2-lug2-g3bedff1d/build ; \
| fi
| : etc, usw, and so on

`----

So I added the lines:

	@echo kernelreleae is $(KERNELRELEASE)
	@echo modlib is $(MODLIB)

to _modinst_: and got this:

,----

| :; make -n modules_install 2>&1 |head
| echo kernelreleae is 2.6.15-rc2-lug2-g3bedff1d
| echo modlib is /lib/modules/2.6.15-rc2-lug2-g3bedff1d
| if [ -z "`/sbin/depmod -V 2>/dev/null | grep module-init-tools`" ]; then \
|         echo "Warning: you may need to install module-init-tools"; \
|         echo "See http://www.codemonkey.org.uk/docs/post-halloween-2.6.txt";\
|         sleep 1; \
| fi
| rm -rf /lib/modules/2.6.15-rc2-lug2-g3bedff1d/kernel
| rm -f /lib/modules/2.6.15-rc2-lug2-g3bedff1d/source
| mkdir -p /lib/modules/2.6.15-rc2-lug2-g3bedff1d/kernel

`----

So $KERNELRELEASE is /different/ depending on which target is being made.

My laptop is quite slow doing anything disk-intensive, such as git, so it'll take some time before I can bisect down to a single commit -- especially if a full compile will be required to confirm whether it works correctly -- but I do know that it is between g9f75e1ef... and gee90f62b... if anyone with faster hardware cares to try.

-JimC

Signature · 1 line
James H. Cloos, Jr. <[email protected]>
#1 lore raw
Quoted 7 lines · James Cloos

I use $(make kernelrelease) in my kernel install script to get the version string for the filenames in /boot and the grub menu items.

The partial hash string CONFIG_LOCALVERSION_AUTO=y adds is no longer showing up in the version kernelrelease echos, although it does show up in the version string used by $(make modules_install).

Quoted 7 lines

I even added an @echo $MODLIB to the kernelrelease rule and got only:

,----

| :; make kernelrelease
| 2.6.15-rc2-lug2
| /lib/modules/2.6.15-rc2-lug2

`----

<snip>
i dont know anything about this, but if it is a bug, it should be fixed, however, in the meantime, this might help you: (its what i do in my kernel install script)
eval $(head -n 4 Makefile | sed -e 's/ //g')

then in bash you can do this:
FULLVER=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}

hope it might help

Quoted 2 lines

-JimC

#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Kasper" == Kasper Sandberg <[email protected]> writes:

Kasper> (its what i do in my kernel install script) Kasper> evan $(head -n 4 Makefile | sed -e 's/ //g')

Kasper> then in bash you can do this:
Kasper> FULLVER=${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}

That is like what I used to do. I switched to $(make kernelrelease) to deal with LOCALVERSION (which I use via a file) and now the auto localversion (which adds a ref to the most recent git commit in the compiling tree).

I did do the bisect (I cannot exaggerate how much faster is was after a $(git-repack -a -d && git-prune-packed). Bigger than W.E.Coyote w/ a broken leg vs R.R in overdrive. :)

I'm posting the details separately.

-JimC

Signature · 1 line
James H. Cloos, Jr. <[email protected]>
#3 lore raw
In reply to James Cloos

I did a $(git-repack -a -d && git-prune-packed) before trying the bisect.

Wow. Talk about a speed improvement.

I also found that $(make oldconfig; make kernelrelease) was enough to bisect down to the commit in question.

The final git bisect bad reported:

,---- :; git bisect bad

| ac4d5f74a9b243d9f3f123fe5ce609478df208d8 is first bad commit
| diff-tree ac4d5f74a9b243d9f3f123fe5ce609478df208d8 (from ab919c06144cfb11c05b5b5cd291daa96ac2e423)
| Author: Uwe Zeisberger <[email protected]>
| Date:   Wed Nov 9 15:54:08 2005 +0100
| 
|     [PATCH] kbuild: make kernelrelease in unconfigured kernel prints an error
| 
|     Do not include .config for target kernelrelease
| 
|     Signed-off-by: Uwe Zeisberger <[email protected]>
|     Signed-off-by: Sam Ravnborg <[email protected]>
| 
| :100644 100644 2dac8010c14296bf71b20da92d7256d6a5b41f22 3152d6377eb20bb79a95850fabf7b6fee3a64ad2 M      Makefile

`----

The unidiff is:

,---- git diff ab919c06144cfb11c05b5b5cd291daa96ac2e423 ac4d5f74a9b243d9f3f123fe5ce609478df208d8

| diff --git a/Makefile b/Makefile
| index 2dac801..3152d63 100644
| --- a/Makefile
| +++ b/Makefile
| @@ -407,7 +407,7 @@ outputmakefile:
|  # of make so .config is not included in this case either (for *config).
| 
|  no-dot-config-targets := clean mrproper distclean \
| -                        cscope TAGS tags help %docs check%
| +                        cscope TAGS tags help %docs check% kernelrelease
| 
|  config-targets := 0
|  mixed-targets  := 0

`----

That means that $(make kernelrelease) sets dot_config := 0.

And since the block:

,---- linux-2.6/Makefile lines 571-574

| ifdef CONFIG_LOCALVERSION_AUTO
|         localversion-auto := $(shell $(PERL) $(srctree)/scripts/setlocalversion $(srctree))
|         LOCALVERSION := $(LOCALVERSION)$(localversion-auto)
| endif

`----

is in the ifeq ($(dot-config),1) section, localversion-auto does not get set anymore when the target is kernelrelease.

Which really makes kernelrelease useless.

I understand why the patch was proposed and included.

But the kernelrelease is really .config dependant, given the CONFIG_LOCALVERSION and CONFIG_LOCALVERSION_AUTO options.

Unless it is OK to force a defconfig when kernelrelease is called on an unconfigured tree?

Whatever the solution, it is commit ac4d5f74a9b243d9f3f123fe5ce609478df208d8 that breaks $(make kernelrelease).

-JimC

Signature · 1 line
James H. Cloos, Jr. <[email protected]>
#4 lore raw
Quoted 21 lines · James Cloos

I did a $(git-repack -a -d && git-prune-packed) before trying the bisect.

I also found that $(make oldconfig; make kernelrelease) was enough to bisect down to the commit in question.

The final git bisect bad reported:

,---- :; git bisect bad

| ac4d5f74a9b243d9f3f123fe5ce609478df208d8 is first bad commit
| diff-tree ac4d5f74a9b243d9f3f123fe5ce609478df208d8 (from ab919c06144cfb11c05b5b5cd291daa96ac2e423)
| Author: Uwe Zeisberger <[email protected]>
| Date:   Wed Nov 9 15:54:08 2005 +0100
| 
|     [PATCH] kbuild: make kernelrelease in unconfigured kernel prints an error
| 
|     Do not include .config for target kernelrelease
| 
|     Signed-off-by: Uwe Zeisberger <[email protected]>
|     Signed-off-by: Sam Ravnborg <[email protected]>
| 
| :100644 100644 2dac8010c14296bf71b20da92d7256d6a5b41f22 3152d6377eb20bb79a95850fabf7b6fee3a64ad2 M      Makefile
Quoted 4 lines

`----

Whatever the solution, it is commit ac4d5f74a9b243d9f3f123fe5ce609478df208d8 that breaks $(make kernelrelease).

That's true, I recently realized that, too, but didn't find the time to react.

In my eyes the solution has to be that .config is included iff it exists.

I'll work out a patch and send it to you.

Best regards
Uwe

Signature · 4 lines
Uwe Zeisberger

exit vi, lesson V:
o : q ! CTRL-V <CR> <Esc> " d d d @ d
#5 lore raw
Quoted 8 lines · Uwe Zeisberger
Quoted 2 lines · James Cloos

Whatever the solution, it is commit ac4d5f74a9b243d9f3f123fe5ce609478df208d8 that breaks $(make kernelrelease).

That's true, I recently realized that, too, but didn't find the time to react.

In my eyes the solution has to be that .config is included iff it exists.

Include .config for target kernelrelease if it exists

With this fix the value of CONFIG_LOCALVERSION is appended to the output of make kernelrelease. The git tag is *not* appended (yet) without a .config.

---

 Makefile |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

applies-to: bf816f7c7055127415fc3b718e260855df815d55 02a17e7669dcc6abd51fefc65af2278e95e4855f

Makefile +14 -3
index e7a0443..77b51b8 100644
@@ -407,16 +407,23 @@ outputmakefile:
 # Detect when mixed targets is specified, and make a second invocation
 # of make so .config is not included in this case either (for *config).
 
-no-dot-config-targets := clean mrproper distclean \
-			 cscope TAGS tags help %docs check% kernelrelease
+no-dot-config-targets  := clean mrproper distclean \
+			  cscope TAGS tags help %docs check%
+
+opt-dot-config-targets := kernelrelease
 
 config-targets := 0
 mixed-targets  := 0
 dot-config     := 1
+opt-dot-config := 0
 
-ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
+ifneq ($(filter $(no-dot-config-targets) $(opt-dot-config-targets), $(MAKECMDGOALS)),)
 	ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
 		dot-config := 0
+	else
+		ifeq ($(filter-out $(opt-dot-config-targets), $(MAKECMDGOALS)),)
+			opt-dot-config := 1
+		endif
 	endif
 endif
 
@@ -483,7 +490,11 @@ ifeq ($(dot-config),1)
 # oldconfig if changes are detected.
 -include .config.cmd
 
+ifeq ($(opt-dot-config),1)
+-include .config
+else
 include .config
+endif
 
 # If .config needs to be updated, it will be done via the dependency
 # that autoconf has on .config.

---
0.99.9g

Signature · 4 lines
Uwe Zeisberger

primes where sieve (p:xs) = [ x | x<-xs, x `rem` p /= 0 ]; \
primes = map head (iterate sieve [2..])
#6 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Uwe" == Uwe Zeisberger <[email protected]> writes:

Uwe> With this fix the value of CONFIG_LOCALVERSION is appended to the Uwe> output of make kernelrelease. The git tag is *not* appended Uwe> (yet) without a .config.

That works.

Thanks.

-JimC