Difference between pages "Video" and "GUID Booting Guide"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
 
Line 1: Line 1:
The purpose of this page is to give you streamlined steps for setting up your video hardware for X, and desktop environments such as GNOME.
== Introduction ==


{{Note|Editors: Keep this page relatively simple, and link to dedicated pages for more exhaustive coverage of a particular video driver. These instructions are intended to get users set up as quickly and simply as possible, without having to wade through lots of minute details.}}
GPT, which stands for GUID Partition Table, is a disk partitioning scheme that was introduced by Intel for Itanium architecture systems, as part of EFI, the Extensible Firmware Interface. While you are probably not using an Itanium architecture computer, and you are likely using a BIOS-based rather than an EFI-based system, you still may want to use GPT partitioning. Why? Because the standard MBR-based partitioning scheme only supports system disks that are less than 2TiB in size. On modern systems, especially systems with hardware RAID logical volumes, it is very easy to go beyond the 2TiB limit. GUID partition tables support disks that are larger than 2TiB in size.


== Video Drivers ==
=== GPT Technology Overview ===


first determine which video card you have and which driver it requires.
This section contains a technical overview of GPT technology.


<console>###i## lspci -k</console>
GUID partition tables support up to 512 partitions. GPT data structures are stored in the first sectors of the drive with a secondary copy stored at the end of the drive. This allows the partitioning scheme of your disk to be recovered in situations where the primary partition table has been corrupted.


=== Intel ===
For compatibility with legacy partitioning tools, GPT partitioning tools typically rewrite the MBR partition table (generally located in the first sector of the disk) in a way those tools will interpret it like ''"This disk has only one partition (of an unknown type) covering the whole disk".''
Add or Edit the <code>VIDEO_CARDS</code> global variable in <code>/etc/make.conf</code> to the value in the following table appropriate for the Intel graphics hardware.
 
* '''NEED TABLE''': available drivers, hardware gen, VIDEO_CARDS variable
It is possible to convert an existing MBR-partitioned disk to GPT format using the <tt>gdisk</tt> command. Please carefully read the <tt>gdisk</tt> man page before using this capability, as it is potentially dangerous, particularly if you are performing it on your boot disk.
gen 1&2:
 
{{file|name=/etc/portage/make.conf|lang=|desc=set video global variable|body=
{{ fancyimportant|Funtoo Linux fully supports GPT on x86-32bit and x86-64-bit systems. GPT is supported on SPARC systems, but currently only for non-boot disks.
VIDEO_CARDS="intel"
}}
}}
gen 3
{{file|name=/etc/portage/make.conf|lang=|desc=set video global variable|body=
VIDEO_CARDS="intel i915"
}}
gen 4+
{{file|name=/etc/portage/make.conf|lang=|desc=set video global variable|body=
VIDEO_CARDS="intel i965"
}}
* custom kernel menuconfig settings


=== AMD/ATI ===
=== Booting GPT ===
Users can choose between free ({{Package|x11-drivers/xf86-video-ati}}) and proprietary ({{Package|x11-drivers/ati-drivers}}) video drivers. The free drivers are recommended as the proprietary drivers are not currently maintained very well by AMD.
 
If you decide to use a GPT-based partitioning scheme for your system disk, either out of necessity due to a 2TiB+ disk, or because you want to try GPT out, then the question arises -- how do you get the darn thing to boot? This is where the new <tt>GRUB</tt> boot loader comes in. The new <tt>GRUB</tt> (version 1.9x, found at <tt>sys-boot/grub</tt>) is a redesign of the original <tt>GRUB</tt> (version 0.9x, now called <tt>sys-boot/grub-legacy</tt> in Funtoo) boot-loader that includes very mature support for booting from GPT-based disks.
 
Now, let's take a look at how to get GPT-based booting working under Funtoo Linux.
 
== Getting Started ==
 
The first thing you'll need to do is to use a LiveCD. I recommend [http://www.sysresccd.org/Main_Page System Rescue CD] for this task as it is Gentoo-based and includes all the proper tools. Go ahead and boot the LiveCD, and then get to the point where you are ready to partition your system disk.
 
At this point, you have two choices as to what partitioning tool to use. You can use either <tt>gdisk</tt> or <tt>parted</tt>. <tt>gdisk</tt> is a very nice <tt>fdisk</tt>-like partitioning tool that supports GPT partitioning. It is rather new software but seems to work quite well. The other tool you can use, GNU <tt>parted</tt>, has been around for a while and is more mature, but is harder to use.
 
We'll take a look at how to create partitions using <tt>gdisk</tt>. Alternatively, <code>cgdisk</code>, curses-based gdisk for users familiar with cfdisk or <code>sgdisk</code>, command-line tool can be used for creating and managing GPT partitions.
 
