Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 488386 - sys-boot/grub-2.00_p5107-r1: more configurable menu generation
Summary: sys-boot/grub-2.00_p5107-r1: more configurable menu generation
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-17 16:26 UTC by Alex Efros
Modified: 2013-10-17 23:06 UTC (History)
1 user (show)

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


Attachments
patch which implement these features (customize_menu.patch,4.60 KB, patch)
2013-10-17 16:27 UTC, Alex Efros
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Efros 2013-10-17 16:26:42 UTC
I've developed a patch which implement few related features:
- ability to define which linux kernels and in which order will be shown in top menu instead of one auto-detected latest kernel
- ability to show kernel version in simple menu items, to distinguish between several items added by previous feature
- ability to use custom kernel command line parameters for some kernels instead of GRUB_CMDLINE_LINUX_DEFAULT

Here is my real use-case explaining needs in these features. I'm experimenting with switching between proprietary nvidia driver and nouveau. My main kernel is 3.10.1-hardened-r1 (for proprietary nvidia driver), and I've also compiled experimental kernel with "_nouveau" local version: 3.10.1-hardened-r1_nouveau.

First issue - auto-detect of latest kernel choose 3.10.1-hardened-r1_nouveau, which is wrong for me, and only way to change this is add some fake local version for main kernel just to make sure it will be sorted before "_nouveau" string.
Second issue - main kernel need "vga=" parameter, while nouveau kernel need "video=" parameter, but there is no way to configure this.
Third issue - I'd like to have both normal and nouveau kernels in main menu, in manually defined order.

All these features configurable using /etc/default/grub using two new variables (GRUB_SIMPLE_VERSION and GRUB_MENU_LINUX) and one user-defined function (grub_cmdline_linux_custom). Example:

    # Add kernel version to simple menu entries
    GRUB_SIMPLE_VERSION=true

    # Manually define list of simple menu entries instead of auto-detecting
    # latest kernel.
    GRUB_MENU_LINUX="
        /boot/vmlinuz-3.10.1-hardened-r1
        /boot/vmlinuz-3.10.1-hardened-r1_nouveau
    "

    # Append parameters to the linux kernel command line for non-recovery entries
    GRUB_CMDLINE_LINUX_DEFAULT="vga=0x315"

    # Append parameters to the linux kernel command line for non-recovery entries
    # for some kernels (instead of GRUB_CMDLINE_LINUX_DEFAULT)
    function grub_cmdline_linux_custom {
        local -A CMDLINE

        CMDLINE[3.10.1-hardened-r1_nouveau]="video=800x600"

        echo ${CMDLINE[$1]}
    }

I've also sent this patch upstream: https://savannah.gnu.org/bugs/index.php?40291
Comment 1 Alex Efros 2013-10-17 16:27:32 UTC
Created attachment 361140 [details, diff]
patch which implement these features
Comment 2 Mike Gilbert gentoo-dev 2013-10-17 23:06:07 UTC
Thanks for the effort, but I'm not implementing new features at a distro level. Feel free to reopen if/when this is accepted upstream.