Difference between pages "Package:Awesome (Window Manager)" and "Install/BootLoader"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
(Updated the USE flags table. If someone could advise on the "recommended nature" of the dbus and doc flags, that would be great.)
 
 
Line 1: Line 1:
{{Ebuild
<noinclude>
|Summary=A dynamic floating and tiling window manager.
{{InstallPart|boot loader configuration}}
|CatPkg=x11-wm/awesome
</noinclude>
|Maintainer=
=== Installing a Bootloader ===
|Homepage=http://awesome.naquadah.org/
 
}}
These install instructions show you how to use GRUB to boot using BIOS (old-school) or UEFI (new-school).
 
==== Old School (BIOS) ====
 
If you're using the BIOS to boot, setting up GRUB, the bootloader, is pretty easy.
 
To use this recommended boot method, first emerge <code>boot-update</code>. This will also cause <code>grub-2</code> to be merged, since it is a dependency of <code>boot-update</code>.
 
<console>
(chroot) # ##i##emerge boot-update
</console>
 
Then, edit <code>/etc/boot.conf</code> and specify "<code>Funtoo Linux genkernel</code>" as the <code>default</code> setting at the top of the file, replacing <code>"Funtoo Linux"</code>.  
 
<code>/etc/boot.conf</code> should now look like this:


== About Awesome ==
<pre>
boot {
generate grub
default "Funtoo Linux genkernel"
timeout 3
}


Awesome is a highly configurable window manager distributed under GPL-2 license. It handles both '''tiling and floating''' layouts. You can go into a '''fine-grained customization''' to suit your needs with '''Lua scripting'''. As a window manager, awesome is an ideal choice if you plan to ''get rid of your mouse''.
"Funtoo Linux" {
kernel bzImage[-v]
}


=== Vocabulary ===
"Funtoo Linux genkernel" {
kernel kernel[-v]
initrd initramfs[-v]
params += real_root=auto
}


;Screen: A physical monitor plugged into your computer.
"Funtoo Linux better-initramfs" {
;Client: A window.
kernel vmlinuz[-v]
;Tag: A tag is something like a workspace or a desktop that you may find in other window managers. However, it is slightly more flexible as you can attach a ''client'' to multiple tags. Moreover, each ''screen'' has its own range of tags.
initrd /initramfs.cpio.gz
;Layout: A layout is a way to arrange your ''clients'' in the current tag (eg. floating, horizontaly tiled, verticaly tiled, focused client full-screen, ...)
}
;Widget: A widget is a box that can contain text, images or more advanced objects. It enables you to add pieces of information in the status bar (at the top-right of each ''screen'') such as the time, the volume level or your battery load. You can also add widgets in the title bar of a ''client''.
</pre>


== USE flags ==
Please read <code>man boot.conf</code> for further details.


{| class="wikitable" style="margin: 1em auto;" width=80%
===== Running grub-install and boot-update =====
! width="20%" | Use flag
! width="10%" | Default
! width="10%" | Recommended
! width="60%" | Description
|-
| style="text-align: center;" | dbus
| style="text-align: center;" | Yes
| style="text-align: center;" |
| style="text-align: center;" | Enables awesome to receive signals from [[Dbus|dbus]] (eg. to trigger events on hotplug)
|-
| style="text-align: center;" | doc
| style="text-align: center;" | No
| style="text-align: center;" |
| style="text-align: center;" | Includes extra HTML documentation (using doxygen)
|-
| style="text-align: center;" | gnome
| style="text-align: center;" | No
| style="text-align: center; background-color: yellow;" | If you want to run Awesome in GNOME, yes. Otherwise, probably not.
| style="text-align: center;" | Enables you to use awesome as gnome's window manager (See. [http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome Quickly Setting up Awesome with Gnome])
|}


== Installation ==
Finally, we will need to actually install the GRUB boot loader to your disk, and also run <code>boot-update</code> which will generate your boot loader configuration file:


Just emerge it:
<console>
(chroot) # ##i##grub-install --no-floppy /dev/sda
(chroot) # ##i##boot-update
</console>


Now you need to update your boot loader configuration file:
<console>
<console>
###i## emerge -a awesome
(chroot) # ##i##boot-update
</console>
</console>
You only need to run <code>grub-install</code> when you first install Funtoo Linux, but you need to re-run <code>boot-update</code> every time you modify your <code>/etc/boot.conf</code> file, so your changes are applied on next boot.
==== New School (UEFI) ====
If you're using UEFI to boot, setting up the boot loader is a bit more complicated for now, but this process will be improving soon. Perform the following steps.
===== Emerging GRUB =====
You will still use GRUB as a boot loader, but before emerging grub, you will need to enable EFI booting. To do this,
add the following line to <code>/etc/make.conf</code>:


