Difference between pages "Bluetooth made easy" and "Funtoo Linux Kernels/pt-br"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
(→‎Custom Tips: yet more cool updating to modern day)
 
 
Line 1: Line 1:
== Kernel Support ==
== Overview of Kernels ==
You must have bluetooth support in your kernel if you are going to use bluetooth. Enable the following in your kernel config:
 
=== {{Package|sys-kernel/vanilla-sources}} ===
 
esse vai instalar os fontes do kernel Linux "vanilla" (não modificado). A versão atual recomendada é a 3.x. Funtoo Linux que tem suporte totalmente ao Linux 3.x. As vantagens desse kernel incluem melhoramentos recentes ao [[Pt-br/Linux_Containers|Linux Containers]], uma pilha de rede atual (networking stack) com muitas correções de bug, e alta confiabilidade para desktops e servidores. O lado negativo é que esse kernel deve ser configurado manualmente pelo usuário e não possui built-in ''<code>genkernel</code>'' suporte via a flag USE ''<code>binary</code>'' desta vez.
 
=== {{Package|sys-kernel/gentoo-sources}} ===
 
Esse kernel tree é baseado nos kernels stable do [https://www.kernel.org/ kernel.org] com genpatches aplicados [http://dev.gentoo.org/~mpagano/genpatches/about.htm genpatches].
o Gentoo patchset visa ter suporte à toda variedade de arquiteturas suportadas pelo Gentoo. A lista de genpatched kernels disponíveis: [http://dev.gentoo.org/~mpagano/genpatches/kernels.htm genpatches-kernels]
 
=== {{Package|sys-kernel/openvz-rhel6-stable}} ===
 
Esse é um kernel baseado no RHEL6 com suporte a OpenVZ. Esse é agora o kernel preferido para desenvolvimento de produção OpenVZ (production OpenVZ deployments). Ele requer gcc-4.4.5 para ser construído, que vai usará automaticamente sem que o usuário precise utilizar ''<code>gcc-config</code>''. Utilizamos essa versão de gcc desde que essa é a versão de gcc utilizada pela Red Hat para construir esse kernel.
 
=== {{Package|sys-kernel/debian-sources}} ===
 
Esse é o kernel do Debian. '''Esses ebuilds agora possuem suporte a flag USE ''<code>binary</code>''.''' Daniel adicionou comando especial <tt>config-extract</tt> que pode ser utilizado para listar todas as configurações disponíveis do kernel oficial do Debian, e gerá-las a partir dos arquivos do Debian inclusos com o kernel. Esse kernel tem suporte opcional a [[OpenVZ]], mas é bem melhor utilizar o <tt>openvz-rhel6-stable</tt> se quiser um instalação OpenVZ com qualidade de produção (production-quality OpenVZ). Para mais informações sobre como utilizar <tt>debian-sources</tt> e <tt>config-extract</tt>, veja [[#Using Debian-Sources with Genkernel|Utilizando debian-sources com o Genkernel]] abaixo.
 
== Binary USE ==
 
Muitos dos kernel ebuilds no Funtoo Linux possuem suporte à flag USE <code>binary</code> muito útil. Ao habilitar essa flag USE e emergir o kernel, o ebuild construirá automaticamente uma imagem binária do kernel, o initramfs e módulos do kernel e instalá-los em <code>/boot</code>. A imagem binária do kernel e do initramfs pode ser utilizadas para inicializar seu sistema Funtoo Linux sem necessidade qualquer configuração adicional. Esse é um ótimo jeito de obter um sistema Funtoo Linux no ar e em execução rapidamente. Aqui está como fazer isso:
 
<console>
<console>
##i##Networking support →
###i## echo "sys-kernel/openvz-rhel6-stable binary" >> /etc/portage/package.use
  ##i##Bluetooth subsystem support →
###i## emerge openvz-rhel6-stable
  <m> RFCOMM protocol support
###i## nano -w /etc/boot.conf
    <y> RFCOMM tty support
###i## boot-update
  <m> BNEP protocol support
    <y> Multicast filter support
    <y> Protocol filter support
  <m> HIDP protocol support
</console>
</console>
I find no difference in choosing built-in modules vs. loading modules with the exception that someday you may wish to use out-of-tree drivers directly from wireless.kernel.org.  Just adding all the modules guarantees you can do anything bluetooth in the future, not worth worrying about saving a tiny bit of space.


Also be sure and select your bluetooth device driver:
Mais informações podem ser encontradas no Guia de [[Funtoo_Linux_Installation|Instalação do Funtoo Linux]].
 
== Funtoo Linux Genkernel ==
 
O Funtoo Linux contem uma versão forked/enhanced do genkernel com as novas compatibilidades:
 
* genkernel pode utilizar um diretório build que é separado do diretório kernel source. Isso é habilitado utilizando a nova opção <tt>--build-dst</tt>.
* <code>--build-src</code> é uma nova opção que é equivalente a opção <tt>--kerneldir</tt>.
* <code>--fullname</code> pode ser utilizado para especificar o nome inteiro das imagens do kernel e do initramfs -- Tudo depois <tt>kernel-</tt> e de  <tt>initramfs-</tt>.
* <code>--firmware-src</code> - uma nova opção que funciona identic ao <tt>--firmware-dir</tt>.
* <code>--firmware-dst</code> - uma nova compatibilidade - você pode agora definir onde o genkernel instala o firmware.
* Genkernel utiliza o Funtoo Linux <code>lvm2</code> ao invés de construir o seu próprio.
* Algumas correções de compilação.
 
== Estabilidade do Kernel e visão geral da estabilidade ==
 
{{Fancywarning|'''SPARC64''': Todos os kernels além das séries 3.9 e antes do 3.14-rc8 estão sujeitos a um [http://www.spinics.net/lists/sparclinux/msg11805.html bug] que abriga o kernel nas máquinas sun4v '''somente'''. Esses últimos são fornecidos com UltraSPARC T1 e mais recentes CPUs (ex. SunFire T1000, SunFire T2000, SunFire T52x0/T54x0 series...), todas as máquinas sun4u (UltraSPARC IV e CPUs antecedentes) não estão sujeitos a esse problema e qualquer versão de kernel funcional. }}
 
{| {{table}}
!Nome do Kernel
!Versão
!USE flags
!Estabilidade
!Recursos Extras
!Req'd udev
!Notas
|-
|<tt>{{Package|sys-kernel/vanilla-sources}}</tt>
|3.17.0
|N/A
|'''Excelente''' - recomendado para desktops e servidores.
|N/A
|Qualquer
|Recomendado para networking stack atuais, hardware e suporte a [[Linux Containers]]. Esse kernel deve ser manualmente configurado pelo usuário. Novos Recursos: [http://kernelnewbies.org/Linux_3.12 kernelnewbies.org/linux_3.12]  Novos Drivers: [http://kernelnewbies.org/Linux_3.12-DriversArch kernelnewbies/Linux_3.12-DriversArch]
|-
|<tt>{{Package|sys-kernel/gentoo-sources}}</tt>
|3.17.0
|N/A
|'''Excelente''' - recomendado para desktops e workstations
|N/A
|Qualquer
|Recomendado para networking stack atuais, hardware e suporte a [[Linux Containers]]. Esse kernel deve ser configurado manualmente pelo usuário. Novos Recursos: [http://kernelnewbies.org/Linux_3.12 kernelnewbies.org/linux_3.12]  Novos Drivers: [http://kernelnewbies.org/Linux_3.12-DriversArch kernelnewbies/Linux_3.12-DriversArch]
|-
|<tt>{{Package|sys-kernel/openvz-rhel6-stable}}</tt>
|2.6.32.042.092.2
|<tt>binary</tt>
|'''Excelente''' - recomendado para servidores de produção
|N/A
|Qualquer
|Esse kernel é construído com o gcc-4.4.5. <tt>emerge broadcom-netxtreme2</tt> para confiável suporte a BCM5709+ (NIC integrado)
 
|-
|<tt>{{Package|sys-kernel/debian-sources}}</tt>
|3.16.2, 3.16.7, 3.19.3
|<tt>openvz</tt>
|''Bom'' - kernel padrão recomendado pelo Funtoo
|OpenVZ (opcional)
|Qualquer
|Veja [[#Using debian-sources with Genkernel]], abaixo.
|-
|}
 
== Utilizando o Debian-Sources com o Genkernel ==
 
{{fancyimportant|Debian-sources está agora totalmente compatível com a flag USE ''binary'' e recomendado para usuários desktop. O exemplo abaixo é válido para instalação manual. Ao menos 12G de ''/var/tmp'' exigido para construir}}
 
Essa seção descreve como construir um kernel binário com ''<code>debian-sources</code>'' e ''<code>genkernel</code>'', e também explica como utilizar a ferramenta ''<code>config-extract</code>'' do  Funtoo Linux para listar e criar configurações do kernel oficial do Debian.
 
=== Primeiro passo: emergir os pacotes necessários ===
 
O primeiro passo é emergir:
 
# O Debian sources
# Genkernel em si
 
Isso é alcançado ao executar o seguinte:
 
<console>
<console>
##i##Networking support →
###i## emerge -av sys-kernel/debian-sources sys-kernel/genkernel
##i##  Bluetooth subsystem support →
##i##   Bluetooth device drivers →
        <m> HCI USB driver
</console>
</console>
Make sure you choose at least the HCI USB driver.  Others may be applicable to your setup too, for example, if you have a Broadcom BCM203x device you'll want the driver for that which loads the appropriate firmware.
 
== Userspace Programs ==
uma vez que o kernel sources do Debian são implantados, você deve encontrar um diretório nomeado '''linux-debian-''versão''''' (ex. linux-debian-2.6.32.30) sob '''<code>/usr/src</code>'''. Atualize seu link simbólico '''<code>linux</code>''' para apontar no seu diretório:
There was a big change in the transition from bluez4 to bluez5, namely support for HandsFree Profile/Headset Profile (HFP/HSP) was dropped. Pulseaudio was supposed to begin supporting those profiles but there was a _____long wait. However, the wait is over and you can now once again use headsets for Skype, Sip, etc.
If you plan to use headsets you'll want to add use changes to pulseaudio, as the default usage profile in the Funtoo tree does not support headsets. headset-native and headset-ofono are needed.  One example would be
<console>
<console>
echo ">=media-sound/pulseaudio-5.99 headset-native headset-ofono">>/etc/portage/package.use
###i## cd /usr/src
###i## rm linux
###i## ln -s linux-debian-2.6.32.30 linux
</console>
</console>
A2DP and other protocols work fine in bluez-5 without help from pulseaudio, so if you don't intend to use headsets the above doesn't apply.


Add “bluetooth” to your USE flags in /etc/portage/make.conf
Alternativamente, emerge o debian-sources com a flag USE ''<code>symlink</code>''.
 
=== Segundo passo: Obter um arquivo de configuração ===
 
É hora de baixar o arquivo de configuração do kernel. Para esse tutorial utilizaremos um arquivo de configuração para o AMD64 (várias outras arquiteturas como MIPS ou SPARC64 estão disponíveis.)  Para visualizar uma lista completa de configurações de kernel disponíveis, digite <code>./config-extract -l</code> ''' no diretório kernel source do Debian''':
 
<pre>
ninja1 linux-debian-2.6.32.30 # ./config-extract -l


And then: emerge -aND @world
====== standard featureset ======


If you need firmware for your bluetooth receiver be sure and get that too.  Sys-kernel/linux-firmware is always a safe bet to have on hand.
      alpha: alpha-generic, alpha-legacy, alpha-smp
      amd64
      armel: iop32x, ixp4xx, kirkwood, orion5x, versatile
        hppa: parisc, parisc-smp, parisc64, parisc64-smp
        i386: 486, 686, 686-bigmem, amd64
        ia64: itanium, mckinley
        m68k: amiga, atari, bvme6000, mac, mvme147, mvme16x
        mips: 4kc-malta, 5kc-malta, r4k-ip22, r5k-ip32, sb1-bcm91250a, sb1a-bcm91480b
      mipsel: 4kc-malta, 5kc-malta, r5k-cobalt, sb1-bcm91250a, sb1a-bcm91480b
    powerpc: powerpc, powerpc-smp, powerpc64
        s390: s390x, s390x-tape
        sh4: sh7751r, sh7785lcr
      sparc: sparc64, sparc64-smp
    sparc64: sparc64, sparc64-smp


Unless you prefer controlling your devices at the command line you'll need either Blueman or Gnome-bluetooth, handy GUI applets, just click on the device you want to control.
====== vserver featureset ======


You'll want to add bluetooth to your startup:
      amd64
<console>
        i386: 686, 686-bigmem
# rc-update add bluetooth default
        ia64: itanium, mckinley
</console>
    powerpc: powerpc, powerpc64
        s390
      sparc
    sparc64


== Usage ==
====== xen featureset ======
While it's rumored that some high-profile Funtoo users refuse to even run X server, for the rest of us a handy GUI can be nice.  However, be aware that all operations can be done from the command line as well.


Pair up your devices, you're ready to go!  With either Blueman or Gnome-bluetooth it's intuitive, they'll steer you in the right direction.  There's a ton of info on the web if for some reason you wish to use the command line rather than a GUI.
      amd64
        i386


== Custom Tips ==
====== openvz featureset ======
{{fancynote|Some of the following requires installation of net-wireless/rfkill, a handy thing to have anyway}}
Bluez-5.x starts with your bluetooth device (receiver) powered off.  For those that would like their bluetooth active on machine start, the following code passing around the web added to /etc/udev/rules.d/10-local.rules is purported to work:
<console>
##i###/etc/udev/rules.d/10-local.rules
##i### Set bluetooth power up
##i##ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"
</console>
However, I suspect the same technique the author has been using for years will work just as well.  I used this back in the days of bluez-4.x which powered on the receiver at startup, by the same token you can start it powered down and then use a hotkey to toggle it.  By adding the following to your /etc/local.d/*.start file:
<console>
##i###/etc/local.d/*.start
##i##rfkill block bluetooth
</console>
Bluez will start with the device powered off.


Or, if you want your device powered on start:
      amd64
<console>
        i386
##i###/etc/local.d/*.start
</pre>
##i##rfkill unblock bluetooth  #UNTESTED!
</console>
/etc/local.d/*.start operates as the root user.  This is convenient, as rfkill requires root to execute.


Your bluetooth device will be physically powered down (no electricity even) when rfkill blocks it.  Most desktop environments, Gnome, KDE, etc. have some way to assign a hotkey to a command.  However, these commands are limited to the unprivileged user.  Since rfkill must be run by root I use the following method.
Digite <tt>config-extract -h</tt> para informações de uso extendidas:


First, we need toggle action, so one hotkey can turn  bluetooth either off or on.  The following code accomplishes that.
I have a /home/<username>/bin directory with many “helper” programs.  In there, create a file owned by root, with chmod 744 permissions called bluetooth.
<console>
##i##$ cd ~
##i##$ mkdir bin
##i##$ cd bin
##i##$ touch bluetooth
##i##$ sudo chown root: bluetooth
##i##$ sudo chmod 744 bluetooth
</console>
Paste the following code into the file with your favorite editor, taking care to change the device name as noted.
<pre>
<pre>
#/home/<username>/bin/bluetooth
ninja1 linux-debian-2.6.32.30 # ./config-extract -h
#keyboard shortcut set to <your choice>, toggles bluetooth on & off
This work is free software.
#this file must be added to sudoers ;)
 
Copyright 2011 Funtoo Technologies. You can redistribute and/or modify it under
the terms of the GNU General Public License version 3 as published by the Free
Software Foundation. Alternatively you may (at your option) use any other
license that has been publicly approved for use with this program by Funtoo
Technologies (or its successors, if any.)
 
usage: config-extract [options] arch [featureset] [subarch]
 
  -h  --help        print this usage and exit
  -l  --list        list all available kernel configurations
  -o  --outfile    specify kernel config outfile --
                    defaults to .config in current directory
  [featureset]      defaults to "none" if not specified
  [subarch]        defaults to the only one available; otherwise required


# we need to find which rfkill applies to bluetooth, there can be one for wifi, one for bluetooth, I have a 3rd , don't even know what it is
This program was written by Daniel Robbins for Funtoo Linux, for the purpose of
easily and conveniently extracting Debian kernel configurations. To see a nice
list of all available kernel configurations, use the --list option.


for file in /sys/class/rfkill/*
Debian's kernel configs are specified internally in arch_featureset_flavor
do
format, such as: "amd64_openvz_amd64". The featureset typically describes an
if [ "$(cat ${file}/name)" = "hp-bluetooth" ]; then  ### you'll have to snoop around in there, rename to what your device is called
optional kernel configuration such as "xen" or "openvz", while the flavor in
BT_STATE=$(cat ${file}/state)
Debian terminology typically refers to the sub-architecture of the CPU.
fi
 
done
When using this command, you must specify an arch. A featureset of "none" is
if [[ ${BT_STATE} -eq 1 ]]; then
assumed unless you specify one, and by default this program will pick the only
rfkill block bluetooth
available subarch if there is only one to choose from. If not, you will need to
BLUETOOTH_STRING=" Bluetooth powered off"
pick one (and the program will remind you to do this.)
DISPLAY_COLOR="red"
 
else
The kernel configuration will be written to ".config" in the current directory,
        rfkill unblock bluetooth
or the location you specified using the -o/--outfile option.
BLUETOOTH_STRING="  Bluetooth powered on"
DISPLAY_COLOR="blue"
fi
# Clean up any running aosd_cat processes
killall aosd_cat &> /dev/null
# Display the desired text
echo "$BLUETOOTH_STRING" | aosd_cat -n "Georgia Italic 120" -u 1000 -o 200 -R $DISPLAY_COLOR -S black -f 0 -e 4 -p 3 -x 300
</pre>
</pre>
As you can see, I also have a display that prints huge colored letters across my screen telling bluetooth status for a few seconds as I enable/disable it.  To have the display you must install x11-libs/libaosd.  That's it, the code in the bluetooth program shows how to use this handy library, you can tweak font size, etc. to your liking.


This one-liner will list out the available rfkill named devices on your computer:
Vamos utilizar <tt>config-extract</tt> para gerar uma configuração de kernel para um sistema amd64:
 
<console>
<console>
for file in /sys/class/rfkill/* ; do echo "$(cat ${file}/name)"; done
# ##i##cd linux
# ##i##./config-extract amd64
Wrote amd64_none_amd64 kernel configuration to /usr/src/linux-debian-2.6.32.30/.config.
</console>
</console>
You may have to snoop around a bit in /sys to find what you're looking for.  The name of your device may be something as simple as hci0.  I actually use /sys/devices/platform/hp-wmi/rfkill/* on my system, but this generic method should work for you.  A static directory usually doesn't work, it's often different on every startup, hence the search code.


Since this program is owned by root, and in fact, rfkill itself must be run as root, simply put the following line in your sudoers file:
<tt>config-extract</tt> também lhe permite extrair configurações de recursos especiais do Debian, tal como configurações de kernels para Xen e [[OpenVZ]]:
 
<console>
<console>
##i##<username> ALL = NOPASSWD: /home/<username>/bin/bluetooth
# ##i##./config-extract amd64 openvz
</console>
Wrote amd64_openvz_amd64 kernel configuration to /usr/src/linux-debian-2.6.32.30/.config.
Now just add the following command to your hotkey assignment, and you can toggle bluetooth on & off to your heart's content:
<console>
##i##sudo /home/<username>/bin/bluetooth
</console>
</console>


== Yet Another Trick ==
'''É necessário nomear o nome do arquivo de configuração do kernel para outro diferente de ".config" para evitar erros com o genkernel.'''
Another handy thing that can be done. I have 2 computers at my desk, 1 is rarely used and somewhat underpowered. I sometimes use it though to talk on voip, leaving my main machine free to compile, restart, whatever.
 
 
Depois de utilizar o <tt>config-extract</tt>, execute <tt>make oldconfig</tt> e aceite todas as opções padrões ao pressionar Enter em todos os prompts.


The problem: I wish to use the same headsets on both computers.  In practice, this is a bit of a hassle, because you must pair the headsets with only one machine, so as I switch back and forth, I have to change the pairing.  Not the end of the world, but we can end that hassle.


{{fancynote|Some newer headsets can be paired to as many as 3 different receivers, great if you have them}}
{{fancynote|se vocẽ estiver utilizando o sistema de arquivo XFS como sua partição root: execute <tt>make menuconfig</tt> e certifiqui-se de que "File Systems --> XFS filesystem support" e "Library Routines --> CRC32c (Castagnoli, et al) Cyclic Redundancy-Check" estão ambos configurados para * (e não [m]).}}
The first task is to acquire the bdaddr program. It's on the Backtrack Linux distros, you can probably find it out there in cyberspace somewhere, but it gets confusing on a search because bluez uses the bdaddr abbreviation a lot, creating a lot of noise in your search.
Isso é necessário para assegurar que seu sistema pode inicializar corretamente pelas versẽos do kernel >= 3.10.11.
I just put it in /usr/bin.


To accomplish this, one machine must be the “Master Record” and the other machine pretends to be that machine with pairing.  Not as complicated as it sounds.
=== Terceiro passo: Construir e instalar o kernel ===


Now pair all of your devices on the “Master Record” machine.  The secret link codes are stored at (shhhh!) /var/lib/bluetooth in a directory named with your receivers bluetooth address, let's say AA:AA:AA:AA:AA:AA.  After this is done you are ready to start on the Pretender machine.  It will fool bluez into thinking that it's bluetooth address is AA:AA:AA:AA:AA:AA, even though it has a different address.  Copy the  AA:AA:AA:AA:AA:AA directory from /var/lib/bluetooth on the “Master Record” machine to /var/lib/bluetooth on the “Pretender”.  The Pretender will now have two directories in /var/lib/bluetooth,  AA:AA:AA:AA:AA:AA and it's own receiver's address directory.  (Unless you have more than 1 receiver, but let's keep it simple).
Isso é simplesmente obtido ao:


Then simply modify the code in /home/<username>/bin/bluetooth, only the “turn on” section is shown below, because that's all we are changing:
<console>
<console>
#/home/<username>/bin/bluetooth (partial)
# ##i##genkernel --kernel-config=config-2.6.32-5-amd64 all
...  else
      rfkill unblock bluetooth
##i### add these 4 lines
##i##        sleep 2
##i##        /usr/bin/bdaddr -i hci0 AA:AA:AA:AA:AA:AA  2&>1>/dev/null #of course, you must change this to "Master Record's" receiver address
##i##        /usr/sbin/hciconfig hci0 reset
##i##        /etc/init.d/bluetooth restart
##i### end of addition
BLUETOOTH_STRING="  Bluetooth powered on"
DISPLAY_COLOR="blue"  ...
</console>
</console>
And that's it!  Now both machines will use the same headsets and you won't constantly have to re-pair.  When the Pretender bluetooth is toggled on it has the other machines bluetooth address for it's receiver.  Note that I always start my bluetooth powered off, so it always starts in pretend mode, if you start with yours powered on it won't spoof the other address until you toggle it off & then on unless you add the above code to your /etc/local.d/*.start file as well.


The only caveat is I'm not sure what would ever happen if I had both bluetooth receivers on at the same time and turned on a headset. But far short of a nuclear meltdown I'm sure, I suspect one machine would grab the headset before the other?  Anyhow, with hotkey controlled bluetooth it's never been an issue.
* --kernel-config: utilize o configfile dado. Se você der somente um filename aqui, ele é procurando em seu diretório de funcionamento atual. Você pode também utilizar um caminho relativo ou absoluto (relative or an absolute path) guiando o seu configfile aqui (por exemplo: "--kernel-config=/usr/src/linux/configfile").
* all: reconstrua a imagem do kernel e a imagem da ramdisk initramfs (aparte dos módulos do kernel, a imagem do ramdisk contem as ferramentas como BusyBox e alguns scripts de genéricos inicialização, dependendo das opções que você utilizar na linha de comando várias ferramentas adicionais como lvm ou raid volume management podem ser incorporados também).
 
{{ fancyimportant|Ao menos que seja explicitamente declarado via ''--no-clean'' ou ''--no-mrproper'', o Genkernel fará um '''make mrproper''' no kernel source tree, limpando assim o build anterior '''e removendo o aqruivo de configuração de kernel anterior''' nisso.
}}
 
Se você utiliza o Genkernel para reconstruir o kernel Linux em SPARC64, lembre-se de:
* Definir '''sparc64-unknown-linux-gnu-''' no ''General setup --> Cross-compiler tool prefix''
* Colocar '''--kernel-cross-compile=sparc64-unknown-linux-gnu-''' na linha de comando Genkernel
 
Uma vez que o kernel tem sido compilado a ram disk (ramdisk) tem sido gerada, a imagem do kernel mais seus arquivos associados (imagem initramfs e System.map) são colocados no diretório /boot. Você pode utilizar sua ferramenta favorita para atualizar seus arquivos de configuração de bootloader.


[[Category:Hardware]]
[[Category:Internals]]
[[Category:HOWTO]]
[[Category:Funtoo features]]
[[Category:Kernel]]
[[Category:Official Documentation]]

Revision as of 21:30, April 12, 2015

Overview of Kernels

sys-kernel/vanilla-sources

esse vai instalar os fontes do kernel Linux "vanilla" (não modificado). A versão atual recomendada é a 3.x. Funtoo Linux que tem suporte totalmente ao Linux 3.x. As vantagens desse kernel incluem melhoramentos recentes ao Linux Containers, uma pilha de rede atual (networking stack) com muitas correções de bug, e alta confiabilidade para desktops e servidores. O lado negativo é que esse kernel deve ser configurado manualmente pelo usuário e não possui built-in genkernel suporte via a flag USE binary desta vez.

No results

Esse kernel tree é baseado nos kernels stable do kernel.org com genpatches aplicados genpatches. o Gentoo patchset visa ter suporte à toda variedade de arquiteturas suportadas pelo Gentoo. A lista de genpatched kernels disponíveis: genpatches-kernels

No results

Esse é um kernel baseado no RHEL6 com suporte a OpenVZ. Esse é agora o kernel preferido para desenvolvimento de produção OpenVZ (production OpenVZ deployments). Ele requer gcc-4.4.5 para ser construído, que vai usará automaticamente sem que o usuário precise utilizar gcc-config. Utilizamos essa versão de gcc desde que essa é a versão de gcc utilizada pela Red Hat para construir esse kernel.

sys-kernel/debian-sources

Esse é o kernel do Debian. Esses ebuilds agora possuem suporte a flag USE binary. Daniel adicionou comando especial config-extract que pode ser utilizado para listar todas as configurações disponíveis do kernel oficial do Debian, e gerá-las a partir dos arquivos do Debian inclusos com o kernel. Esse kernel tem suporte opcional a OpenVZ, mas é bem melhor utilizar o openvz-rhel6-stable se quiser um instalação OpenVZ com qualidade de produção (production-quality OpenVZ). Para mais informações sobre como utilizar debian-sources e config-extract, veja Utilizando debian-sources com o Genkernel abaixo.

Binary USE

Muitos dos kernel ebuilds no Funtoo Linux possuem suporte à flag USE binary muito útil. Ao habilitar essa flag USE e emergir o kernel, o ebuild construirá automaticamente uma imagem binária do kernel, o initramfs e módulos do kernel e instalá-los em /boot. A imagem binária do kernel e do initramfs pode ser utilizadas para inicializar seu sistema Funtoo Linux sem necessidade qualquer configuração adicional. Esse é um ótimo jeito de obter um sistema Funtoo Linux no ar e em execução rapidamente. Aqui está como fazer isso:

root # echo "sys-kernel/openvz-rhel6-stable binary" >> /etc/portage/package.use
root # emerge openvz-rhel6-stable
root # nano -w /etc/boot.conf
root # boot-update

Mais informações podem ser encontradas no Guia de Instalação do Funtoo Linux.

Funtoo Linux Genkernel

O Funtoo Linux contem uma versão forked/enhanced do genkernel com as novas compatibilidades:

  • genkernel pode utilizar um diretório build que é separado do diretório kernel source. Isso é habilitado utilizando a nova opção --build-dst.
  • --build-src é uma nova opção que é equivalente a opção --kerneldir.
  • --fullname pode ser utilizado para especificar o nome inteiro das imagens do kernel e do initramfs -- Tudo depois kernel- e de initramfs-.
  • --firmware-src - uma nova opção que funciona identic ao --firmware-dir.
  • --firmware-dst - uma nova compatibilidade - você pode agora definir onde o genkernel instala o firmware.
  • Genkernel utiliza o Funtoo Linux lvm2 ao invés de construir o seu próprio.
  • Algumas correções de compilação.

Estabilidade do Kernel e visão geral da estabilidade

   Warning

SPARC64: Todos os kernels além das séries 3.9 e antes do 3.14-rc8 estão sujeitos a um bug que abriga o kernel nas máquinas sun4v somente. Esses últimos são fornecidos com UltraSPARC T1 e mais recentes CPUs (ex. SunFire T1000, SunFire T2000, SunFire T52x0/T54x0 series...), todas as máquinas sun4u (UltraSPARC IV e CPUs antecedentes) não estão sujeitos a esse problema e qualquer versão de kernel funcional.

Nome do Kernel Versão USE flags Estabilidade Recursos Extras Req'd udev Notas
sys-kernel/vanilla-sources 3.17.0 N/A Excelente - recomendado para desktops e servidores. N/A Qualquer Recomendado para networking stack atuais, hardware e suporte a Linux Containers. Esse kernel deve ser manualmente configurado pelo usuário. Novos Recursos: kernelnewbies.org/linux_3.12 Novos Drivers: kernelnewbies/Linux_3.12-DriversArch
No results 3.17.0 N/A Excelente - recomendado para desktops e workstations N/A Qualquer Recomendado para networking stack atuais, hardware e suporte a Linux Containers. Esse kernel deve ser configurado manualmente pelo usuário. Novos Recursos: kernelnewbies.org/linux_3.12 Novos Drivers: kernelnewbies/Linux_3.12-DriversArch
No results 2.6.32.042.092.2 binary Excelente - recomendado para servidores de produção N/A Qualquer Esse kernel é construído com o gcc-4.4.5. emerge broadcom-netxtreme2 para confiável suporte a BCM5709+ (NIC integrado)
sys-kernel/debian-sources 3.16.2, 3.16.7, 3.19.3 openvz Bom - kernel padrão recomendado pelo Funtoo OpenVZ (opcional) Qualquer Veja #Using debian-sources with Genkernel, abaixo.

Utilizando o Debian-Sources com o Genkernel

   Important

Debian-sources está agora totalmente compatível com a flag USE binary e recomendado para usuários desktop. O exemplo abaixo é válido para instalação manual. Ao menos 12G de /var/tmp exigido para construir

Essa seção descreve como construir um kernel binário com debian-sources e genkernel, e também explica como utilizar a ferramenta config-extract do Funtoo Linux para listar e criar configurações do kernel oficial do Debian.

Primeiro passo: emergir os pacotes necessários

O primeiro passo é emergir:

  1. O Debian sources
  2. Genkernel em si

Isso é alcançado ao executar o seguinte:

root # emerge -av sys-kernel/debian-sources sys-kernel/genkernel

uma vez que o kernel sources do Debian são implantados, você deve encontrar um diretório nomeado linux-debian-versão (ex. linux-debian-2.6.32.30) sob /usr/src. Atualize seu link simbólico linux para apontar no seu diretório:

root # cd /usr/src
root # rm linux
root # ln -s linux-debian-2.6.32.30 linux

Alternativamente, emerge o debian-sources com a flag USE symlink.

Segundo passo: Obter um arquivo de configuração

É hora de baixar o arquivo de configuração do kernel. Para esse tutorial utilizaremos um arquivo de configuração para o AMD64 (várias outras arquiteturas como MIPS ou SPARC64 estão disponíveis.) Para visualizar uma lista completa de configurações de kernel disponíveis, digite ./config-extract -l no diretório kernel source do Debian:

ninja1 linux-debian-2.6.32.30 # ./config-extract -l

====== standard featureset ======

       alpha: alpha-generic, alpha-legacy, alpha-smp
       amd64
       armel: iop32x, ixp4xx, kirkwood, orion5x, versatile
        hppa: parisc, parisc-smp, parisc64, parisc64-smp
        i386: 486, 686, 686-bigmem, amd64
        ia64: itanium, mckinley
        m68k: amiga, atari, bvme6000, mac, mvme147, mvme16x
        mips: 4kc-malta, 5kc-malta, r4k-ip22, r5k-ip32, sb1-bcm91250a, sb1a-bcm91480b
      mipsel: 4kc-malta, 5kc-malta, r5k-cobalt, sb1-bcm91250a, sb1a-bcm91480b
     powerpc: powerpc, powerpc-smp, powerpc64
        s390: s390x, s390x-tape
         sh4: sh7751r, sh7785lcr
       sparc: sparc64, sparc64-smp
     sparc64: sparc64, sparc64-smp

====== vserver featureset ======

       amd64
        i386: 686, 686-bigmem
        ia64: itanium, mckinley
     powerpc: powerpc, powerpc64
        s390
       sparc
     sparc64

====== xen featureset ======

       amd64
        i386

====== openvz featureset ======

       amd64
        i386

Digite config-extract -h para informações de uso extendidas:

ninja1 linux-debian-2.6.32.30 # ./config-extract -h
This work is free software.

Copyright 2011 Funtoo Technologies. You can redistribute and/or modify it under
the terms of the GNU General Public License version 3 as published by the Free
Software Foundation. Alternatively you may (at your option) use any other
license that has been publicly approved for use with this program by Funtoo
Technologies (or its successors, if any.)

usage: config-extract [options] arch [featureset] [subarch]

  -h  --help        print this usage and exit
  -l  --list        list all available kernel configurations
  -o  --outfile     specify kernel config outfile --
                    defaults to .config in current directory
  [featureset]      defaults to "none" if not specified
  [subarch]         defaults to the only one available; otherwise required

This program was written by Daniel Robbins for Funtoo Linux, for the purpose of
easily and conveniently extracting Debian kernel configurations. To see a nice
list of all available kernel configurations, use the --list option.

Debian's kernel configs are specified internally in arch_featureset_flavor
format, such as: "amd64_openvz_amd64". The featureset typically describes an
optional kernel configuration such as "xen" or "openvz", while the flavor in
Debian terminology typically refers to the sub-architecture of the CPU.

When using this command, you must specify an arch. A featureset of "none" is
assumed unless you specify one, and by default this program will pick the only
available subarch if there is only one to choose from. If not, you will need to
pick one (and the program will remind you to do this.)

The kernel configuration will be written to ".config" in the current directory,
or the location you specified using the -o/--outfile option.

Vamos utilizar config-extract para gerar uma configuração de kernel para um sistema amd64:

root # cd linux
root # ./config-extract amd64
Wrote amd64_none_amd64 kernel configuration to /usr/src/linux-debian-2.6.32.30/.config.

config-extract também lhe permite extrair configurações de recursos especiais do Debian, tal como configurações de kernels para Xen e OpenVZ:

root # ./config-extract amd64 openvz
Wrote amd64_openvz_amd64 kernel configuration to /usr/src/linux-debian-2.6.32.30/.config.

É necessário nomear o nome do arquivo de configuração do kernel para outro diferente de ".config" para evitar erros com o genkernel.


Depois de utilizar o config-extract, execute make oldconfig e aceite todas as opções padrões ao pressionar Enter em todos os prompts.


   Note

se vocẽ estiver utilizando o sistema de arquivo XFS como sua partição root: execute make menuconfig e certifiqui-se de que "File Systems --> XFS filesystem support" e "Library Routines --> CRC32c (Castagnoli, et al) Cyclic Redundancy-Check" estão ambos configurados para * (e não [m]).

Isso é necessário para assegurar que seu sistema pode inicializar corretamente pelas versẽos do kernel >= 3.10.11.

Terceiro passo: Construir e instalar o kernel

Isso é simplesmente obtido ao:

root # genkernel --kernel-config=config-2.6.32-5-amd64 all
  • --kernel-config: utilize o configfile dado. Se você der somente um filename aqui, ele é procurando em seu diretório de funcionamento atual. Você pode também utilizar um caminho relativo ou absoluto (relative or an absolute path) guiando o seu configfile aqui (por exemplo: "--kernel-config=/usr/src/linux/configfile").
  • all: reconstrua a imagem do kernel e a imagem da ramdisk initramfs (aparte dos módulos do kernel, a imagem do ramdisk contem as ferramentas como BusyBox e alguns scripts de genéricos inicialização, dependendo das opções que você utilizar na linha de comando várias ferramentas adicionais como lvm ou raid volume management podem ser incorporados também).
   Important

Ao menos que seja explicitamente declarado via --no-clean ou --no-mrproper, o Genkernel fará um make mrproper no kernel source tree, limpando assim o build anterior e removendo o aqruivo de configuração de kernel anterior nisso.

Se você utiliza o Genkernel para reconstruir o kernel Linux em SPARC64, lembre-se de:

  • Definir sparc64-unknown-linux-gnu- no General setup --> Cross-compiler tool prefix
  • Colocar --kernel-cross-compile=sparc64-unknown-linux-gnu- na linha de comando Genkernel

Uma vez que o kernel tem sido compilado a ram disk (ramdisk) tem sido gerada, a imagem do kernel mais seus arquivos associados (imagem initramfs e System.map) são colocados no diretório /boot. Você pode utilizar sua ferramenta favorita para atualizar seus arquivos de configuração de bootloader.