== Partitioning Using Gdisk ==
 
OK, the first step is using <tt>gdisk</tt> is to start it up, specifying the disk you want to modify:
 
<pre># gdisk /dev/sda</pre>
You should find <tt>gdisk</tt> very familiar to <tt>fdisk</tt>. Here is the partition table we want to end up with:
 
<pre>Command (? for help): p
Disk /dev/sda: 312581808 sectors, 149.1 GiB
Disk identifier (GUID): 17
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 312581774
Total free space is 0 sectors (0 bytes)
 
Number  Start (sector)    End (sector)  Size      Code  Name
  1              34          204833  100.0 MiB  0700  Linux/Windows data
  2          204834          270369  512.0 kiB  EF02  BIOS boot partition
  3          270370        1318945  512.0 MiB  8200  Linux swap
  4        1318946      312581774  148.4 GiB  0700  Linux/Windows data


Add or Edit the VIDEO_CARDS global variable in <code>/etc/make.conf</code> to the value in the following table appropriate for the AMD/ATI graphics hardware.
Command (? for help): </pre>
* '''NEED TABLE''': available drivers, hardware gen, required VIDEO_CARDS variable
Above, you'll see that we have a 100 MiB boot partition, a 512 kiB &quot;BIOS boot partition&quot;, 512 MiB of swap, and the remaining disk used by a 148.4 GiB root partition.
Open source drivers:
{{file|name=/etc/portage/make.conf|lang=|desc=set video global variable|body=
VIDEO_CARDS="radeon"
}}


Closed source drivers:
The one new thing here is the &quot;BIOS boot partition.&quot; What is it? In GRUB-speak, this BIOS boot partition is basically the location of the meat of GRUB's boot loading code - the quivalent of the <tt>stage1_5</tt> and <tt>stage2</tt> files in legacy GRUB. Since GPT-based partition tables have less &quot;bonus&quot; space than their MBR equivalents, and explicit partition of code <tt>EF02</tt> is required to hold the guts of the boot loader.
{{file|name=/etc/portage/make.conf|lang=|desc=set video global variable|body=
VIDEO_CARDS="fglrx"
}}


* custom kernel menuconfig settings
In all other respects, the partition table is similar to that of an MBR-based disk. We have a boot and root partition with code <tt>0700</tt>, and a Linux swap partition with code <tt>8200</tt>. One this partition table has been written to disk and appropriate <tt>mkfs</tt> and <tt>mkswap</tt> commands are issued, <tt>/dev/sda1</tt> will be used to hold <tt>/boot</tt>, <tt>/dev/sda2</tt> will be used by the new GRUB directly, <tt>/dev/sda3</tt> will house our swap and <tt>/dev/sda4</tt> will hold our root filesystem.


=== Nvidia ===
Go ahead and create filesystems on these partitions, and then mount the root and boot filesystems to <tt>/mnt/gentoo</tt> and <tt>/mnt/gentoo/boot</tt> respectively. Now go ahead and unpack a stage3 tarball to <tt>/mnt/gentoo</tt> and chroot in as you normally do.
Users can choose between Open (nouveau) and Closed-Source (nvidia) video drivers. Add or Edit the VIDEO_CARDS global variable in /etc/portage/make.conf to the value in the following table appropriate for the Nvidia graphics hardware.
* '''NEED TABLE''': nouveau + nvidia-drivers versions, hardware gen, required VIDEO_CARDS variable
Open source drivers:
{{file|name=/etc/portage/make.conf|lang=|desc=set video global variable|body=
VIDEO_CARDS="nouveau"
}}
Closed source [[Package:NVIDIA_Linux_Display_Drivers | drivers]]:
{{file|name=/etc/portage/make.conf|lang=|desc=set video global variable|body=
VIDEO_CARDS="nvidia"
}}
* custom kernel menuconfig settings
different settings for nouveau and nvidia


=== Other ===
== Configuring The Kernel ==
==== Multiple Cards (Hybrid Graphics) ====
recommended make.conf VIDEO_CARDS
Hybrid intel/ati:
{{file|name=/etc/portage/make.conf|lang=|desc=set video global variable|body=
VIDEO_CARDS="fglrx intel"
}}


==== Virtual Machine Guests ====
Your kernel will need a couple of extra GPT-related options enabled in order for it to make sense of your GPT partitions and find your filesystems. These options can be found under <tt>Enable the block layer ---&gt; Partition Types</tt>:
(details?)
These settings are used by Parallels VM's and presumably others
{{file|name=/etc/portage/make.conf|lang=|desc=set video global variable|body=
VIDEO_CARDS="vesa vga"
}}