Then you can add this line to your <code>~/.xinitrc</code>:
<pre>


{{file|name=~/.xinitrc|body=
For 64-bit systems:
exec ck-launch-session dbus-launch --sh-syntax --exit-with-session awesome
}}


And run <code>xinit</code> to launch awesome. You can also configure a display manager instead, but this is not covered in this document.
GRUB_PLATFORMS="efi-64"


== Getting Started ==
For 32-bit systems, i.e. Intel Atom devices and systems with less than 4GB of RAM:


So, you should see a nice awesome background and a top bar which includes your tags on the left (from 1 to 9), the status bar (containing a clock widget) on the right and, on the very left, an icon representing the current layout.
GRUB_PLATFORMS="efi-32"


You can switch against tags by typing <code>Mod4 + [1..9]</code> or <code>Mod4 + Left/Right</code>. Where Mod4 is the "Super" key and [1..9] any digit from 1 to 9. Mod4 is the default modifier for awesome key bindings, yet you can configure another one (See [[#Configuration]]).
</pre>


To run a program, hit <code>Mod4 + r</code>. You will be prompted for a command to run (on the top left corner, next to the tags list). Open some clients (3 or 4) and hit <code>Mod4 + Space</code>. This will switch to the next layout. Go ahead and try available layouts (notice the layout icon on the top right corner). You can also switch to the previous layout by hitting <code>Mod4 + Shift + Space</code>. To understand how each layout is arranged, you might want to add some more clients to the current tag. You can also toggle full screen for the current focused client with <code>Mod4 + f</code>.
Then, <code>emerge boot-update</code>. You will notice <code>grub</code> and <code>efibootmgr</code> getting pulled in as dependencies. This is expected and good:


Here is some other interesting key bindings:
<console>
(chroot) # ##i##emerge boot-update
</console>


* <code>Mod4 + h/l</code>: Resize clients (this will not work on some layouts)
===== Installing GRUB =====
* <code>Mod4 + Ctrl + r</code>: Restart awesome (useful when you want to test the configuration file you just edited)
* <code>Mod4 + Shift + q</code>: Quit awesome (note that this will not exit your display manager if ever you have one)


There's plenty of other key bindings. We will see them, how to change them and how to create your own in the next section.
Now, for the magic of getting everything in place for booting. You should copy your kernel and initramfs (if you have one -- you will if you are following the default install) to <tt>/boot</tt>. GRUB will boot those. But how do we get UEFI to boot GRUB? Well, we need to run the following command (for 32bit simply set it as i386-efi):


== Configuration ==
<console>
(chroot) # ##i##grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="Funtoo Linux [GRUB]" --recheck /dev/sda
</console>
This command will simply install all the stuff to <tt>/boot/EFI</tt> and <tt>/boot/grub</tt> that your system needs to boot. In particular, the <tt>/boot/EFI/grub/grubx64.efi</tt> file will be created. This is the GRUB boot image that UEFI will load and start.


Awesome user configuration files are located in <code>~/.config/awesome/</code>. For now, a single file called <code>rc.lua</code> should lie in this directory. It contains the default configuration (including widgets, tags, key bindings, ...). Note that if you don't know Lua, you can still proceed some customization. As far as I'm concerned, I only had to learn Lua basics when I started to create my own widgets.
A more detailed explanation of the flags used in the above command:
* <code>--target=x86_64-efi</code>: Tells GRUB that we want to install it in a way that allows it to boot in UEFI
* <code>--efi-directory=/boot</code>: All GRUB UEFI files will be installed in ''/boot''
* <code>--bootloader-id="Funtoo Linux [GRUB]"</code>: This flag is not necessary for GRUB to boot. However, it allows you to change the text of the boot option in the UEFI BIOS. The stuff in the quotes can be set to anything that you would like.
* <code>--recheck</code>: If a device map already exists on the disk or partition that GRUB is being installed on, it will be removed.
* <code>/dev/sda</code>:The device that we are installing GRUB on.


{{fancynote|The system-wide configuration files are located in <code>/etc/xdg/awesome/</code>.}}
===== Configuring GRUB =====


So, the first thing you might want to do is editing the default terminal (run when you hit <code>Mod4 + Return</code>). You can also change the fallback editor, but awesome uses <code>$EDITOR</code> to find your favorite one. This can be done on these lines:
OK, now UEFI has the GRUB image it needs to boot. But we still need to configure GRUB itself so it finds and boots your kernel and initramfs. This is done by performing the following steps. Since boot-update doesn't yet support UEFI, we will use boot-update, but then edit our <code>/boot/grub/grub.cfg</code> to support UEFI booting.  
{{file|name=~/.config/awesome/rc.lua|lang=lua|body=
terminal = "xterm"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
}}


For strings, <code>..</code> is the concatenation operator in Lua.
First, you will need to edit <code>/etc/boot.conf</code>. Format this as you would if you were booting without UEFI. If you are not sure how this should look, below is an example of what it could look like if you are booting from an unencrypted ext4 partition:


I think the modkey setting is well-documented enough, so next will be the layouts setting:
{{file|name=/etc/boot.conf|desc=|body=
boot {
        generate grub
        default "Funtoo Linux"
        timeout 3
}


{{file|name=~/.config/awesome/rc.lua|lang=lua|body=
"Funtoo Linux" {
local layouts =
        kernel vmlinuz[-v]
{
        params += rootfstype=ext4 root=/dev/sda2
    awful.layouts.suit.floating,
    awful.layouts.suit.tile,
    awful.layouts.suit.tile.left,
    awful.layouts.suit.tile.bottom,
    awful.layouts.suit.tile.top,
    awful.layouts.suit.fair,
    awful.layouts.suit.fair.horizontal,
    awful.layouts.suit.spiral,
    awful.layouts.suit.spiral.dwindle,
    awful.layouts.suit.max,
    awful.layouts.suit.max.fullscreen,
    awful.layouts.suit.magnifier
}
}
}}
}}


These are the default layouts, but you can download some others and create your own. You probably won't do it now, however you might want to change the order. Personally, I don't like to have the floating layout as the default one.
After you have edited your <code>/etc/boot.conf</code> file, run <code>boot-update</code>. You should now have a <code>/boot/grub/grub.cfg</code> file, which you can edit using the following command:
 
<console>
# ##i##nano /boot/grub/grub.cfg
</console>
 


I won't go further about this file, so I would suggest you to go on browsing this file to fetch interesting settings to change. I think one of the most important section you want to check out is "Key bindings". You will see all existing mappings and what they do. As an example, find the following lines at the beginning of the "{{{ Key bindings" section:
To get your <code>/boot/grub/grub.cfg</code> to support booting with UEFI, make the following changes. Below the existing insmod lines, add the following lines.  Both of these involve adding support for the UEFI framebuffer to GRUB.:


{{file|name=~/.config/awesome/rc.lua|lang=lua|body=
<pre>
    awful.key({modkey,          },  "j",
  insmod efi_gop
        function()
  insmod efi_uga
            awful.client.focus.byidx( 1)
</pre>
            if client.focus then client.focus:raise() end
        end),
    awful.key({modkey,          },  "k",
        function()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),
}}


This enables you to move the focus across the clients in this tag. You may be used to <code>Alt + Tab</code> and <code>Alt + Shift + Tab</code> for that. So why wouldn't you change it to suit what you are used to ?
Then, change the <code>set gfxpayload</code> line to read as follows. UEFI does not support text mode, so we will keep video initialized to the current resolution.:


{{file|name=~/.config/awesome/rc.lua|lang=lua|body=
<pre>
    awful.key({"Mod1", "Shift"   },  "Tab", -- Notice the "Mod1" for Alt key instead of modkey (="Mod4")
   set gfxpayload=keep
        function()
</pre>
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({"Mod1", "Shift"  },  "Tab",
        function()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),
}}


{{EbuildFooter}}
You can now save your changes by pressing <code>Control-X</code> and answering <code>y</code> when asked if you want to save the modified buffer. When prompted for a filename, hit Enter to use the existing filename.

Revision as of 07:36, January 1, 2015


   Note

This is a template that is used as part of the Installation instructions which covers: boot loader configuration. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.


Installing a Bootloader

These install instructions show you how to use GRUB to boot using BIOS (old-school) or UEFI (new-school).

Old School (BIOS)

If you're using the BIOS to boot, setting up GRUB, the bootloader, is pretty easy.

To use this recommended boot method, first emerge boot-update. This will also cause grub-2 to be merged, since it is a dependency of boot-update.

(chroot) # emerge boot-update

Then, edit /etc/boot.conf and specify "Funtoo Linux genkernel" as the default setting at the top of the file, replacing "Funtoo Linux".

/etc/boot.conf should now look like this:

boot {
	generate grub
	default "Funtoo Linux genkernel" 
	timeout 3 
}

"Funtoo Linux" {
	kernel bzImage[-v]
}

"Funtoo Linux genkernel" {
	kernel kernel[-v]
	initrd initramfs[-v]
	params += real_root=auto 
} 

"Funtoo Linux better-initramfs" {
	kernel vmlinuz[-v]
	initrd /initramfs.cpio.gz
}

Please read man boot.conf for further details.

Running grub-install and boot-update

Finally, we will need to actually install the GRUB boot loader to your disk, and also run boot-update which will generate your boot loader configuration file:

(chroot) # grub-install --no-floppy /dev/sda
(chroot) # boot-update

Now you need to update your boot loader configuration file:

(chroot) # boot-update

You only need to run grub-install when you first install Funtoo Linux, but you need to re-run boot-update every time you modify your /etc/boot.conf file, so your changes are applied on next boot.

New School (UEFI)

If you're using UEFI to boot, setting up the boot loader is a bit more complicated for now, but this process will be improving soon. Perform the following steps.

Emerging GRUB

You will still use GRUB as a boot loader, but before emerging grub, you will need to enable EFI booting. To do this, add the following line to /etc/make.conf:


For 64-bit systems:

GRUB_PLATFORMS="efi-64"

For 32-bit systems, i.e. Intel Atom devices and systems with less than 4GB of RAM:

GRUB_PLATFORMS="efi-32"

Then, emerge boot-update. You will notice grub and efibootmgr getting pulled in as dependencies. This is expected and good:

(chroot) # emerge boot-update
Installing GRUB

Now, for the magic of getting everything in place for booting. You should copy your kernel and initramfs (if you have one -- you will if you are following the default install) to /boot. GRUB will boot those. But how do we get UEFI to boot GRUB? Well, we need to run the following command (for 32bit simply set it as i386-efi):

(chroot) # grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="Funtoo Linux [GRUB]" --recheck /dev/sda

This command will simply install all the stuff to /boot/EFI and /boot/grub that your system needs to boot. In particular, the /boot/EFI/grub/grubx64.efi file will be created. This is the GRUB boot image that UEFI will load and start.

A more detailed explanation of the flags used in the above command:

  • --target=x86_64-efi: Tells GRUB that we want to install it in a way that allows it to boot in UEFI
  • --efi-directory=/boot: All GRUB UEFI files will be installed in /boot
  • --bootloader-id="Funtoo Linux [GRUB]": This flag is not necessary for GRUB to boot. However, it allows you to change the text of the boot option in the UEFI BIOS. The stuff in the quotes can be set to anything that you would like.
  • --recheck: If a device map already exists on the disk or partition that GRUB is being installed on, it will be removed.
  • /dev/sda:The device that we are installing GRUB on.
Configuring GRUB

OK, now UEFI has the GRUB image it needs to boot. But we still need to configure GRUB itself so it finds and boots your kernel and initramfs. This is done by performing the following steps. Since boot-update doesn't yet support UEFI, we will use boot-update, but then edit our /boot/grub/grub.cfg to support UEFI booting.

First, you will need to edit /etc/boot.conf. Format this as you would if you were booting without UEFI. If you are not sure how this should look, below is an example of what it could look like if you are booting from an unencrypted ext4 partition:

   /etc/boot.conf
boot {
        generate grub
        default "Funtoo Linux"
        timeout 3
}

"Funtoo Linux" {
        kernel vmlinuz[-v]
        params += rootfstype=ext4 root=/dev/sda2
}

After you have edited your /etc/boot.conf file, run boot-update. You should now have a /boot/grub/grub.cfg file, which you can edit using the following command:

root # nano /boot/grub/grub.cfg


To get your /boot/grub/grub.cfg to support booting with UEFI, make the following changes. Below the existing insmod lines, add the following lines. Both of these involve adding support for the UEFI framebuffer to GRUB.:

  insmod efi_gop
  insmod efi_uga

Then, change the set gfxpayload line to read as follows. UEFI does not support text mode, so we will keep video initialized to the current resolution.:

  set gfxpayload=keep

You can now save your changes by pressing Control-X and answering y when asked if you want to save the modified buffer. When prompted for a filename, hit Enter to use the existing filename.