[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Próxima revisión
Revisión previa
es:howtos:slackware_admin:cross_compiling_the_linux_kernel [2019/02/03 20:57 (UTC)] – creado slackwarespanoles:howtos:slackware_admin:cross_compiling_the_linux_kernel [2019/03/18 01:22 (UTC)] (actual) – [Compilacion del Kernel] antares_alf
Línea 1: Línea 1:
-====== Cross Compiling The Linux Kernel ======+====== Compilación cruzada del kernel linux ======
  
-==== Introduction ====+==== Introduccion ====
  
-I freely admit there are other HOWTOs on this subjectbut I wanted to show you a neat way that rides on the back of the great **Buildroot** projectinstead of doing all the compiler setup by hand As bonus you can target different architectures pretty easily.+Admito libremente que hay otros HOWTOs sobre este temapero quería mostrarte una manera clara que funciona por detras del gran proyecto **Buildroot**, En lugar de hacer toda la configuración del compilador a manoComo beneficio adicional, puedes apuntar diferentes arquitecturas con bastante facilidad.
  
-For this demonstration I will build a 32-bit Slackware kernel on a 64-bit machine Yes I know you can potentially do this with Multilib (though I've never triedand other methodshowever this method is quite simple, will allow targeting MIPS, m68k, Microblaze, PowerPC, SPARC and God knows what elseall with the same techniqueand you don't even need to be root to do it Interested?  Read on.+Para esta demostración, construiré un kernel Slackware de 32 bits en una máquina de 64 bitsSí, sé que potencialmente puedes hacer esto con Multilib (aunque nunca lo he intentadoy otros métodosSin embargo, este método es bastante simple, permitirá apuntar a MIPS, m68k, Microblaze, PowerPC, SPARC y Dios sabe qué másTodos con la misma técnicay ni siquiera necesitas ser root para hacerlo..
  
-==== About Buildroot ====+==== Acerca de Buildroot ====
  
-The Buildroot project has been running for some years and allows one toquite literallybuild a root filesystem (duh), however we will completely ignore the rootfs building part of the equation and just use the cross-compiler which it builds first Since I have a fast machine I didn't even bother working out how to skip the rootfs generation step You only have to build your cross-compiler once after all.+El proyecto Buildroot ha estado funcionando durante algunos años y permiteliteralmenteconstruir un sistema de archivos raíz (duh), Sin embargo, ignoraremos completamente la parte de construcción de rootfs de la ecuación y solo usaremos el compilador cruzado que construye primeroComo tengo una máquina rápida, ni siquiera me molesté en averiguar cómo omitir el paso de generación de rootfs. Solo tienes que construir tu compilador cruzado una vez después de todo.
  
-==== Slackware Install ====+==== Instalando Slackware ====
  
-My test cross-compiler build machine is Slackware64 14.2 with disk sets A,AP,D,K,L,N.  I'm sure you can install a lot less to build Buildroot, in fact I'd expect only and to be neededhowever the spirit of the Slackware community is that you install everything so the risk is yours.+Mi máquina de prueba de compilación cruzada es Slackware64 14.2 con conjuntos de discos A, AP, D, K, L, N. Estoy seguro de que puedes instalar mucho menos para construir Buildroot, de hecho, esperaría que solo se necesitaran D, sin embargo, el espíritu de la comunidad Slackware es que instalas todo, por lo que el riesgo es tuyo.
  
-==== Cross-compiler ====+==== Compilador Cruzado ====
  
-Grab Buildroot latest stable version from https://buildroot.org, unpack and configure it:+Obtener la última versión estable de Buildroot desde https://buildroot.org, desempaquetar y configurarlo:
  
 <code>$ cd /usr/src <code>$ cd /usr/src
Línea 25: Línea 25:
 $ make menuconfig</code> $ make menuconfig</code>
  
-You will see configuration system much like the kernel config For building 32-bit kernels with maximum compatibility I generally select the 486 output option, (586 is the default):+Verá un sistema de configuración muy parecido la configuración del kernel. Para compilar núcleos de 32 bits con máxima compatibilidad, generalmente selecciono la opción de salida 486, (586 es la opción predeterminada):
  
 <code>Target options -> Target Architecture Variant (i486)</code> <code>Target options -> Target Architecture Variant (i486)</code>
  
-To make the compiler we are about to build behave more like the Slackware one we want to use glibc instead of the default uClibc-ng (which is more suited to embedded applications):+Para hacer que el compilador que estamos a punto de construir se comporte más como Slackware, queremos usar glibc en lugar del uClibc-ng que es el predeterminado (que es más adecuado para aplicaciones integradas):
  
 <code>Toolchain -> C library (glibc)</code> <code>Toolchain -> C library (glibc)</code>
  
-If you don't do this you will need to disable stack protection in your kernel config when we come to compile that and we want to keep a standard Slackware configbecause we're true Slackers heart-and-soul right? :).+Si no hace esto, deberá deshabilitar la protección de la pila en la configuración del kernel lo cuando compilemos y queremos mantener una configuración estándar de Slackware, porque somos verdaderos slakers, ¿verdad, corazón y alma de Slackers? :).
  
-You can play around with many other options like kernel header versions however for building the kernel itself none of these matter The only option that may conceivably make a difference is the GCC versionparticularly if you are building an old kernel version which doesn't support later versions of GCC.  For this demonstration we can leave the defaults though Save the config and then:+Puedes jugar con muchas otras opciones, como versiones de encabezado de kernel, sin embargo, para la construcción del kernel en sí, nada de esto importaLa única opción que posiblemente pueda hacer una diferencia es la versión de GCC, especialmente si está compilando una versión antigua del kernel que no admite versiones posteriores de GCC. Sin embargo, para esta demostración podemos dejar los valores por defectoGuarda la configuración y luego:
  
 <code>$ make</code> <code>$ make</code>
  
-While that's running we'll configure the kernel so it's ready to compile. +Mientras se ejecuta, configuraremos el kernel para que esté listo para compilar.
-==== Kernel preparation ====+
  
-Pull down a kernel config appropriate to building a 32-bit Slackware kernel:+==== Preparacion del Kernel ==== 
 + 
 +Despliegue una configuración del kernel apropiada para construir un kernel Slackware de 32 bits:
  
 <code>$ cd /usr/src/linux <code>$ cd /usr/src/linux
 $ wget https://mirrors.slackware.com/slackware/slackware-14.2/kernels/hugesmp.s/config -O .config</code> $ wget https://mirrors.slackware.com/slackware/slackware-14.2/kernels/hugesmp.s/config -O .config</code>
  
-You should now have a .config in /usr/src/linux which says 'CONFIG_64BIT is not set' at the top That will replace your old 64-bit kernel .config that you had before (included from the 'K' disk set).  Obviously copy the kernel someplace else if you wanted to keep that!+Ahora debería tener un archivo .config en /usr/src/linux que dice 'CONFIG_64BIT is not set' en la parte superiorEso reemplazará a su antiguo .config del kernel de 64 bits que tenía antes (incluido en el conjunto de discos 'K'). ¡Obviamente copie el kernel en otro lugar si quiere mantener eso!
  
-==== Kernel compilation ====+==== Compilacion del Kernel ====
  
-When the Buildroot build is doneyou need to include the generated cross-compiler in your path.+Cuando la construccion del Buildroot esta hechanecesitas incluir el compilador cruzado generado en tu ruta.
  
 <code>export PATH=/usr/src/buildroot-2018.02.2/output/host/bin:$PATH</code> <code>export PATH=/usr/src/buildroot-2018.02.2/output/host/bin:$PATH</code>
  
-The compiler executable has the architecture prefix in it's name to avoid collision with the system GCC, you can now run it and test if it works:+El ejecutable del compilador tiene el prefijo de arquitectura en su nombre para evitar la colisión con el sistema GCC, ahora puede ejecutarlo y probar si funciona:
  
 <code>$ i486-linux-gcc --version</code> <code>$ i486-linux-gcc --version</code>
  
-If you are interestedyou can find all the other toolchain tools like ld, ar and so on with similar prefixes Now configure your kernel if you want to:+Si está interesadopuede encontrar todas las otras herramientas de la cadena de herramientas como ld, ar so con prefijos similaresAhora configura tu kernel si quieres:
  
 <code>$ cd /usr/src/linux <code>$ cd /usr/src/linux
 $ make menuconfig CROSS_COMPILE=i486-linux- ARCH=i386</code> $ make menuconfig CROSS_COMPILE=i486-linux- ARCH=i386</code>
  
-I'm leaving the default options herejust appending a '-buildroot' to the kernel nameFinally make the kernel:+Dejo las opciones predeterminadas aquísolo agregué un '-buildroot' al nombre del kernel. Finalmente crear el kernel.:
  
 <code>$ make bzImage CROSS_COMPILE=i486-linux- ARCH=i386</code> <code>$ make bzImage CROSS_COMPILE=i486-linux- ARCH=i386</code>
  
-Copy the built kernel to a 32-bit machine and it should boot If you want to compile/install the modules as welljust make sure you don't forget to use the same CROSS_COMPILE and ARCH variables every time you specify the make commandseverything should use the cross-compiler:+Copie el kernel construido en una máquina de 32 bits y debería arrancarSi también desea compilar instalar los módulosasegúrese de no olvidar usar las mismas variables CROSS_COMPILE ARCH cada vez que especifique los comandos make, todo lo debería usar el compilador cruzado:
  
 <code>$ make modules CROSS_COMPILE=i486-linux- ARCH=i386 <code>$ make modules CROSS_COMPILE=i486-linux- ARCH=i386
 $ make modules_install CROSS_COMPILE=i486-linux- ARCH=i386</code> $ make modules_install CROSS_COMPILE=i486-linux- ARCH=i386</code>
  
-and so on You will probably get away without these appended for some commands like 'make clean', but it's safest to just include them whenever you do any work on that kernelthey certainly won't hurt.+y asíProbablemente saldrás sin agregar estos comandos, pero algunos comandos como 'make clean', es más seguro incluirlos siempre que realices algún trabajo en ese núcleosin duda no te harán daño.
  
  
 es:howtos:slackware_admin:cross_compiling_the_linux_kernel ()