Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 852617

Summary: genkernel-4.2.6-r2 fails if CPU_SUP_INTEL is not set with >=gentoo-sources-5.18.3
Product: Gentoo Hosted Projects Reporter: Jack <ostroffjh>
Component: genkernelAssignee: Gentoo Genkernel Maintainers <genkernel>
Status: RESOLVED WORKSFORME    
Severity: normal CC: bkohler, gentoo, zoltan
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: genkernel.conf
genkernel.log for gentoo-sources-5.18.3
updated genkernel.conf
Kernel config for 6.4.2

Description Jack 2022-06-16 18:20:07 UTC
I use gentoo-sources, and run "make xconfig" before invoking genkernel, which is configured not to run any of the "make something-config" options.  I have CPU_SUP_AMD=y and CPU_SUP_INTEL not set, and MICROCODE_AMD=y and MICROCODE_INTEL not set.  Between 5.18.2 and 5.18.3, kernel commit 9c55d99e099bd7aa6b91fce8718505c35d5dfc65 changed the depends for the two MICROCODE_vendor from just MICROCODE to CPU_SUP_vendor && MICROCODE.  

First, although I never noticed, genkernel adds MICROCODE_INTEL=y to .config, runs "make olddefconfig", and then compiles the kernel.  This seems wrong, since I explicitly set it to N.  

Second, with 5.18.3, that make olddefconfig removes the MICROCODE_INTEL line from .config (instead of either leaving it as "... is not set" or "...=y" and when genkernel checks .config and doesn't find that line, it errors out.

So - why would genkernel try to set MICROCODE_INTEL to y when I explicitly set it to n?  With 5.18.2 and earlier, it simply includes intel microcode patch loading, making the kernel a bit larger, but for 5.18.3 and later, it just fails.

Reproducible: Always

Steps to Reproduce:
1) With 5.18.2, set MICROCODE_INTEL=N and run genkernel
2) With 5.18.3, set CPU_SUP_INTEL=N (MICROCODE_INTEL can't be set) and run genkernel
Actual Results:  
1) Kernel gets compiled, but with MICROCODE_INTEL=y
2) genkernel fails

Expected Results:  
In both case, a compiled kernel without Intel microcode loading support.

I assume, but have not tested, that the same would occur switching the AMD and INTEL settings.  I can only assume nobody else has seen this because they set Y for both INTEL and AMD MICROCODE loading support.

I will attach genkernl.conf and genkernel.log
Comment 1 Jack 2022-06-16 18:20:37 UTC
Created attachment 785765 [details]
genkernel.conf
Comment 2 Jack 2022-06-16 18:21:52 UTC
Created attachment 785768 [details]
genkernel.log for gentoo-sources-5.18.3
Comment 3 Jack 2022-06-16 20:42:49 UTC
apologies for not directly assigning to genkerne@gentoo.org per the error message.
Comment 4 Jack 2023-07-08 20:44:50 UTC
Still happens with genkernel-4.3.2-r1 and gentoo-sources-6.4.2
Comment 5 Ben Kohler gentoo-dev 2023-07-09 12:23:16 UTC
I believe the problem is that genkernel defaults to MICROCODE="all" (this is a genkernel.conf option, not kernel config) so it will require CPU_SUP_INTEL.  CPU_SUP_INTEL is only able to be *disabled* if you enable CONFIG_EXPERT=y in the kernel.

You have enabled expert mode, which allows you to disable otherwise "standard" features.  So for now, you'll need to configure genkernel with MICROCODE=amd or MICROCODE=no, to account for the missing standard features.

We could patch genkernel to enforce CPU_SUP_INTEL and CPU_SUP_AMD when MICROCODE=all is set, but I suspect that would still go against your goals.

Any suggestions?
Comment 6 Ben Kohler gentoo-dev 2023-07-09 12:28:16 UTC
Apologies, I see you are setting MICROCODE="amd" in genkernel.conf.  It's still enforcing CONFIG_MICROCODE_INTEL for that case for some reason.  I'm not able to reproduce this failure, can you double-check your genkernel.conf still has MICROCODE="amd", and also attach your kernel config?
Comment 7 Jack 2023-07-09 22:36:08 UTC
Created attachment 865320 [details]
updated genkernel.conf
Comment 8 Jack 2023-07-09 22:41:11 UTC
Created attachment 865321 [details]
Kernel config for 6.4.2
Comment 9 Ben Kohler gentoo-dev 2023-07-10 14:28:15 UTC
What genkernel command are you using? Your genkernel.log says '*   MICROCODE overridden on command line to "all".'
Comment 10 Jack 2023-07-10 15:22:19 UTC
Bingo, and mea culpa.  I call genkernel with a script, which included '--microcode' and not '--microcode=amd'.  Changing that and it seems to be running fine.  

Question:  if I do have the proper setting in genkernel.conf, do I even need to mention --microcode on the invokation at all?  (I know i can just test it.)

I don't know if there is anything you can  do in the code to prevent this form of shooting myself in the foot, so feel free to close as NOTABUG.

Thanks for the eventual clue.
Comment 11 Ben Kohler gentoo-dev 2023-07-10 17:05:47 UTC
Pretty much all of the genkernel command line options (including microcode) can be toggled in genkernel.conf, there is no need to do both (and as you found out, cmdline overrides genkernel.conf)