Difference between pages "Kernel/pt-br" and "User:Gboos"

From Funtoo
< Kernel(Difference between pages)
Jump to navigation Jump to search
 
(Created page with "{{Person |Geoloc=35.91157655376172, 14.505600925331237 |Blogs= }}")
 
Line 1: Line 1:
== Requerimentos Mínimos ==
{{Person
* '''Entender as linhas de comando'''
|Geoloc=35.91157655376172, 14.505600925331237
* '''Saber aonde os arquivos do kernel ficam localizados'''
|Blogs=
 
}}
== Suposições ==
Você começa a partir de um sistema Funtoo instalado no seu disco, ou ao menos, você está no stage3 dentro de um ambiente  chroot a partir de um live cd, seguindo de alguma forma o [[Installation (Tutorial)|Tutorial de Instalação]] do Funtoo.
 
== Versão menos avaçada ==
=== Emergir os códigos do kernel ===
Para começar, temos que compreender quais fontes usaremos. Se você estiver incerto a respeito quais fontes estão disponíveis e quais são seus  benefícios e seus inconvenientes, verifique a página [[Funtoo_Linux_Kernels| Kernels]].
 
Depois de ter feito uma decisão como qual kernel quer instalar, emerja-o:
<console>
###i## emerge sys-kernel/[kernel-name]
</console>
O Portage vai agora instalar os sources em ''/usr/src''. No entanto, é preferível também criar um link simbólico (symlink) com o eselect como tal:
<console>
###i## eselect kernel set 1
</console>
Você pode utilizar
<console>
###i## eselect kernel list
</console>
Para exibir uma lista de kernels atualmente instalados.
 
Utilizar o comando acima é util, por que isso lhe permite sempre ser capaz de ir ao diretório "/usr/src/linux" e encontrar seu kernel de trabalho atual e arquivos de construção.
O diretório "/usr/src/linux" é simplesmente um link simbólico ao kernel que você selecionou  com eselect, no diretório "/usr/src".
 
Note que o portage pode também definir isso para você automaticamente, ao definir o "symlink" USE flag para seu kernel.
 
=== Configurar o kernel ===
Agora que os fontes do kernel estão no seu sistema, você deve configurá-los. Para fazer isso, altere seu diretório para ''/usr/src/linux''
<console>
###i## cd /usr/src/linux
</console>
 
Estamos agora no diretório de fontes do kernel, depois limpe os fontes:
{{warning|Isso excluirá seu .config}}
<console>###i## make clean && make distclean && make mrproper</console>
 
Copie as configurações, caso possua alguma configuração anterior para copiar:
<console>###i## cp /boot/config-3.13.7 .config</console>
 
Podemos utilizar um "script" que nos permitirá modificar a configuração:
<console>
###i## make menuconfig
</console>
 
ou
 
<console>
###i## make nconfig
</console>
 
{{kernelop||desc=aqui é onde você insere as configurações do kernel, ou pressione / para procurar módulos do kernel pelo nome}}
 
Enquanto você edita as fontes do kernel, mantenha em mente o seguinte:
* Para construir algo dentro de seu kernel (built in) pressione y quando você o tiver selecionado.
* Para excluir algo de seu kernel pressione n quando você o tiver selecionado.
* Para construir algo como módulo pressione m.
 
 
Algumas coisas que talvez você necessite incluir em seu kernel:
 
como '''módulos''':
 
* Wireless/LAN drivers
* Suporte para sua placa gráfica.
* Suporte para sua placa de áudio.
* Suporte para os seus dispositivos USB.
 
 
como '''built in''':
* controladores scsi, sata ou ata.
* sistemas de arquivos utilizado.
 
{{note|1=
Muitas páginas na wiki irão dizer-lhe os requisitos do kernel para os aplicativos dos quais tais páginas dizem respeito. Para isso, mantenha os olhos abertos para o texto branco sob o fundo azul de tais páginas. Como essa, por exemplo: [[uvesafb| uvesafb]]}}
 
=== Construindo e instalando as fontes do kernel ===
Após ter terminado de configurar as fontes de seu kernel, você precisará construí-las. Para construir as fontes de seu kernel, utilize o seguinte comando:
<console>
###i## make
</console>
{{tip|1=
Você pode adicionar -j<número de cores de seu processador + 1> após o comando make para construir o kernel mais rapidamente.}}
 
