public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* Re: [gentoo-dev] rfc: the demise of grub:0
  @ 2016-10-05 17:26 99%               ` Patrick McLean
  0 siblings, 0 replies; 1+ results
From: Patrick McLean @ 2016-10-05 17:26 UTC (permalink / raw
  To: Kent Fredric; +Cc: gentoo-dev

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

On Thu, 6 Oct 2016 01:54:51 +1300
Kent Fredric <kentnl@gentoo.org> wrote:

> On Wed, 5 Oct 2016 06:04:38 -0500
> Rich Freeman <rich0@gentoo.org> wrote:
> 
> > What you really want is another template file.  
> 
> I'd be happy with that. See the other thread with "grub-2" In the
> title.
> 
> > I'm happy with mkconfig, but I did hand-roll my config files before
> > that.  The docs are out there.  However, for whatever reason, it is
> > very hard to find examples of simple config files online.  The
> > official docs try to point you in the direction of mkconfig, and
> > since 99% of linux users don't configure their own grub there isn't
> > much alternative documentation (and when a distro's solution does
> > break the solution usually is based on mkconfig anyway).  
> 
> Yeah, the only reason I suggested "a tool" instead of "a template" is
> that perhaps there could be a handful of easily detectable things that
> generate a more optimal "initial" template.
> 
> Particularly with regards to getting the hard-drive numbers and stuff
> right, that's what always concerns me.

I have attached a somewhat cleaned up and commented version of the
hand-written grub config I use at home. Feel free to use as an example
for your machines, add it to the wiki and/or the handbook, or make the
ebuild install it to /usr/share etc.

One of the nice things about grub2 is that you no longer need to know
or care about the BIOS disk numbers, you can simply use the UUID of the
filesystem (and/or the PARTUUID for the kernel).

[-- Attachment #2: grub.cfg --]
[-- Type: application/octet-stream, Size: 3085 bytes --]

# /boot/grub/grub.cfg
# Grub configuration file
#
# Author: Patrick McLean <chutzpah@gentoo.org>
#

# The UUID of the Linux boot filesystem (and where grub lives)
# blkid to find the UUID of the /boot filesystem
# blkid <device>
set boot_uuid=""

# The PARTUUID of the Linux root filesystem, use blkid to find this
set root_partuuid=""

# the partuuid of the filesystem containing windoes (if applicable)
#set win_partuuid=""

# we must have some default, set it to the first menu entry for now
set default=0

# this is a function definition to save the default to the selected
# menu option (this can be used below)
function savedefault {
	if [ -z "${boot_once}" ]; then
		if [ -n "${1}" ]; then
			saved_entry="${1}"
		else
			saved_entry="${chosen}"
		fi
		save_env saved_entry
	fi
}

# load graphics drivers if we are on UEFI
if [ ${grub_platform} = efi ]; then
	insmod efi_gop
	insmod efi_uga
fi

terminal_input console
terminal_output console

# disable the timeout if shift is being held
if keystatus --shift; then
	set timeout=-1
else
	set timeout=30
fi

set superusers="root"
# use grub-mkpasswd-pbkdf2 to generate a password here
password_pbkdf2 root PASSWORD

# find the root filesystem with the bootloader files
# uncomment the appropiate module for your partition table here
insmod part_gpt
insmod part_msdos

# uncomment the appropiate module for the filesystem that /boot is formatted
# as with here, use your root filesystem if it's the same partition

# use ext2 for ext{2,3,4}
insmod ext2
#insmod btrfs
#insmod jfs
#insmod xfs
#insmod zfs

# uncomment the module for the compression used for your kernel
insmod gzio
insmod xzio
insmod lzopio

# this tells grub to search for the /boot filesystem so it can load kernels
# and other data from said filesystem
search --no-floppy --fs-uuid --set=root ${boot_uuid}

# menu entries, uncomment "savedefault" to save the entry as the default
# after it has been selected, 
menuentry 'Gentoo Linux' --class="gentoo" --unrestricted --hotkey="l" {
	linux	(${root})/boot/vmlinuz root=PARTUUID=${root_partuuid} ro
	#savedefault
}

# menu entry to load windows, works for all recent versions of windows
#menuentry 'Windows 10' --class="windows" --unrestricted --hotkey="w" {
#    insmod ntldr
#    insmod ntfs
#    search --no-floppy --fs-uuid --set=root ${win_partuuid}
#    ntldr (${root})/bootmgr
#    savedefault
#}

menuentry 'Gentoo Linux (Old Kernel)' --class "gentoo" --unrestricted --hotkey=="o" {
	linux	(${root})/boot/vmlinuz.old root=PARTUUID=${root_partuuid} ro
}

menuentry 'Gentoo Linux (Single User Mode)' --class "gentoo" {
	linux	(${root})/boot/vmlinuz single root=PARTUUID=${root_partuuid} ro
}

menuentry 'Gentoo Linux (Recovery Mode)' --class "gentoo" --users root {
	linux	(${root})/boot/vmlinuz single root=PARTUUID=${root_partuuid} ro init=/bin/bb
}

menuentry 'Memtest86' --class="memtest" --unrestricted --hotkey="l" {
	linux16	(${root})/boot/memtest86/memtest
	#savedefault
}

menuentry "Memtest86+" --unrestricted --class "memtest" {
	linux16 (${root})/boot/memtest86plus/memtest.bin
	#savedefault 0
}


^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-10-03 21:59     [gentoo-dev] rfc: the demise of grub:0 William Hubbs
2016-10-04 22:04     ` Dan Douglas
2016-10-04 22:28       ` William Hubbs
2016-10-05  1:29         ` Kent Fredric
2016-10-05  2:22           ` Rich Freeman
2016-10-05  2:57             ` Kent Fredric
2016-10-05 11:04               ` Rich Freeman
2016-10-05 12:54                 ` Kent Fredric
2016-10-05 17:26 99%               ` Patrick McLean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox