Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 179739 - sys-kernel/genkernel does not recognize kernel config change when using --kernel-config
Summary: sys-kernel/genkernel does not recognize kernel config change when using --ker...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-25 12:06 UTC by Pat Double
Modified: 2007-08-28 19:42 UTC (History)
0 users

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


Attachments
patch for gen_package.sh (gen_package.patch,910 bytes, patch)
2007-06-06 18:00 UTC, Pat Double
Details | Diff
gen_package.patch (gen_package.patch,902 bytes, patch)
2007-06-07 15:50 UTC, Pat Double
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pat Double 2007-05-25 12:06:03 UTC
catalyst 2.0.4 does not recognize kernel config change. I have already built a livecd-stage2 and later modify my kernel config. When building livecd-stage2 again a message states that no kernel config change has been detected. If I remove /var/tmp/catalyst/kerncache and build, the kernel indeed has my new config.

Reproducible: Always

Steps to Reproduce:
1. build livecd-stage2
2. change kernel config
3. build livecd-stage2
4. notice kernel is not rebuilt

Actual Results:  
Stale kernel cache is usage.

Expected Results:  
Kernel should be rebuilt.
Comment 1 Pat Double 2007-06-04 14:02:38 UTC
It looks like this bug is actually in genkernel. I am seeing it when using catalyst though. My machine doesn't use cache when building the kernel so I cannot comment on that setup.
Comment 2 Andrew Gaffney (RETIRED) gentoo-dev 2007-06-04 14:26:06 UTC
Please verify whether this is genkernel or catalyst's fault. Run genkernel a few times locally with the proper options for kerncache. That should tell you.

Also, we just need more information in general. There is very little here to go on. It seems to work just fine for everyone else.
Comment 3 Pat Double 2007-06-04 15:15:57 UTC
I'll change summary back to catalyst until I can verify what's really going on
here
Comment 4 Pat Double 2007-06-05 16:25:39 UTC
I added a patch to display the md5sum and head of the kernel configs when genkernel checks if the cache is valid. Here's what I get:

* Linux Kernel 2.6.20-gentoo-r8 for x86...
* WARNING: No mounted /boot partition detected!
*          Run mount /boot to mount it!

* Kernel config (/var/tmp/genkernel/30832.1015.13720.30639/config-x86-2.6.20-gentoo-r8) MD5: a46b89c1bc1c38887562d6eef70954d8
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.20-gentoo-r8
# Sun Jun  3 19:43:54 2007
#
* Kernel cached (//usr/src/linux/.config) config MD5: a46b89c1bc1c38887562d6eef70954d8
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.20-gentoo-r8
# Sun Jun  3 19:43:54 2007
#

* No kernel configuration change, skipping kernel build...




Yet my kernel config starts like (notice the date is missing, this is only for testing and it looks from the code that comments are considered in the md5 sum):

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.20-gentoo-r8
#
#


I'm not sure what's happening here. Either genkernel is not checking the right file, or catalyst is putting the config in the wrong, or whatever, I don't really know. But I do know if I clear the kernel cache the new kernel does use the correct config.
Comment 5 Pat Double 2007-06-05 19:11:21 UTC
Perhaps this code in /usr/share/genkernel/gen_configkernel.sh

        # If we're not cleaning, then we don't want to try to overwrite the configs there
        # or we might remove configurations someone is trying to test.

        if isTrue "${CLEAN}"
        then
                print_info 1 "config: Using config from ${KERNEL_CONFIG}"
                print_info 1 '        Previous config backed up to .config.bak'
                cp "${KERNEL_CONFIG}" "${KERNEL_DIR}/.config" || gen_die 'Could not copy configuration file!'
        fi


That seems to prevent the kernel specified on the command line from being used if we're not cleaning. However, if --clean is given then will the cache be used at all??
Comment 6 Pat Double 2007-06-05 19:37:42 UTC
Unless I'm really mistaken, this time I think it is genkernel. It appears it
does not detect kernel config changes correctly when the config is specified
using "--kernel-config". It always checks the .config in the kernel source
directory. The config check is done before config_kernel is called, so the
config file specified by --kernel-config is not copied to t
Comment 7 Pat Double 2007-06-05 19:40:13 UTC
I cannot upload, bugzilla error, here is the patch:

Index: gen_package.sh
===================================================================
--- gen_package.sh      (revision 508)
+++ gen_package.sh      (working copy)
@@ -150,12 +150,18 @@
         else
                if [ -e "${KERNCACHE}" ]
                then
+                       KERNEL_CONFIG="/${KERNEL_DIR}/.config"
+                       if [ "${CMD_KERNEL_CONFIG}" != '' ]
+                       then
+                               KERNEL_CONFIG="${CMD_KERNEL_CONFIG}"
+                       fi
+
                        /bin/tar -xj -f ${KERNCACHE} -C ${TEMP}
-                       if [ -e ${TEMP}/config-${ARCH}-${KV} -a -e /${KERNEL_DIR}/.config ]
+                       if [ -e ${TEMP}/config-${ARCH}-${KV} -a -e ${CMD_KERNEL_CONFIG} ]
                        then

                                test1=$(md5sum ${TEMP}/config-${ARCH}-${KV} | cut -d " " -f 1)
-                               test2=$(md5sum /${KERNEL_DIR}/.config | cut -d " " -f 1)
+                               test2=$(md5sum ${CMD_KERNEL_CONFIG} | cut -d " " -f 1)
                                if [ "${test1}" == "${test2}" ]
                                then
Comment 8 Pat Double 2007-06-06 18:00:02 UTC
Created attachment 121340 [details, diff]
patch for gen_package.sh

This patch ignores comments in the kernel config when doing the md5sum. I need this as the config has the current date put into it which causes the cache to also look invalid.
Comment 9 Pat Double 2007-06-07 15:50:02 UTC
Created attachment 121415 [details, diff]
gen_package.patch

Replaces previously bad patch that used the wrong env var for the new kernel config.
Comment 10 Chris Gianelloni (RETIRED) gentoo-dev 2007-06-23 14:04:48 UTC
Most of the caching code was written before my time as genkernel maintainer, so I'm not very familiar with it.  I honestly don't know what it is supposed to do and it would require me to get up-to-speed on that portion of the code.  I am working towards a 3.5 release for genkernel and would love to get this fixed before then.  Unfortunately, my time is still very scarce, due to my taking a one-month "semi-vacation" from Gentoo where I was only working on the most important of things and my workload piling up on me.  If I were to roll up a new genkernel version with your patch from current SVN, would you test it for me and see if this problem is fixed?

I'd trust you on this and just don't have the time to spend for a still indeterminate amount of time to test this.  Knowing you've tested it (and maybe someone else, if someone volunteers) and the problem is resolved will help me out greatly and will allow me to focus on other bugs that will likely require more of my direct energy.
Comment 11 Pat Double 2007-06-23 14:11:33 UTC
Yes, I'd be happy to test it.
Comment 12 Andrew Gaffney (RETIRED) gentoo-dev 2007-07-26 02:53:17 UTC
This patch looks simple and relatively harmless. In SVN!
Comment 13 Chris Gianelloni (RETIRED) gentoo-dev 2007-08-22 19:54:09 UTC
Please test genkernel 3.4.9_prer1 or better.  This should be fixed now.
Comment 14 Pat Double 2007-08-28 19:42:51 UTC
Works for me. Thanks.