Gentoo Logo

Renuncia de responsabilidad: Este manual ha sido sustituido por una versión más reciente y no tendrá soporte de aquí en adelante.


[ << ] [ < ] [ Inicio ] [ > ] [ >> ]


10. Configurar el Gestor de Inicio

Contenido:

10.a. Making your Choice

Introduction

Now that your kernel is configured and compiled and the necessary system configuration files are filled in correctly, it is time to install a program that will fire up your kernel when you start the system. Such a program is called a bootloader.

Optional: Framebuffer

If you have configured your kernel with framebuffer support, you have to add a video-statement to your bootloader configuration file if you require framebuffer.

For the video-statement, a simplified syntax is used. Most of the time it's sufficient to use video=vesafb.

More information can be found in /usr/src/linux/Documentation/fb/vesafb.txt.

Remember (or write down) your value; you will need it shortly.

10.b. Using GRUB

Understanding GRUB's terminology

The most critical part of understanding GRUB is getting comfortable with how GRUB refers to hard drives and partitions. Your Linux partition /dev/hda1 is called (hd0,0) under GRUB. Notice the parenthesis around the hd0,0 - they are required.

Hard drives count from zero rather than "a" and partitions start at zero rather than one. Be aware too that with the hd devices, only hard drives are counted, not atapi-ide devices such as cdrom players and burners. Also, the same construct is used with scsi drives. (Normally they get higher numbers than ide drives except when the bios is configured to boot from scsi devices.)

Assuming you have a hard drive on /dev/hda, a cdrom player on /dev/hdb, a burner on /dev/hdc, a second hard drive on /dev/hdd and no SCSI hard drive, /dev/hdd7 gets translated to (hd1,6). It might sound tricky and tricky it is indeed, but as we will see, GRUB offers a tab completion mechanism that comes handy for those of you having a lot of hard drives and partitions and who are a little lost in the GRUB numbering scheme.

Having gotten the feel for that, it is time to install GRUB.

Installing GRUB

To install GRUB, let's first emerge it.

Listado de Código 2.1: Installing GRUB

# emerge --usepkg grub-static
# cp -Rpv /usr/share/grub/i386-pc/* /boot/grub

Although GRUB is now installed, we still need to write up a configuration file for it and install GRUB in the MBR so that GRUB automatically boots your newly created kernel. Create /boot/grub/grub.conf with nano (or, if applicable, another editor):

Listado de Código 2.2: Creating /boot/grub/grub.conf

# nano -w /boot/grub/grub.conf

Now we are going to write up a grub.conf. Below you'll find two possible grub.conf for the partitioning example we use in this guide, with kernel image kernel-2.6.5-gentoo. We've only extensively commented the first grub.conf.

  • The first grub.conf is for people who have not used genkernel to build their kernel
  • The second grub.conf is for people who have used genkernel to build their kernel

Listado de Código 2.3: grub.conf for non-genkernel users

# Which listing to boot as default. 0 is the first, 1 the second etc.
default 0
# How many seconds to wait before the default listing is booted.
timeout 30
# Nice, fat splash-image to spice things up :)
# Comment out if you don't have a graphics card installed
splashimage=(hd0,0)/grub/splash.xpm.gz

title=Gentoo Linux 2.6.5
# Partition where the kernel image (or operating system) is located
root (hd0,0)
kernel /kernel-2.6.5-gentoo root=/dev/hda3

# The next four lines are only if you dualboot with a Windows system.
# In this case, Windows is hosted on /dev/hda6.
title=Windows XP
rootnoverify (hd0,5)
makeactive
chainloader +1

Listado de Código 2.4: grub.conf for genkernel users

default 0
timeout 30
splashimage=(hd0,0)/grub/splash.xpm.gz

title=Gentoo Linux 2.6.5
root (hd0,0)
kernel /kernel-2.6.5-gentoo root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hda3
initrd /initrd-2.6.5-gentoo

# Only in case you want to dual-boot
title=Windows XP
root (hd0,5)
makeactive
chainloader +1

Nota: If you use a different partitioning scheme and/or kernel image, adjust accordingly. However, make sure that anything that follows a GRUB-device (such as (hd0,0)) is relative to the mountpoint, not the root. In other words, (hd0,0)/grub/splash.xpm.gz is in reality /boot/grub/splash.xpm.gz since (hd0,0) is /boot.

If you need to pass any additional options to the kernel, simply add them to the end of the kernel command. We're already passing one option (root=/dev/hda3 or real_root=/dev/hda3), but you can pass others as well. As an example we use the video statement for framebuffer we discussed previously:

Listado de Código 2.5: Adding the video-statement as a kernel option

title=Gentoo Linux
  root (hd0,0)
  kernel /kernel-2.6.5-gentoo root=/dev/hda3 video=vesafb

genkernel users should know that their kernels use the same boot options as is used for the LiveCD. For instance, if you have SCSI devices, you should add doscsi as kernel option.