Quando a construção do kernel e seus módulos estiver completa, instale-os:
<console>
###i## make modules_install && make install
</console>
Agora que você instalou seu kernel e os módulos do seu kernel, é uma boa ideia instalar uma [[Building_a_Kernel_from_Source#Initramfs| Initramfs]].
* se o seu sistema possui uma partição separada para o diretório "/usr", está encriptado, ou utiliza alguma configuração que não seja padrão, ele provavelmente não irá iniciar sem uma initramfs.
* se o seu sistema não está encriptado e possui um sistema de arquivos e controladores de disco rígido compilados como "built in" e não como módulos, ele não precisará de uma initramfs.
 
== Advanced version ==  
=== Getting ready to start ===
 
{{note|In this case we are building a kernel that is booting root in LVM over encrypted LUKS container.
If you don't have this setup, don't worry, you just don't need all the modules, but everything else is similar.}}
First, there is the decision which linux kernel sources we need.
There are plenty of them in the repositories around, often it is not easy to distinguish between them.
 
I would always trust my distribution of choice and take what is has to offer - and funtoo has a lot to offer!
 
I really do recommend (especially if it is your first time) to build a debian-sourced genkernel like described in chapter 5 "Using Debian-Sources with Genkernel" in the [[Funtoo_Linux_Kernels| Funtoo Kernels Tutorial]].
 
From there you should have a running system booting nicely from your own build (just little bit bloated) kernel. This is more than you can expect from any other ready to go distribution.
 
{{note|1=
We are using Red Hat's dracut in order to build a nice initramfs (containing all the necessary tools and extra drivers our kernel might need to start the system). Although dracut is the way to go, more sophisticated and not as buggy as gentoo's genkernel approach, more and more funtoo geeks start using slashbeast's better-initramfs, which we will cover at the end of this howto! So after having set up a genkernel from debian or gentoo sources we are going to build a kernel with either (or both) dracut or/and better-initramfs. So gentoo sources with genkernel is always my backup if anything is not working correctly on my system. For the slightly more geeky approach with my own initram I am using pf-sources, ck-sources or any other more or less heavily patched sources.}}
 
Let's go!
 
=== Fontes do Kernel ===
A fonte do kernel que você utiliza em seu sistema é uma escolha sua. Para um laptop ou desktop, as seguintes fontes são recomendadas:
* '''{{Package|sys-kernel/pf-sources}}'''
* '''{{Package|sys-kernel/ck-sources}}'''
* '''{{Package|sys-kernel/gentoo-sources}}'''
* '''{{Package|sys-kernel/git-sources}}'''
* '''{{Package|sys-kernel/sysrescue-std-sources}}'''
* '''{{Package|sys-kernel/debian-sources}}'''
{{note|se você está inseguro sobre quais fontes gostaria de usar, emerge <code>gentoo-sources</code>. Esta é sempre uma aposta segura para a maioria dos sistemas. Para maiores informações sobre kernels disponíveis, confira: [[Funtoo Linux Kernels]]}}
 
=== Prerequisites ===
 
Regardless of the tools you already have installed, it is recommended to follow the steps below, even if you find them to be redundant.
First, we edit our <code>/etc/portage/[[make.conf]]</code>:
 
<pre>
#These compiler flags are just tweaking (optimazation) and NOT necessary:
CFLAGS="-O2 -pipe -march=native -ftracer -fforce-addr"
CXXFLAGS="${CFLAGS} -fpermissive -fomit-frame-pointer"
KDIR=/usr/src/linux
KERNEL="symlink build"
USE="$KERNEL ....here are your use flags...."
## These modules are available:
## DRACUT_MODULES="dracut_modules_biosdevname dracut_modules_btrfs dracut_modules_caps dracut_modules_crypt dracut_modules_crypt-gpg dracut_modules_dmraid dracut_modules_dmsquash-live dracut_modules_gensplash dracut_modules_iscsi dracut_modules_livenet dracut_modules_lvm dracut_modules_mdraid dracut_modules_multipath dracut_modules_nbd dracut_modules_nfs dracut_modules_plymouth dracut_modules_ssh-client dracut_modules_syslog"
## We will use these modules for LVM / LUKS:
DRACUT_MODULES="crypt lvm plymouth biosdevname dmraid crypt-gpg dmsquash-live ssh-client syslog"
</pre>
 
Next, we set the package keywords by adding the following to <code>/etc/portage/package.use</code>:
 
<pre>
sys-kernel/dracut dm net device-mapper crypt lvm
</pre>
 
{{note|If you don't have lvm over encrypted LUKS you just add the "net" keyword here, or "selinux".}}
 
 
Next, we build our packages:
<console>
###i## emerge -av app-portage/gentoolkit sys-kernel/pf-sources sys-kernel/dracut sys-boot/plymouth sys-boot/plymouth-openrc-plugin
</console>
 
=== Preparing the kernel ===
 
We go now to the sources directory and enter the following commands to update the kernel's  .config  file:
<console>
###i## cd /usr/src/linux/
###i## make clean
  CLEAN  .
  CLEAN  arch/x86/kernel/acpi/realmode
  CLEAN  arch/x86/kernel/cpu
  CLEAN  arch/x86/kernel
  CLEAN  arch/x86/vdso
  CLEAN  arch/x86/lib
  CLEAN  drivers/gpu/drm/radeon
  CLEAN  drivers/net/wan
  CLEAN  drivers/scsi/aic7xxx
  CLEAN  drivers/tty/vt
  CLEAN  drivers/video/logo
  CLEAN  firmware
  CLEAN  kernel
  CLEAN  lib/raid6
  CLEAN  lib
  CLEAN  security/apparmor
  CLEAN  security/selinux
  CLEAN  usr
  CLEAN  arch/x86/boot/compressed
  CLEAN  arch/x86/boot
  CLEAN  .tmp_versions
  CLEAN  vmlinux System.map .tmp_kallsyms2.S .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms1.S .tmp_vmlinux1 .tmp_vmlinux2 .tmp_System.map
###i## zcat /proc/config.gz > /usr/src/linux/.config
</console>
 
Next, we run <code>make localmodconfig</code>. You will get some questions which you can answer mostly with either M (compiled as a module) or Y (compiled directly into the kernel). If you are not sure what to choose, press enter, and the default option will be selected.
<console>
###i## make localmodconfig
Enable different security models (SECURITY) [Y/n/?] y
Enable the securityfs filesystem (SECURITYFS) [Y/?] y
Socket and Networking Security Hooks (SECURITY_NETWORK) [Y/?] y
Security hooks for pathname based access control (SECURITY_PATH) [Y/?] y
Low address space for LSM to protect from user allocation (LSM_MMAP_MIN_ADDR) [65536] 65536
NSA SELinux Support (SECURITY_SELINUX) [Y/n/?] y
  NSA SELinux boot parameter (SECURITY_SELINUX_BOOTPARAM) [N/y/?] n
  NSA SELinux runtime disable (SECURITY_SELINUX_DISABLE) [N/y/?] n
  NSA SELinux Development Support (SECURITY_SELINUX_DEVELOP) [Y/n/?] y
  NSA SELinux AVC Statistics (SECURITY_SELINUX_AVC_STATS) [Y/n/?] y
  NSA SELinux checkreqprot default value (SECURITY_SELINUX_CHECKREQPROT_VALUE) [1] 1
  NSA SELinux maximum supported policy format version (SECURITY_SELINUX_POLICYDB_VERSION_MAX) [Y/n/?] y
    NSA SELinux maximum supported policy format version value (SECURITY_SELINUX_POLICYDB_VERSION_MAX_VALUE) [19] 19
TOMOYO Linux Support (SECURITY_TOMOYO) [Y/n/?] y
  Default maximal count for learning mode (SECURITY_TOMOYO_MAX_ACCEPT_ENTRY) [2048] 2048
  Default maximal count for audit log (SECURITY_TOMOYO_MAX_AUDIT_LOG) [1024] 1024
  Activate without calling userspace policy loader. (SECURITY_TOMOYO_OMIT_USERSPACE_LOADER) [Y/n/?] y
AppArmor support (SECURITY_APPARMOR) [Y/n/?] y
  AppArmor boot parameter default value (SECURITY_APPARMOR_BOOTPARAM_VALUE) [1] 1
Integrity Measurement Architecture(IMA) (IMA) [Y/n/?] y
EVM support (EVM) [N/y/?] (NEW)
Default security module
  1. SELinux (DEFAULT_SECURITY_SELINUX)
  2. TOMOYO (DEFAULT_SECURITY_TOMOYO)
  3. AppArmor (DEFAULT_SECURITY_APPARMOR)
> 4. Unix Discretionary Access Controls (DEFAULT_SECURITY_DAC)
choice[1-4?]: 4
warning: (ACPI_HOTPLUG_CPU) selects ACPI_CONTAINER which has unmet direct dependencies (ACPI && EXPERIMENTAL)
warning: (MEDIA_TUNER) selects MEDIA_TUNER_TEA5761 which has unmet direct dependencies (MEDIA_SUPPORT && VIDEO_MEDIA && I2C && EXPERIMENTAL)
#
# configuration written to .config
#
warning: (GFS2_FS) selects DLM which has unmet direct dependencies (EXPERIMENTAL && INET && SYSFS && CONFIGFS_FS && (IPV6 || IPV6=n))
warning: (IMA) selects TCG_TPM which has unmet direct dependencies (HAS_IOMEM && EXPERIMENTAL)
warning: (MEDIA_TUNER) selects MEDIA_TUNER_TEA5761 which has unmet direct dependencies (MEDIA_SUPPORT && VIDEO_MEDIA && I2C && EXPERIMENTAL)
warning: (ACPI_HOTPLUG_CPU) selects ACPI_CONTAINER which has unmet direct dependencies (ACPI && EXPERIMENTAL)
</console>
 
Now comes the most adventurous part!
 
=== Building the Kernel ===
<console>
###i## make -j8  bzImage
###i## make -j8 modules
###i## make modules_install
###i## make install
</console>
== Initramfs ==
{{warning|Make sure that you have built and installed your kernel sources / modules before building an initramfs.}}
To get your initramfs up and running, check out the [http://www.funtoo.org/Initramfs Initramfs] page. After following all the directions on the page to get your initramfs set up, continue following the ones here.
 
Update the <code>grub.cfg</code> with boot update, then reboot and see how it works!
<console>
###i## boot-update -v
###i## reboot
</console>
 
[[Category:HOWTO]]
[[Category:Featured]]
[[Category:Kernel]]

Latest revision as of 06:46, April 8, 2015


Location

Loading map...