Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 669412 - sys-kernel/genkernel -- --hyperv flag doesn't work
Summary: sys-kernel/genkernel -- --hyperv flag doesn't work
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2018-10-23 16:30 UTC by Leon Villarreal
Modified: 2019-03-26 08:07 UTC (History)
1 user (show)

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


Attachments
My proposed fix for genkernel's --hyperv flag. (genkernel-hyperv-fix.patch,2.45 KB, patch)
2018-10-23 16:30 UTC, Leon Villarreal
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leon Villarreal 2018-10-23 16:30:38 UTC
Created attachment 552518 [details, diff]
My proposed fix for genkernel's --hyperv flag.

While trying to configure and install Gentoo (just to try it out) in a Hyper-V virtual machine on my Windows box, I found that genkernel's implementation of the --hyperv flag to build Hyper-V guest support into the kernel is broken.

It took a while to track down what was even going on (since I assumed the flag was working properly at first), but in combing through the genkernel source, I found two critical problems with the implementation of this flag:

1.  Setting the --hyperv flag actually sets the CMD_ISCI variable in gen_cmdline.sh, instead of CMD_HYPERV as it should.  Thus, enabling --hyperv actually enables --iscsi, and the --hyperv flag implementation is never run no matter what.
2.  The module configuration flags set for Hyper-V in gen_configkernel.sh (which can never get set anyway) are incomplete.  Though they cover all the CONFIG_HYPERV_* options, these options have extra dependencies outside of Hyper-V-specific modules that this code doesn't set.

Solving (2) also required modifying the kconfig_set_opt() function in gen_funcs.sh to be able to add new options to the kernel config not already present.  In my experimentation, this was required because some options didn't exist in the kernel .config (even as "# $foo is not set" comments) until after CONFIG_HYPERVISOR_GUEST was set to "y", and make menuconfig or make oldconfig were run again.  When genkernel would be run, the user would have to manually enter all these options (since kconfig_set_opt() couldn't set them properly), instead of genkernel "just working" to configure the kernel without user input.

Using the patch I've attached to this bug, I've been able to get genkernel to properly compile in Hyper-V support to my kernels, so that my fresh Gentoo installation can actually boot and network properly after rebooting from the install CD.

I realize support for Hyper-V is probably pretty edge case for Gentoo, and seems to have been last touched c.a. 2013 in https://bugs.gentoo.org/463182.  That said, considering the --hyperv support flag is very clearly broken in the current implementation of genkernel, it should either be removed to avoid confusing users (like myself), or fixed.

N.B.: This bug is NOT related to providing/needing Microsoft's "Hyper-V Integration Services" for Linux, which are additional services/packages to integrate Linux into Hyper-V environments _beyond_ the basic Hyper-V support kernel modules.
Comment 1 Larry the Git Cow gentoo-dev 2019-03-26 08:07:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=8336c562cba2e5e5132ad4bcb3eea34278df9e04

commit 8336c562cba2e5e5132ad4bcb3eea34278df9e04
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-26 03:51:03 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-26 07:12:06 +0000

    config_kernel(): rewrite --hyperv handling
    
    Fixes: https://bugs.gentoo.org/669412
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 gen_configkernel.sh | 130 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 119 insertions(+), 11 deletions(-)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=146de30d358d92a10bab9888898e43735baf4af2

commit 146de30d358d92a10bab9888898e43735baf4af2
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2019-03-26 03:34:40 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2019-03-26 05:25:45 +0000

    kconfig_set_opt(): add possibility to add new kernel options
    
    Bug: https://bugs.gentoo.org/669412
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 gen_funcs.sh | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)