==== Raspberry Pi ====
<pre>[*] Advanced Partition Selection (PARTITION_ADVANCED)
(details?)
[*] EFI GUID Partition Support (EFI_PARTITION)</pre>
If you are using a non-Funtoo distribution then you may need to append a proper <tt>rootfstype=</tt> option to your kernel boot options to allow Linux to properly mount the root filesystem when <tt>Advanced Partition Selection</tt> is enabled. [[Boot-Update]] does this for you automatically.


== Install ==
Now just go ahead and compile and install your kernel, and copy it to <tt>/boot/bzImage</tt>.
once your video cards variable is set in make.conf merge changes into your system


<console>###i## emerge -avuND world</console>
== Booting The System ==


eselect profile?
To get the system booted, you will want to first edit <tt>/etc/fstab</tt> inside the chroot so that it reflects the partitions and filesystems you just created. Then, emerge <tt>boot-update</tt> version 1.4_beta2 or later:


==Configure X.org==
<pre># emerge boot-update</pre>
===Intel===
[[Boot-Update]] is a front-end for the GRUB 1.9x boot loader and provides a necessary simplified configuration interface. <tt>boot-update</tt> is used to generate boot loader configuration files. But before we get to <tt>boot-update</tt>, we first need to install GRUB to your hard disk. This is done as follows:
?
===Nvidia===
nvidia-xconfig, etc.


===AMD/ATI===
<pre># grub-install /dev/sda</pre>
aticonfig, etc.
<tt>grub-install</tt> will detect and use <tt>/dev/sda2</tt> and use it to store its boot loader logic.
<console># ##i##aticonfig --initial --input=/etc/X11/xorg.conf</console>


==Configure framebuffer==
Now it's time to create an <tt>/etc/boot.conf</tt> file. For more information on all available options, consult the [[Boot-Update]] guide -- I'll show you a sample configuration for the sample GPT partition scheme above:
What to put in boot.conf etc. Assumes that the kernel is correctly configured.
===Intel===
?
===Nvidia===
* settings for nouveau
* settings for nvidia-drivers
* How to use sys-apps/v86d
===AMD/ATI===
* settings for fglxr
* settings for radeon, etc.


==Finalise and test==
<pre>boot {
* eselect opengl
        generate grub
{{note|change the number of card eselected to match the card of your system}}
        default bzImage
<console>###i## eselect opengl list
}
###i## eselect opengl set 1</console>
* eselect opencl
{{note|some setups can make use of opencl}}
<console>###i##eselect opencl list
###i##eselect opencl set 1</console>
* reboot/test process


==Tips and Tricks==
&quot;Funtoo Linux&quot; {
        kernel bzImage
}</pre>
Once <tt>/etc/boot.conf</tt> has been created, then type:


===compressed video playback===
<pre># boot-update</pre>
This will auto-generate a <tt>/boot/grub/grub.cfg</tt> file for you, and you will now be able to reboot into Funtoo Linux using a GPT partitioning scheme.


* VDPAU, VA-API
For more information on all the options available for <tt>/etc/boot.conf</tt>, please consult the [[Boot-Update]] guide.
* how to set up mplayer, etc.


==Troubleshooting==
[[Category:Articles]]
* what to do if only a blank screen
* nvidia-drivers users updating media-libs/mesa

Revision as of 18:07, January 11, 2015

Introduction

GPT, which stands for GUID Partition Table, is a disk partitioning scheme that was introduced by Intel for Itanium architecture systems, as part of EFI, the Extensible Firmware Interface. While you are probably not using an Itanium architecture computer, and you are likely using a BIOS-based rather than an EFI-based system, you still may want to use GPT partitioning. Why? Because the standard MBR-based partitioning scheme only supports system disks that are less than 2TiB in size. On modern systems, especially systems with hardware RAID logical volumes, it is very easy to go beyond the 2TiB limit. GUID partition tables support disks that are larger than 2TiB in size.

GPT Technology Overview

This section contains a technical overview of GPT technology.

GUID partition tables support up to 512 partitions. GPT data structures are stored in the first sectors of the drive with a secondary copy stored at the end of the drive. This allows the partitioning scheme of your disk to be recovered in situations where the primary partition table has been corrupted.

For compatibility with legacy partitioning tools, GPT partitioning tools typically rewrite the MBR partition table (generally located in the first sector of the disk) in a way those tools will interpret it like "This disk has only one partition (of an unknown type) covering the whole disk".

It is possible to convert an existing MBR-partitioned disk to GPT format using the gdisk command. Please carefully read the gdisk man page before using this capability, as it is potentially dangerous, particularly if you are performing it on your boot disk.

   Important

Funtoo Linux fully supports GPT on x86-32bit and x86-64-bit systems. GPT is supported on SPARC systems, but currently only for non-boot disks.

Booting GPT

