Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 426338 - genkernel 3.4.24_p2: missing separator between old and new kernel version
Summary: genkernel 3.4.24_p2: missing separator between old and new kernel version
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal trivial (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-12 16:39 UTC by Toralf Förster
Modified: 2016-01-31 18:27 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2012-07-12 16:39:32 UTC
Probably the unstable version has already fixed it - but the unstable needs an unstable openrc ... therefore pls look here : <-----------------



$ for i in 2; do sudo genkernel --no-clean --kerneldir=/usr/src/linux-3.$i.x/ all; done* Gentoo Linux Genkernel; Version 3.4.24_p2
* Running with options: --no-clean --kerneldir=/usr/src/linux-3.2.x/ all

* Linux Kernel 3.2.233.2.22 for x86...                  <-----------------
* mount: /boot mounted successfully!


Reproducible: Always
Comment 1 Toralf Förster gentoo-dev 2012-07-19 19:34:29 UTC
What I'd expect would be something  like this :

* Linux Kernel 3.2.23 (old: 3.2.22) for x86...
Comment 2 Xake 2012-08-02 15:32:34 UTC
Are you sure this is a bug in Genkernel?
Genkernel does not try t figure out if you are trying to rebuild in a tree from a earlier version. I also think I have seen similar things to this when building from Linus git-tree if I did not clean out the tree in between his version bumps.

What does "make kernelversion" give you?

To be honest Genkernel has an awful grepping trying to figure out the version of the current selected tree, and I have currently not time to dive into if make "kernelversion" can archieve the same, but it only handles one version at a time, which makes me think this is more of a problem with your tree.
Comment 3 Toralf Förster gentoo-dev 2012-08-02 17:06:14 UTC
n22 /usr/src # cd linux-3.5.x
n22 /usr/src/linux-3.5.x # make kernelversion
3.5.0
n22 /usr/src/linux-3.5.x # cd ../linux-3.0.x
n22 /usr/src/linux-3.0.x # make kernelversion
3.0.39
n22 /usr/src/linux-3.0.x # cd ../linux
n22 /usr/src/linux # make kernelversion
3.5.0
n22 /usr/src/linux # logout
tfoerste@n22 /usr/src/linux $ cd 
tfoerste@n22 ~ $ cd devel/linux/
tfoerste@n22 ~/devel/linux $ make kernelversion
3.5.0
Comment 4 Xake 2012-08-06 12:14:42 UTC
(In reply to comment #3)

I meant for the tree genkernel fails with (3.2)
I want to make sure that it is not your specific kernel tree that may have some inbetween-version berfore I try to figure out something with get_KV [1].
Because really, it is ugly, I really want to know if it can be replaced with make kernelversion, but I rather not if I do not have to, since there might be a reason they did it this way (that was not "oooold kernel did not have kernelversion").


http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=blob;f=gen_determineargs.sh;h=7f352f8ff4d92c9ced40009b73ffb5e0e5f9c256;hb=HEAD#l4
Comment 5 Toralf Förster gentoo-dev 2012-08-06 12:27:46 UTC
(In reply to comment #4)
> (In reply to comment #3)
> 
> I meant for the tree genkernel fails with (3.2)

Oh - in the mean while I moved 3.2 away. But AFAICR  it failed every time when I had have an older kernel in the source directory.
Comment 6 Xake 2012-08-06 16:58:35 UTC
So I pinpointed this.

http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=blob;f=gen_determineargs.sh;h=7f352f8ff4d92c9ced40009b73ffb5e0e5f9c256;hb=HEAD#l50

This file uses the following to find out the version number:

VER=`grep ^VERSION\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'`
PAT=`grep ^PATCHLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'`
SUB=`grep ^SUBLEVEL\ \= ${KERNEL_DIR}/Makefile | awk '{ print $3 };'`
EXV=`grep ^EXTRAVERSION\ \= ${KERNEL_DIR}/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g" -e 's/\$([a-z]*)//gi'`


Then it does the following:

UTS_RELEASE=`cat ${KERNEL_DIR}/include/config/kernel.release`
LOV=`echo ${UTS_RELEASE}|sed -e "s/${VER}.${PAT}.${SUB}${EXV}//"`
KV=${VER}.${PAT}.${SUB}${EXV}${LOV}


AFAICS what it tries to do is take the info from kernel.release, and then remove the VER.PAT.SUB it extracted from Makefile earlier on. The problem with this in your case is:
kernel.release is made during the build. When you later update your kernel tree the Makefiles gets its updates, however kernel.release remains the same.
So the VET.PAT.SUB that was extracted does not match with what was in kernel.release anymore, so the sed fails to mask away the version number.

There is a lot of questions on what really is necessary and what is not in this file, and why we just do not do "make kernelconfig" to figure things out.

So I can confirm your error (it is as easy as pulling linus git tree, and inside it while clean run "git reset --hard  v3.5 && make allnoconfig && make && git pull" and after that genkernel will get the wrong version number until kernel.release is updated/removed....


Now how to fix this, that is another question....
Comment 7 Toralf Förster gentoo-dev 2012-10-02 18:11:42 UTC
Hhm, as long as the whole thing has to be investigated (it is necessary and so on) - what's about a quick&dirty hack i the mean while to at least separate those 2 version strings during output ?
Comment 8 Xake 2012-10-06 23:33:10 UTC
(In reply to comment #7)
> Hhm, as long as the whole thing has to be investigated (it is necessary and
> so on) - what's about a quick&dirty hack i the mean while to at least
> separate those 2 version strings during output ?

I think what you misunderstood here is that there is not supposed to be two version strings to begin with. Genkernel does not try to find out whether you have a tree updated from an old or not. So really, it is supposed to only show the version of the tree it currently tries to compile

That you see two different version number is because of a bug which should be fixed. However to fix it someone has to figure out why that magic exists to begin with, and if it is a linux-2.4 legacy (at least the UTS-parts does not seem to be any references to in a modern 3.6-kernel), or something other magic.
And I will not have the time to do it myself until at least 9 november due to work.

If someone feels brave we could just replace the logic with a KV="$(make kernelversion)" (untested) and see what breaks (if anything).
Comment 9 Toralf Förster gentoo-dev 2012-11-17 21:42:33 UTC
FWIW when I upgrade a stable rc1 kernel candidate to final stable kenrel of the same version it looks ok :

tfoerste@n22 ~ $ for i in 6; do sudo genkernel --no-clean --kerneldir=/usr/src/linux-3.$i.x/ all; done
* Gentoo Linux Genkernel; Version 3.4.45
* Running with options: --no-clean --kerneldir=/usr/src/linux-3.6.x/ all

* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86/modules_load ..

* Linux Kernel 3.6.7-rc1 for x86...
* .. with config file /etc/kernels/kernel-config-x86-3.6.7-rc1
* kernel: --mrproper is disabled; not running 'make mrproper'.
*         >> Running oldconfig...
* kernel: --clean is disabled; not running 'make clean'.
*         >> Compiling 3.6.7 bzImage...





for different minor versions however the same picture :



tfoerste@n22 ~ $ for i in 4; do sudo genkernel --no-clean --kerneldir=/usr/src/linux-3.$i.x/ all; done* Gentoo Linux Genkernel; Version 3.4.45
* Running with options: --no-clean --kerneldir=/usr/src/linux-3.4.x/ all

* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86/modules_load ..

* Linux Kernel 3.4.193.4.18 for x86...
* .. with config file /usr/share/genkernel/arch/x86/kernel-config
* mount: /boot mounted successfully!
* kernel: --mrproper is disabled; not running 'make mrproper'.
*         >> Running oldconfig...
* kernel: --clean is disabled; not running 'make clean'.
*         >> Compiling 3.4.19 bzImage...
Comment 10 Toralf Förster gentoo-dev 2012-12-03 20:03:30 UTC
Upgrading from 3.6.9-rc1 to 3.6.9 however doesn't show that issue :



$ for i in 6; do sudo genkernel --no-clean --kerneldir=/usr/src/linux-3.$i.x/ all; done
* Gentoo Linux Genkernel; Version 3.4.45
* Running with options: --no-clean --kerneldir=/usr/src/linux-3.6.x/ all

* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86/modules_load ..

* Linux Kernel 3.6.9-rc1 for x86...
Comment 11 Toralf Förster gentoo-dev 2016-01-31 18:27:03 UTC
4 years old ...