Now save the grub.conf file and exit. We still need to install GRUB in the MBR (Master Boot Record) though.

The GRUB developers recommend the use of grub-install. However, if for some reason grub-install fails to work correctly you still have the option to manually install GRUB.

Continue with Default: Setting up GRUB using grub-install or Alternative: Setting up GRUB using manual instructions.

Default: Setting up GRUB using grub-install

To install GRUB you will need to issue the grub-install command. However, grub-install won't work off-the-shelf since we are inside a chrooted environment. We need to update /etc/mtab (the file with information about all mounted filesystems) first: luckily there is an easy way to accomplish this - just copy over /proc/mounts to /etc/mtab:

Listado de Código 2.6: Updating /etc/mtab

# cp /proc/mounts /etc/mtab

Now we can install GRUB using grub-install:

Listado de Código 2.7: Running grub-install

# grub-install --root-directory=/boot /dev/hda

If you have more questions regarding GRUB, please consult the GRUB FAQ or the GRUB Manual.

Continue with Rebooting the System.

Alternative: Setting up GRUB using manual instructions

To start configuring GRUB, you type in grub. You'll be presented with the grub> grub command-line prompt. Now, you need to type in the right commands to install the GRUB boot record onto your hard drive.

Listado de Código 2.8: Starting the GRUB shell

# grub

Nota: If your system does not have any floppy drives, add the --no-floppy option to the above command to prevent grub from probing the (non-existing) floppy drives.

In the example configuration we want to install GRUB so that it reads its information from the boot-partition /dev/hda1, and installs the GRUB boot record on the hard drive's MBR (master boot record) so that the first thing we see when we turn on the computer is the GRUB prompt. Of course, if you haven't followed the example configuration during the installation, change the commands accordingly.

The tab completion mechanism of GRUB can be used from within GRUB. For instance, if you type in "root (" followed by a TAB, you will be presented with a list of devices (such as hd0). If you type in "root (hd0," followed by a TAB, you will receive a list of available partitions to choose from (such as hd0,0).

By using the tab completion, setting up GRUB should be not that hard. Now go on, configure GRUB, shall we? :-)

Listado de Código 2.9: Installing GRUB in the MBR

grub> root (hd0,0)          (Specify where your /boot partition resides)
grub> setup (hd0)           (Install GRUB in the MBR)
grub> quit                  (Exit the GRUB shell)

Nota: If you want to install GRUB in a certain partition instead of the MBR, you have to alter the setup command so it points to the right partition. For instance, if you want GRUB installed in /dev/hda3, then the command becomes setup (hd0,2). Few users however want to do this.

If you have more questions regarding GRUB, please consult the GRUB FAQ or the GRUB Manual.

Continue with Rebooting the System.

10.c. Rebooting the System

Exit the chrooted environment and unmount all mounted partitions. Then type in that one magical command you have been waiting for: reboot.

Listado de Código 3.1: Unmounting all partitions and rebooting

# exit
# cd
# umount /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo
# reboot

Of course, don't forget to remove the bootable CD, otherwise the CD will be booted again instead of your new Gentoo system.

Once rebooted in your Gentoo installation, finish up with Finalizing your Gentoo Installation.


[ << ] [ < ] [ Inicio ] [ > ] [ >> ]


Imprimir

Ver completo

Página actualizada 20 de octubre, 2004

Esta traducción ha dejado de tener soporte

Sumario: Este capítulo describe y guía el proceso de configuración del gestor de inicio GRUB.

Daniel Robbins
Author

Sven Vermeulen
Author

Chris Houser
Author

Jerry Alexandratos
Author

Seemant Kulleen
Gentoo x86 Developer

Tavis Ormandy
Gentoo Alpha Developer

Jason Huebel
Gentoo AMD64 Developer

Guy Martin
Gentoo HPPA developer

Pieter Van den Abeele
Gentoo PPC developer

Joe Kallar
Gentoo SPARC developer

John P. Davis
Editor

Pierre-Henri Jondot
Editor

Eric Stockbridge
Editor

Rajiv Manglani
Editor

Jungmin Seo
Editor

Stoyan Zhekov
Editor

Jared Hudson
Editor

Colin Morey
Editor

Jorge Paulo
Editor

Carl Anderson
Editor

Jon Portnoy
Editor

Zack Gilburd
Editor

Jack Morgan
Editor

Benny Chuang
Editor

Erwin
Editor

Joshua Kinard
Editor

Tobias Scherbaum
Editor

Grant Goodyear
Reviewer

Gerald J. Normandin Jr.
Reviewer

Donnie Berkholz
Reviewer

Ken Nowack
Reviewer

Lars Weiler
Contributor

José Alberto Suárez López
Editor-Es

John Christian Stoddart
Follow-up Editor-Es

Octavio H. Ruiz
Translator

Donate to support our development efforts.

Copyright 2001-2014 Gentoo Foundation, Inc. Questions, Comments? Contact us.