Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previaPróxima revisiónAmbos lados, revisión siguiente |
es:howtos:hardware:arm:gcc_aarch64_cross-compiler [2019/06/28 13:23 (UTC)] – [Construcción del compilador cruzado aarch64 de GCC] rramp | es:howtos:hardware:arm:gcc_aarch64_cross-compiler [2019/07/16 22:13 (UTC)] – Traducción completa. Comentarios y sugerencias son bienvenidos. rramp |
---|
=== Construir GCC === | === Construir GCC === |
| |
First move into the 'build-dir' directory and create a build directory for GCC before building it. Notice that only C and C++ have been specified as build languages. That's all you will need here. Incidentally, the available build language options allow just one, or a selection, or all, of the following '--enable-languages=all,ada,c,c++,fortran,go,jit,lto,objc,obj-c++'. | Primero muévete al directorio 'buit-dir' y cree un directorio de compilación para GCC antes de construirlo. |
| Note que solo han sido especificados como lenguajes de construcción C y C++. |
| Eso es todo lo que necesitarás aquí. |
| De hecho, las opciones de lenguaje de construcción disponibles permiten sólo una, o una selección, o todas, de las siguientes opciones '--enable-languages=all,ada,c,c++,fortran,go,jit,lto,objc,obj-c++'. |
| |
<code> | <code> |
=== Construir e instalar glibc === | === Construir e instalar glibc === |
| |
First move into the 'build-dir' directory and create a 'build-glibc' directory. Then move into the 'build-glibc' directory before building it. '--build=$MACHTYPE' is a predefined environment variable which describes the Raspberry Pi 3 (in this case) and it's required to compile some additional tools which are utilised during the build process. Notice that you're installing the C library startup files to the installation directory (csu/crt1.o, csu/crti.o, and csu/crtn.o) separately because there doesn’t seem to a 'make' rule that does this without creating other problems. | Primero vaya al directorio 'build-dir' y cree un directorio 'build-glibc'. Luego muévase al directorio 'build-glibc' antes de construirlo. --build=$MACHTYPE' es una variable de entorno predefinida que describe la Raspberry Pi 3 (en este caso) y es necesario compilar algunas herramientas adicionales que se utilizan durante el proceso de construcción. |
| Observe que está instalando los archivos de inicio de la biblioteca C en el directorio de instalación (csu/crt1.o, csu/crti.o, y csu/crtn.o) por separado porque no parece haber una regla "make" que lo haga sin crear otros problemas. |
| |
<code> | <code> |
</code> | </code> |
| |
=== Building glibc support library === | === Construcción de la biblioteca de soporte glibc === |
| |
Now move into the 'build-gcc' directory once again and build the GCC cross-compiler support library. | Muevase al directorio 'build-gcc' una vez más contruya las librerías de soporte para el compilador cruzado. |
| |
<code> | <code> |
</code> | </code> |
| |
=== Finish building glibc C library === | === Concluir la construcción de la biblioteca glibc C === |
| |
Move into the 'build-glibc' directory to finish building glibc C library and then install it. | Muevase al directorio 'build-glibc' para finalizar de construir la librería glibc y entonces instálalo. |
| |
<code> | <code> |
</code> | </code> |
| |
=== Finish building GCC C++ library == | === Finalización de la construcción de la librería GCC C++ == |
| Muevase al directorio 'build-glibc' para finalizar de construir la librería GCC C++ y luego instalela. |
Move into the 'build-gcc' directory to finish building GCC C++ library and then install it. | |
| |
<code> | <code> |
</code> | </code> |
| |
=== Testing the cross-compiler === | === Probando el compilador cruzado === |
| |
| Para testear/chequear que tu compilador cruzado GCC aarch64-linux está funcionando correctamente ejecute los siguientes comandos. |
| |
To test/check that your GCC aarch64-linux cross-compiler is working properly run the following command. | |
| |
<code> | <code> |
</code> | </code> |
| |
You should get a response similar to the following. | Usted debería obtener una respuesta similar a la siguiente: |
| |
<code> | <code> |
</code> | </code> |
| |
Once this process has been completed, export the GCC cross-compiler PATH on your normal user. If/when you're wanting to cross-compile do this each time after you've (re)booted your system so that the GCC cross-compiler can be located via your user's $PATH. You also have the option to add this command to your **~/.profile** as a permanent setting. Whether or not you decide to permanently add the GCC cross-compiler PATH to your ~/.profile is entirely up to you. If you are using your Slackware ARM current system for exclusively building aarch64 (arm64) packages then it would make sense to do so. | Una vez completado este proceso, exporte la ruta del compilador cruzado de GCC a su usuario normal. Si desea realizar una compilación cruzada, hágalo una vez que haya reiniciado el sistema para que el compilador cruzado de GCC pueda localizarse a través de $PATH de su usuario. También tiene la opción de agregar este comando a tu **~/.profile** como configuración permanente. Si decide o no agregar permanentemente el PATH de GCC a su perfil ~/.profile depende totalmente de usted. Si está usando su sistema actual Slackware ARM para construir exclusivamente paquetes aarch64 (arm64), entonces tendría sentido hacerlo. |
| |
| Ejemplo de comandos para exportar: |
| |
Example export command: | |
| |
<code> | <code> |
</code> | </code> |
| |
The GCC aarch64-linux cross-compiler on your Slackware ARM system is now ready to //rock-n-roll!// | El compilador cruzado GCC aarch64-linux sobre tu sistema Slackware ARM está listo para //rock-n-roll!//. |
| |
==== Building the arm64 kernel, modules, and device tree blob (DTB) ==== | ==== Construyendo el kernel arm64, modulos, y and árbol de dispositivos blob (DTB) ==== |
| |
To build the aarch64 kernel, modules and device tree blob(s) is exactly the same method as you would carry it out under normal circumstances. Commands such as 'make bzImage && make modules && make modules_install' may be all too familiar to you. The major difference when cross-compiling is that you'll use certain Makefile options/variables/arguments/switches, commonly known as CFLAGS. In our case, CFLAGS will be used to instruct the GCC cross-compiler to build for the aarch64 (arm64) architecture specifically. | Para construir el kernel aarch64, módulos y el árbol de dispositivos blob(s) es exactamente el mismo método que el que se utilizaría en circunstancias normales. Comandos como 'make bzImage && make modules && make modules_install' pueden ser demasiado familiares para usted. |
| En nuestro caso, CFLAGS será usado para instruir al compilador cruzado de GCC a construir específicamente para la arquitectura aarch64 (arm64). |
| |
=== Creating the arm64 kernel .config === | === Creando el archivo .config del kernel arm64 === |
| |
First of all, as always, you need to be in the Raspberry Pi Linux kernel source directory which is in the 'build-dir' folder. Then you need to create a kernel .config file, based on Raspberry Pi 3 parameters. To keep it simple you can generate a default .config (**defconfig**) file. This file holds the Linux kernel configuration for the arm64 kernel you are going to build. To achieve this run the following commands: | Primero de todo, como siempre, es necesario estar en el directorio fuente del núcleo de Raspberry Pi Linux que está en la carpeta 'build-dir'. |
| Luego necesita crear un archivo .config para el kernel, basado en los parámetros de Raspberry Pi 3. |
| Para simplificar, puede generar un archivo por defecto .config (**defconfig**). |
| Este archivo contiene la configuración del núcleo de Linux para el núcleo arm64 que va a construir. Para ello ejecute los siguientes comandos: |
| |
<code> | <code> |
</code> | </code> |
| |
<note important>Make a note here of the CFLAGS which have been specified. They should be self-explanatory by now. Pay special attention to the trailing '-' of 'CROSS_COMPILE=aarch64-linux-' because that's **NOT** a typo. __It needs to be like that!__</note> | |
| |
=== Building the arm64 kernel === | <note important>Tome nota aquí de los CFLAGS que han sido especificados. Ya deberían ser auto-explicativos. Ponga especial atención al final '-' de 'CROSS_COMPILE=aarch64-linux-' porque eso **NO** es un error tipográfico. __¡Esto tiene que ser así!__</note> |
| |
Next up is building the kernel, based on the .config file you have just created. Again, you'll use the same CFLAGS as before. You can even set a 'LOCALVERSION' here which appends whatever you set to the end of the kernel version (e.g. LOCALVERSION="-arm64" would eventually give you 4.8.13-v8--arm64) once the kernel and modules have been built. Just as an example we'll use it here. Run the following command to start building the arm64 Linux kernel: | |
| === Construyendo el kernel arm64 === |
| Lo siguiente es construir el kernel, basado en el archivo .config que acabas de crear. Una vez más, usarás el mismo CFLAGS que antes. |
| Puede incluso establecer una 'LOCALVERSION' aquí que añada lo que haya establecido al final de la versión del núcleo (por ejemplo, LOCALVERSION="-arm64" le daría eventualmente 4.8.13-v8--arm64) una vez que el núcleo y los módulos hayan sido construidos. A modo de ejemplo lo usaremos aquí. |
| |
<code> | <code> |
</code> | </code> |
| |
So, here you 'make' the kernel which will be saved with the name '**Image**'. The rest you should be familiar with. This process will take a while. Maybe an hour or so. | Así, aquí `make' construye el núcleo que se guardará con el nombre '**Image**'. El resto debe estar familiarizado. Este proceso tomará un tiempo. Tal vez una hora más o menos. |
| |
| |
=== Building the arm64 device tree blob(s) === | === Construyendo el árbol de dispositivos blob(s) === |
| |
Device tree is a means of describing hardware which is read by the kernel at boot time to tell it what hardware exists on the system. In our case it relates to the Raspberry Pi 3 and is the method by which the systems knows which drivers to load for the hardware. On ARM-based devices the use of device trees has become mandatory for all new SOCs, including the Raspberry Pi. The device tree blobs you will be building are '**bcm2710-rpi-3-b.dtb**' and '**bcm2837-rpi-3-b.dtb**' | El árbol de dispositivos es un medio para describir el hardware que el núcleo (kernel) lee en el momento del arranque para saber qué hardware existe en el sistema. |
| En nuestro caso, se relaciona con la Raspberry Pi 3 y es el método por el cual el sistema sabe qué controladores cargar para el hardware. |
| En los dispositivos basados en ARM, el uso de árboles de dispositivos se ha vuelto obligatorio para todos los nuevos SOCs, incluyendo la Raspberry Pi. |
| Los arboles de dispositivos blobs que se construirán son '**bcm2710-rpi-3-b.dtb**' y '**bcm2837-rpi-3-b.dtb**'. |
| |
To build the Raspberry Pi device tree blob(s) run the following command: | Para construir el árbol de dispositivos blob(s) para la Raspberry Pi corra los siguientes comandos: |
| |
<code> | <code> |
</code> | </code> |
| |
It's basically the same as you did to build the kernel, only where 'Image' is substituted for '**dtbs**'. | Es básicamente lo mismo que hiciste para construir el núcleo, sólo que donde 'Image' es sustituido por '**dtbs**'. |
| |
=== Building the arm64 modules === | === Construyendo los módulos arm64 === |
| Para construir los módulos del núcleo se hace de la misma manera que antes. Ejecute el siguiente comando: |
To build the kernel modules you do it in much the same way as before. Run the following command: | |
| |
<code> | <code> |
</code> | </code> |
| |
Notice how each time the command is the same except when specifying what you're building. If you have set a 'LOCALVERSION' then it __must__ be kept the same for building the kernel and modules. This process will probably take a while longer than building the arm64 kernel. | Observe cómo cada vez que el comando es el mismo, excepto cuando se especifica lo que está construyendo. |
| Si ha establecido una 'LOCALVERSION' entonces __debe ser__ la misma para construir el kernel y los módulos. |
=== Installing the arm64 modules === | Este proceso probablemente tardará un poco más que la construcción del núcleo arm64. |
| |
Once the modules have been built, you have to 'make modules_install'. The process will install your kernel modules to '/tmp/lib/modules/4.8.13-v8'. | |
| |
You could build //out-of-tree// kernel modules but, to keep things simple, you're going to install them to the usual location. Again, you will use the same CFLAGS as before but without any 'LOCALVERSION' set. | === Instalando los módulos arm64 === |
| |
| Una vez que los módulos han sido construidos, se debe hacer 'make modules_install'. El proceso debería instalar los módulos de tu núcleo (kernel) en el directorio '/tmp/lib/modules/4.8.13-v8'. |
| |
First you need become '**root**' user and enter a passwd when prompted. To install the aarch64 modules run the following commands: | Usted podría construir módulos //out-of-tree/// kernel pero, para mantener las cosas simples, los va a instalar en la ubicación usual.Una vez más, usted usará el mismo CFLAGS que antes pero sin ninguna configuración de 'LOCALVERSION'. |
| Primero necesitas convertirte en usuario '**root**' e introducir una contraseña cuando se te pida. Para instalar los módulos de aarch64 ejecute los siguientes comandos: |
| |
<code> | <code> |
</code> | </code> |
| |
<note important>You need to be '**root**' user to install the arm64 modules. A normal user does not have the rights to do so!</note> | <note important>Es necesario ser usuario '**root**', o tener permisos de administrador, para instalar los módulos arm64. ¡Un usuario normal no tiene permisos para hacer esto!</note> |
| |
So, as I'm a great believer in being thorough, I always verify things at every opportunity. Just to be sure, if nothing else, because it's always a good policy. Make sure the files and directories you have just spent quite a bit of time compiling actually do exist on your system and that they're in the right place. If this is the first time you have installed the GCC cross-compiler on your system and/or built the kernel, modules, and device tree blob(s), then it goes without saying. You could actually do this after each build process, which I often do as well. | Así que, como soy un gran creyente en ser minucioso, siempre verifico las cosas en cada oportunidad. Soló para estar seguros, si no hay nada más, porque siempre es una buena política. |
| Asegúrese de que los archivos y directorios que acaba de pasar bastante tiempo compilando realmente existen en su sistema y que están en el lugar correcto. |
| Si esta es la primera vez que instala el compilador cruzado de GCC en su sistema y/o construye el kernel, los módulos y el árbol de dispositivos (blob(s)), entonces no hace falta decirlo. |
| Podrías hacer esto después de cada proceso de construcción, lo que yo también hago a menudo. |
| |
<code> | <code> |
</code> | </code> |
| |
If you can see that they all exist, then everything has worked as planned. | Si puedes ver que todos ellos existen, entonces todo ha funcionado según lo planeado. |
| |
==== Copying the arm64 kernel, modules, and device tree blobs (DTB) ==== | ==== Copiando el kernel arm64, modulos, y el árbol de dispositivos blobs (DTB) ==== |
| |
Connect the (spare) microSD card containing a working Slackware ARM current system to your Raspberry Pi 3 using a USB microSD card reader. You'll need to mount the partitions first, before copying the arm64 kernel, modules, and device tree blob(s) onto it. | Conecte la tarjeta microSD (de repuesto) que contiene un sistema current Slackware ARM que funciona en su Raspberry Pi 3 usando un lector de tarjetas microSD USB. |
| Primero es necesario montar la patición, luego copiar el kernel arm64, los módulos y el árbol de dispositivos blob(s) en ella. |
You should still be logged in as '**root**' user. If not, type the following command and enter the passwd for the 'root' user when prompted: | Usted debería estar logeado como usuario '**root**'. Si no, escriba los siguientes comando e ingrese la clave del usuario 'root' cuando se la pida: |
| |
<code> | <code> |
</code> | </code> |
| |
<note important>You need to be '**root**' user to carry out any mount procedures. A normal user does not have the rights to do so!</note> | |
| |
As 'root' user type the following command: | <note important>Es necesario ser usuario '**root**' para llevar adelante cualquier procedimiento de montaje. ¡Un usuario normal no tiene privilegios para hacer esto!</note> |
| |
| Como usuario 'root' escriba los siguientes comandos: |
| |
<code> | <code> |
</code> | </code> |
| |
This should show you which device the (spare) microSD card is using on your system. In our case it's a 32GB card and has been identified as '**/dev/sda**', as shown below. This tells us that '**/dev/sda1**' is our /boot partition and '**/dev/sda3**' is our root filesystem partition. Yours may be allocated differently so bear that in mind. | Este comando debería mostrarle qué dispositivo está usando la tarjeta microSD (de repuesto) en su sistema. En nuestro caso es una tarjeta de 32 GB y es identificada como '**/dev/sda**', como se muestra a continuación. |
| Esto nos dice que ''**/dev/sda1**'' es nuestra partición /boot y '**/dev/sda3**' es nuestra partición raíz. |
| Los tuyos pueden ser asignados de manera diferente, así que tenlo en cuenta. |
| |
<code> | <code> |
</code> | </code> |
| |
In order to mount the partitions you first need to create mount directories. Working in the /tmp directory you can do it like this: | Con el objetivo de montar las particiones primero necesitas crear los puntos de montaje. Trabajando en el directorio /tmp puedes hacerlo así: |
| |
<code> | <code> |
</code> | </code> |
| |
To check that you've done this correctly, use the '**mount**' command. The output from this should give you something similar to the following: | Para comprobar que estas haciendo todo correctamente, usa el comando '**mount**'. La salida salida de esto debe ser similar a los siguiente: |
| |
<code> | <code> |
</code> | </code> |
| |
The next thing to do is copy the arm64 kernel, modules, and device tree blobs to your newly mounted directories. It's important to get this right. After all the hard work you've done it would be a shame to mess it up at this stage. | Lo siguiente que hay que hacer es copiar el núcleo, los módulos y el árbol de dispositivos blobs de arm64 a los directorios recién montados. Es importante hacer esto bien. Después de todo el trabajo duro que has hecho, sería una pena estropearlo en este momento. |
| |
To copy these files, run the following commands, as '**root**' user: | Para copiar estos archivos, como usuario '**root**', ejecuta los siguientes comandos: |
| |
<code> | <code> |
</code> | </code> |
| |
Once you have done that, check that the files you have copied are present and in the right place. | Una vez hecho esto, compruebe que los archivos que ha copiado están presentes y en el lugar correcto. |
| |
<code> | <code> |
</code> | </code> |
| |
If it all looks fine and dandy then the next thing you need to do is delete the old armv7 kernel in the rpi-boot/boot directory. This old kernel is named '**kernel7.img**' and to avoid any conflicts with the new arm64 'kernel8.img' you should remove it. | Si todo se ve bien, entonces lo siguiente que necesita hacer es borrar el antiguo kernel armv7 en el directorio rpi-boot/boot. |
| Este antiguo núcleo se llama '**kernel7.img**' y para evitar cualquier conflicto con el nuevo arm64 'kernel8.img' debería eliminarlo |
<code> | <code> |
rm -rf rpi-boot/kernel7.img | rm -rf rpi-boot/kernel7.img |
</code> | </code> |
| |
No changes to the config.txt or cmdline.txt file(s) should be necessary. If you are using a recent blootloader/GPU firmware version (i.e. post-September 2016) then nothing else needs to be changed or deleted. The system should boot using all your existing settings. | No debería ser necesario cambiar los archivos config.txt o cmdline.txt. Si estas utilizando un bootloader/firmware GPU (por ejemplo post-septiembre 2016) entonces nada más es necesario cambiar o borrar. |
| |
Now you can unmount the previously mounted directories. | Ahora puedes desmontar los directorios previamente montados. |
| |
<code> | <code> |
</code> | </code> |
| |
=== Booting Slackware ARM aarch64 === | === Arrancando Slackware ARM aarch64 === |
| |
Power off your Raspberry Pi. | Apaga tu Raspberry Pi. |
<code> | <code> |
poweroff | poweroff |
</code> | </code> |
| |
Remove the USB microSD card reader and swap microSD cards. Power on the Raspberry Pi and boot the microSD card on which you copied the arm64 kernel, modules, and device tree blobs. | Sacar la memoria microSD y tarjetas swaps. Encender la Raspberry Pi y arrancar con la memoria microSD sobre la cual fue copiado el kernel, los módulos y el árbol de directorio de dispositivos blobs. |
| |
==== El resultado final ==== | ==== El resultado final ==== |
| |
After booting the system with the arm64 kernel, I logged in remotely via SSH as 'root' user. Then I ran the following commands: | Luego de arrancar el sistema con el kernel arm64, yo me logue de forma remota via SSH como el usuario 'root'. Entonces yo ejecute los siguientes comandos: |
| |
<code> | <code> |
</code> | </code> |
| |
Although I've already come across a few things which need some work, and attention, it's a start. I hope to find more time to devote towards Slackware arm64 over Christmas and the New Year 2017. | Aunque ya me he encontrado con algunas cosas que necesitan trabajo y atención, es un comienzo. Espero encontrar más tiempo para dedicar a Slackware arm64 en navidad y año Nuevo 2017. |
| Gracias por su interés. <3 |
Thanks for being interested. <3 | |
| |
====== Fuentes ====== | ====== Fuentes ====== |
<!-- * Original source: [[http://some.website.org/some/page.html]] --> | <!-- * Original source: [[http://some.website.org/some/page.html]] --> |
<!-- Authors are allowed to give credit to themselves! --> | <!-- Authors are allowed to give credit to themselves! --> |
* Originally written by [[wiki:user:exaga | Exaga]] | * Escrito originalmente por [[wiki:user:exaga | Exaga]]. |
<!-- * Contributions by [[wiki:user:yyy | User Y]] --> | <!-- * Contributions by [[wiki:user:yyy | User Y]] --> |
| |