Yocto : Creando Imágenes para Raspberry Pi - ASTROINGENIERIA/ASTROUFRO GitHub Wiki
- Ubuntu 16.04 LTS
- Paquetes necesarios: git, texinfo, gawk, chrpath
- Se necesitan 50 Gbytes de disco disponibles
Todos el procedimiento se realizará en el subdirectorio ~/software/yocto
- En
~/software/yoctose crea un subdirectoriobuildsen donde se guardarán las diferentes imágenes generadas. En el caso de la imagen para el Raspberry Pi 2, crearemos dentro debuildsel subdirectoriosrdpara la imagen correspondiente a una tarjeta sd:$ mkdir -p ~/software/yocto/builds/sdr - Finalmente creamos el subdirectorio en donde se guardarán todos los paquetes bajados desde Internet, necesarios para generar el build:
$ mkdir ~/software/yocto/downloads
Ahora clonaremos Yocto desde su repositorio Git. Para mayor información ver en Yocto Downloads
$ cd ~/software/yocto
- Primero, bajamos el código base de Yocto:
$ git clone -b jethro git://git.yoctoproject.org/poky.git
- Luego, bajamos los layers necesarios para crear los componentes asociados a nuestra imagen:
$ git clone -b jethro git://github.com/openembedded/meta-openembedded.git
- Para el Raspberry Pi, se deben incluir además:
$ git clone -b jethro http://git.yoctoproject.org/git/meta-raspberrypi
- Para agregar los layers de Ice:
$ git clone -b jethro git://github.com/zeroc-ice/meta-zeroc.git
Una vez que se tenga claro cual será el directorio donde se generará el build, se debe setear este directorio
mediante el script oe-init-build-env. El argumento del script es el directorio donde se generará el build:
$ source ~/software/yocto/poky/oe-init-build-env ~/software/yocto/builds/sdr
- Editar
conf/local.confy setear la variable ''MACHINE ?= ...'' conMACHINE = "raspberrypi2" - Luego,se define el directorio donde se guardaran los paquetes bajados desde internet:
DL_DIR = "/....../yocto/downloads"
- Agrega las librerías para Ice
# Install Ice for C++ dynamic libraries and Ice for Python to image IMAGE_INSTALL_append = " zeroc-ice zeroc-ice-python" # Add the development package to the SDK TOOLCHAIN_TARGET_TASK_append = " zeroc-ice-dev zeroc-ice-staticdev" # Add the development package to the Native SDK TOOLCHAIN_HOST_TASK_append = " nativesdk-zeroc-ice-dev"
Next, we need to inform the build system of where it can find recipes. This is done via the ''conf/bblayers.conf'' file.
Edit this file to add the ''meta-openembedded'' and ''meta-sdr'' layers.
Also, add any of the layers you fetched for your specific hardware platform. For example, for the Raspberry Pi, your BBLAYERS definition would look similar to this:
BBLAYERS ?= " \ /....../yocto/poky-jethro-2.0/meta \ /....../yocto/poky-jethro-2.0/meta-yocto \ /....../yocto/poky-jethro-2.0/meta-yocto-bsp \ /....../yocto/meta-openembedded/meta-oe \ /....../yocto/meta-openembedded/meta-filesystems \ /....../yocto/meta-openembedded/meta-networking \ /....../yocto/meta-openembedded/meta-python \ /....../yocto/meta-raspberrypi \ /....../yocto/meta-zeroc \ "
Como lo dice su nombre el ''core-image-base'' es una imagen ...
Asimiendo que esta en el directorio builds/sdr, se invoca el programa bitbake para generar esta imagen:
bitbake core-image-minimal
$ dd if=tmp/deploy/images/raspberrypi2/core-image-base-raspberrypi2.rpi-sdimg of=/dev/dispositivo_sdd $ sync # Espera un par de segundo después de completada la tarea
Donde dispositivo_sdd corresponde al dispositivo de la tarjeta sd, el cual se puede encontrar ejecutando el comando df -h:
$ df -h S.ficheros Tamaño Usados Disp Uso% Montado en udev 3,9G 0 3,9G 0% /dev tmpfs 789M 9,5M 779M 2% /run /dev/sda2 909G 51G 812G 6% / tmpfs 3,9G 37M 3,9G 1% /dev/shm tmpfs 5,0M 4,0K 5,0M 1% /run/lock tmpfs 3,9G 0 3,9G 0% /sys/fs/cgroup /dev/sda1 511M 3,6M 508M 1% /boot/efi cgmfs 100K 0 100K 0% /run/cgmanager/fs tmpfs 789M 68K 789M 1% /run/user/1000 /dev/mmcblk0p1 7,4G 4,0K 7,4G 1% /media/pgaleas/y2
En este caso el dispositivo sería : /dev/mmcblk0
No confundir con: /dev/mmcblk0p1 que corresponde a la partición p1 del mismo dispositivo.