grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Efros <powerman@powerman.name>
To: grub-devel@gnu.org
Subject: [patch] more configurable menu generation
Date: Sun, 20 Oct 2013 01:02:41 +0300	[thread overview]
Message-ID: <20131019220241.GD8031@home.power> (raw)

[-- Attachment #1: Type: text/plain, Size: 2298 bytes --]

Hi!

I've developed a patch which implement few related features:
- ability to define which linux kernels and in which order will be listed
  in top menu instead of single auto-detected latest kernel
- ability to show kernel version in top menu items, to distinguish between
  different kernels added by previous feature
- ability to use custom kernel command line parameters for depending on
  kernel version instead of GRUB_CMDLINE_LINUX_DEFAULT for all kernels


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 configured in /etc/default/grub using new variables:
GRUB_SIMPLE_VERSION, GRUB_MENU_LINUX, GRUB_CMDLINE_LINUX_CUSTOM. Example:

---cut---
# Show kernel version in top menu entries
GRUB_SIMPLE_VERSION=true

# Manually define list of top 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
# for some kernels (instead of GRUB_CMDLINE_LINUX_DEFAULT)
# Should contain any amount of pairs: shell pattern for kernel version and
# kernel command line for it (must be quoted if contain spaces).
# First matched pattern will be used. Example:
# GRUB_CMDLINE_LINUX_CUSTOM='
#	*_nouveau		video=800x600
#	3.10.*			"vga=0x315 it87.force_id=0x8721"
#	3.9.9-hardened		"init=/bin/sh"
# '
GRUB_CMDLINE_LINUX_CUSTOM='
	*_nouveau		"video=800x600"
'
---cut---


Attached patch is for grub-2.00_p5107. Patch tested with dash and bash.

-- 
			WBR, Alex.

[-- Attachment #2: customize_menu.patch --]
[-- Type: application/x-patch, Size: 5149 bytes --]

                 reply	other threads:[~2013-10-19 22:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131019220241.GD8031@home.power \
    --to=powerman@powerman.name \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).