If you decide to use a GPT-based partitioning scheme for your system disk, either out of necessity due to a 2TiB+ disk, or because you want to try GPT out, then the question arises -- how do you get the darn thing to boot? This is where the new GRUB boot loader comes in. The new GRUB (version 1.9x, found at sys-boot/grub) is a redesign of the original GRUB (version 0.9x, now called sys-boot/grub-legacy in Funtoo) boot-loader that includes very mature support for booting from GPT-based disks.

Now, let's take a look at how to get GPT-based booting working under Funtoo Linux.

Getting Started

The first thing you'll need to do is to use a LiveCD. I recommend System Rescue CD for this task as it is Gentoo-based and includes all the proper tools. Go ahead and boot the LiveCD, and then get to the point where you are ready to partition your system disk.

At this point, you have two choices as to what partitioning tool to use. You can use either gdisk or parted. gdisk is a very nice fdisk-like partitioning tool that supports GPT partitioning. It is rather new software but seems to work quite well. The other tool you can use, GNU parted, has been around for a while and is more mature, but is harder to use.

We'll take a look at how to create partitions using gdisk. Alternatively, cgdisk, curses-based gdisk for users familiar with cfdisk or sgdisk, command-line tool can be used for creating and managing GPT partitions.

Partitioning Using Gdisk

OK, the first step is using gdisk is to start it up, specifying the disk you want to modify:

# gdisk /dev/sda

You should find gdisk very familiar to fdisk. Here is the partition table we want to end up with:

Command (? for help): p
Disk /dev/sda: 312581808 sectors, 149.1 GiB
Disk identifier (GUID): 17
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 312581774
Total free space is 0 sectors (0 bytes)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              34          204833   100.0 MiB   0700  Linux/Windows data
   2          204834          270369   512.0 kiB   EF02  BIOS boot partition
   3          270370         1318945   512.0 MiB   8200  Linux swap
   4         1318946       312581774   148.4 GiB   0700  Linux/Windows data

Command (? for help): 

Above, you'll see that we have a 100 MiB boot partition, a 512 kiB "BIOS boot partition", 512 MiB of swap, and the remaining disk used by a 148.4 GiB root partition.

The one new thing here is the "BIOS boot partition." What is it? In GRUB-speak, this BIOS boot partition is basically the location of the meat of GRUB's boot loading code - the quivalent of the stage1_5 and stage2 files in legacy GRUB. Since GPT-based partition tables have less "bonus" space than their MBR equivalents, and explicit partition of code EF02 is required to hold the guts of the boot loader.

In all other respects, the partition table is similar to that of an MBR-based disk. We have a boot and root partition with code 0700, and a Linux swap partition with code 8200. One this partition table has been written to disk and appropriate mkfs and mkswap commands are issued, /dev/sda1 will be used to hold /boot, /dev/sda2 will be used by the new GRUB directly, /dev/sda3 will house our swap and /dev/sda4 will hold our root filesystem.

Go ahead and create filesystems on these partitions, and then mount the root and boot filesystems to /mnt/gentoo and /mnt/gentoo/boot respectively. Now go ahead and unpack a stage3 tarball to /mnt/gentoo and chroot in as you normally do.

Configuring The Kernel

Your kernel will need a couple of extra GPT-related options enabled in order for it to make sense of your GPT partitions and find your filesystems. These options can be found under Enable the block layer ---> Partition Types:

[*] Advanced Partition Selection (PARTITION_ADVANCED)
[*] EFI GUID Partition Support (EFI_PARTITION)

If you are using a non-Funtoo distribution then you may need to append a proper rootfstype= option to your kernel boot options to allow Linux to properly mount the root filesystem when Advanced Partition Selection is enabled. Boot-Update does this for you automatically.

Now just go ahead and compile and install your kernel, and copy it to /boot/bzImage.

Booting The System

To get the system booted, you will want to first edit /etc/fstab inside the chroot so that it reflects the partitions and filesystems you just created. Then, emerge boot-update version 1.4_beta2 or later:

# emerge boot-update

Boot-Update is a front-end for the GRUB 1.9x boot loader and provides a necessary simplified configuration interface. boot-update is used to generate boot loader configuration files. But before we get to boot-update, we first need to install GRUB to your hard disk. This is done as follows:

# grub-install /dev/sda

grub-install will detect and use /dev/sda2 and use it to store its boot loader logic.

Now it's time to create an /etc/boot.conf file. For more information on all available options, consult the Boot-Update guide -- I'll show you a sample configuration for the sample GPT partition scheme above:

boot {
        generate grub
        default bzImage
}

"Funtoo Linux" {
        kernel bzImage
}

Once /etc/boot.conf has been created, then type:

# boot-update

This will auto-generate a /boot/grub/grub.cfg file for you, and you will now be able to reboot into Funtoo Linux using a GPT partitioning scheme.

For more information on all the options available for /etc/boot.conf, please consult the Boot-Update guide.