Yocto Project – Construindo uma distribuição para RaspberryPI

 

Vamos ver neste post como obter e configurar a ferramenta que irá customizar uma distribuição Linux para a Raspberry PI B.

Vamos usar entre as ferramentas disponíveis a Yocto Project, se você não conhece, acesse este post antes de continuar Yocto Project – Introdução[link].

 

Preparando o território

Primeiro, vamos preparar nosso computador/notebook para usar a ferramenta, estou usando como ambiente o Linux Mint 15, o procedimento abaixo pode ser replicado para um Ubuntu, Debian sem problemas e vamos instalar as seguintes dependências:

sudo apt-get update && sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat automake autoconf libtool libglib2.0-dev u-boot-tools xterm

Se você esta usando outra distribuição, recomendo que acesse o Required Packages for the Host Development System[link] e verifique os pacotes que devem ser instalados em outras distribuições.

 

Obtendo o Yocto Project

Digamos que para “instalar” a ferramenta Yocto Project é bem fácil e tranquilo, o melhor de tudo isso que não poderíamos dizer que é instalação, porque na verdade clonamos o repositório do git, que é uma excelente opção para este tipo de ferramenta que sofre constantes atualizações.

No meu caso, e acho que é uma boa prática, irei clonar o repositório no home do meu usuário, outra questão a levantar é o branch a ser clonado, hoje na data que escrevo este post o Yocto Project esta na versão 1.8 (fido), porém a que vamos utilizar é a 1.7.1 (dizzy) que é a que mais utilizo depois da 1.6.2 (daizy), mais sobre as versões você pode ver no Yocto Project Wiki – Release[link].

Clonando o repositório para o computador/notebook.

bueno@nb-bueno /home/bueno/yocto $ time git clone -b dizzy git://git.yoctoproject.org/poky poky-dizzy
Cloning into 'poky-dizzy'...
remote: Counting objects: 269340, done.
remote: Compressing objects: 100% (66400/66400), done.
remote: Total 269340 (delta 197724), reused 269057 (delta 197473)
Receiving objects: 100% (269340/269340), 110.55 MiB | 303 KiB/s, done.
Resolving deltas: 100% (197724/197724), done.

real	6m7.831s
user	0m18.952s
sys	0m7.284s

A etapa de clonar o repositório é para ser rápida, porque não é tão grande, acima o tempo que levou no meu caso. Vamos ver como ficou o diretório.

bueno@nb-bueno /home/bueno/yocto/poky-dizzy $ ls -1
bitbake
documentation
LICENSE
meta
meta-oe
meta-selftest
meta-skeleton
meta-yocto
meta-yocto-bsp
oe-init-build-env
oe-init-build-env-memres
README
README.hardware
scripts

 

O Yocto Project não é muito grande, mas é bom ter um bom espaço em disco, porque depois da construção da distribuição o seu HD não será mais o mesmo :).

 

Yocto Project e a Raspberry PI

Já preparamos o ambiente e obtemos a ferramenta, porém ainda não é possível construir a distribuição para a RaspberryPI, desta maneira até agora conseguimos construir para testar com qemux86 e para a Beaglebone Black, no caso para a RaspberryPI devemos adicionar a camada meta-raspberrypi.

Para saber qual a camada, ou que deve-se “clonar”, ou qual receita(recipe) já possui ou deve fazer uma, você pode descobrir acessando OpenEmbedded Metadata Index[link].

Pesquisando no branch dizzy, por machine com “raspberrypi”[link], obtemos a saída da Figura01.

OpenEmbeddedLayerRaspberryPI
Figura01 – Camada para RaspberryPI

Clicando em meta-raspberrypi abaixo de Layer irá nos levar para uma descrição de tudo que tem nessa camada e o caminho do repositório para ser adicionado, que é o que vamos fazer agora, acessando o diretório poky-dizzy e adicionando o repositório.

bueno@nb-bueno /home/bueno/yocto $ cd poky-dizzy
bueno@nb-bueno /home/bueno/yocto/poky-dizzy $ time git clone -b dizzy git://git.yoctoproject.org/meta-raspberrypi
Cloning into 'meta-raspberrypi'...
remote: Counting objects: 1834, done.
remote: Compressing objects: 100% (1102/1102), done.
remote: Total 1834 (delta 800), reused 1598 (delta 564)
Receiving objects: 100% (1834/1834), 331.46 KiB | 160 KiB/s, done.
Resolving deltas: 100% (800/800), done.

real	0m3.641s
user	0m0.080s
sys	0m0.068s

Muito rápido, porque a camada é bem pequena.

 

Criando o projeto

Com o ambiente preparado, yocto project(bitbake, poky e demais) já local, e com as camadas que precisamos já adicionadas, agora é só criar o projeto e configurar.

Para criar o projeto é muito fácil, já existe um script da própria ferramenta para isso, o oe-init-build-env.

bueno@nb-bueno /home/bueno/yocto/poky-dizzy $ source oe-init-build-env myrasppi
You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to use a 
different MACHINE (target hardware) or enable parallel build options to take 
advantage of multiple cores for example. See the file for more information as 
common configuration options are commented.

You had no conf/bblayers.conf file. The configuration file has been created for
you with some default values. To add additional metadata layers into your
configuration please add entries to this file.

The Yocto Project has extensive documentation about OE including a reference
manual which can be found at:
    http://yoctoproject.org/documentation

For more information about OpenEmbedded see their website:
    http://www.openembedded.org/


### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    adt-installer
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'
bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi $

Então, executando o comando como na tela acima, o diretório myrasppi é criado (myrasppi é o nome do meu projeto) e com toda a estrutura minima para construir uma distribuição.

bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi $ tree
.
└── conf
    ├── bblayers.conf
    ├── local.conf
    └── templateconf.cfg

 

Configurando o projeto

Depois de criar o projeto, vamos realizar uma configuração que não é obrigatória, mas que irá ajudar e/ou acelerar o processo agora e para futuros builds.

Primeiro configurando o conf/bblayers.conf e adicionar nossa nova camada meta-raspberrypi.

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "6" 

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \ 
  ${TOPDIR}/../meta \
  ${TOPDIR}/../meta-yocto \
  ${TOPDIR}/../meta-yocto-bsp \
  ${TOPDIR}/../meta-raspberrypi \
  "
BBLAYERS_NON_REMOVABLE ?= " \ 
  ${TOPDIR}/../meta \
  ${TOPDIR}/../meta-yocto \
  "

Em seguida,  editar o conf/local.conf onde iremos dizer que deverá ser criado a distribuição e toda estrutura para uma RaspberryPI, o arquivo é grande porém vou mostrar apenas as linhas que você deve procurar e alterar ou caso não exista, deve ser adicionada.

#MACHINE ?= "qemux86-64"
#
# There are also the following hardware board target machines included for 
# demonstration purposes:
#
#MACHINE ?= "beaglebone"
#MACHINE ?= "genericx86"
#MACHINE ?= "genericx86-64"
#MACHINE ?= "mpc8315e-rdb"
#MACHINE ?= "edgerouter"
#
# This sets the default machine to be qemux86 if no other machine is selected:
MACHINE ??= "raspberrypi"


# Aumente ou diminua conforme sua necessidade e hardware
BB_NUMBER_THREADS ?= "4"
PARALLEL_MAKE ?= "-j 4"


# Onde irão ficar os downloads, muito útil
DL_DIR ?= "${TOPDIR}/../dl"


SSTATE_DIR ?= "${TOPDIR}/sstate-cache"


TMPDIR = "${TOPDIR}/tmp"

No começo é difícil entender toda a estrutura, só para deixar mais fácil de compreender, a variável TOPDIR é referência ao diretório do seu projeto, no meu caso seria /home/bueno/yocto/poky-dizzy/myrasppi que é o Build Directory[link] para a ferramenta.

 

Construindo a distribuição

Já era hora não? A hora tão esperada e mais demorada do post. Agora que iremos usar o poder da ferramenta, alias, a ferramenta e o computador em si, porque nós iremos apenas pegar o resultado final.

Vamos usar a core-image-minimal, é a receita de image mais enxuta “pronta” que a ferramenta oferece que vai dar vida a nossa plaquinha.

O processo para construir, onde entra checar o que foi configurado, baixar todos os pacotes e dependência, configurar, compilar, construir pacotes e por fim montar o rootfs e gerar image final.

bueno@nb-bueno /home/bueno/yocto/poky-dizzy $ source oe-init-build-env myrasppi

bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi $ time bitbake core-image-minimal
WARNING: Host distribution "LinuxMint-15" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Loading cache: 100% |###################################################################################################################################| ETA:  00:00:00
Loaded 1314 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.24.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "LinuxMint-15"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "raspberrypi"
DISTRO            = "poky"
DISTRO_VERSION    = "1.7.2"
TUNE_FEATURES     = "arm armv6 vfp"
TARGET_FPU        = "vfp"
meta              
meta-yocto        
meta-yocto-bsp    = "dizzy:29812e61736a95f1de64b3e9ebbb9c646ebd28dd"
meta-raspberrypi  = "dizzy:efd760d0a2c027fe20ed190c56f416d0a47d7c41"

NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: Failed to fetch URL http://zlib.net/pigz/pigz-2.3.1.tar.gz, attempting MIRRORS if available
WARNING: Failed to fetch URL ftp://ftp.debian.org/debian/pool/main/b/base-passwd/base-passwd_3.5.29.tar.gz, attempting MIRRORS if available
NOTE: validating kernel config, see log.do_kernel_configcheck for details
WARNING: Failed to fetch URL ftp://ftp.debian.org/debian/pool/main/n/netbase/netbase_5.2.tar.gz, attempting MIRRORS if available
WARNING: Failed to fetch URL ftp://ftp.debian.org/debian/pool/main/d/dpkg/dpkg_1.17.4.tar.xz, attempting MIRRORS if available
WARNING: Failed to fetch URL ftp://ftp.uni-erlangen.de/pub/Linux/LOCAL/dosfstools/dosfstools-2.11.src.tar.gz, attempting MIRRORS if available
WARNING: Failed to fetch URL http://ftp.de.debian.org/debian/pool/main/m/mklibs/mklibs_0.1.39.tar.xz, attempting MIRRORS if available
NOTE: Tasks Summary: Attempted 1986 tasks of which 9 didn't need to be rerun and all succeeded.

Summary: There were 7 WARNING messages shown.

real	140m14.048s
user	299m53.452s
sys	46m37.560s

A ferramenta que faz tudo isso é a bitbake e em seguida a receita core-image-minimal, o comando time antes é apenas para mostrar o tempo que a tarefa levou.

Nessa hora é bom você ir assistir um filme, tomar um café, alias, vários cafés.

Olhe o tempo que foi gasto para realizar todo o processo e entregar tudo prontinho pra você.

Agora uma visualização geral do tamanho dos diretórios do Yocto Project e o nosso projeto.

--- /home/bueno/yocto/poky-dizzy ----------------------------------------------------------
   14,7GiB [##########] /myrasppi
    5,6GiB [###       ] /dl
  121,5MiB [          ] /.git
   43,3MiB [          ] /meta-oe
   30,7MiB [          ] /meta
   21,9MiB [          ] /meta-ti
   13,5MiB [          ] /documentation
   10,3MiB [          ] /bitbake
    2,8MiB [          ] /scripts
    1,2MiB [          ] /meta-raspberrypi
  404,0KiB [          ] /meta-yocto
  224,0KiB [          ] /meta-yocto-bsp
  168,0KiB [          ] /meta-skeleton
   76,0KiB [          ] /meta-selftest
   20,0KiB [          ]  README.hardware
    4,0KiB [          ]  oe-init-build-env-memres
    4,0KiB [          ]  README
    4,0KiB [          ]  oe-init-build-env
H   4,0KiB [          ]  LICENSE
    4,0KiB [          ]  .gitignore
    4,0KiB [          ]  .templateconf

Como pode ver, só do nosso projeto foram quase 15G. A documentação da Yocto Project recomenda possuir 50G livre.

 

Gravando o SD-Card

No caso, sempre ao final do processo de construção, o resultado final(rootfs, kernel, bootloader, kernel-modules e afins) estão em projeto_criado/tmp/deploy/images/ no nosso caso myrasppi/tmp/deploy/images/rasppberrypi/.

bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi/tmp/deploy/images/raspberrypi $ ls -lh
total 170M
drwxr-xr-x 2 bueno bueno 4,0K Mai  1 04:21 bcm2835-bootfiles
-rw-r--r-- 1 bueno bueno  64M Mai  1 04:24 core-image-minimal-raspberrypi-20150501050433.rootfs.ext3
-rw-r--r-- 1 bueno bueno 112K Mai  1 04:24 core-image-minimal-raspberrypi-20150501050433.rootfs.manifest
-rw-r--r-- 1 bueno bueno  88M Mai  1 04:24 core-image-minimal-raspberrypi-20150501050433.rootfs.rpi-sdimg
-rw-r--r-- 1 bueno bueno  16M Mai  1 04:24 core-image-minimal-raspberrypi-20150501050433.rootfs.tar.bz2
lrwxrwxrwx 1 bueno bueno   57 Mai  1 04:24 core-image-minimal-raspberrypi.ext3 -> core-image-minimal-raspberrypi-20150501050433.rootfs.ext3
lrwxrwxrwx 1 bueno bueno   61 Mai  1 04:24 core-image-minimal-raspberrypi.manifest -> core-image-minimal-raspberrypi-20150501050433.rootfs.manifest
lrwxrwxrwx 1 bueno bueno   62 Mai  1 04:24 core-image-minimal-raspberrypi.rpi-sdimg -> core-image-minimal-raspberrypi-20150501050433.rootfs.rpi-sdimg
lrwxrwxrwx 1 bueno bueno   60 Mai  1 04:24 core-image-minimal-raspberrypi.tar.bz2 -> core-image-minimal-raspberrypi-20150501050433.rootfs.tar.bz2
lrwxrwxrwx 1 bueno bueno   92 Mai  1 03:47 Image -> Image--3.12.26+gitf03cd5e1012d3fe8314a944879308cf0f3d9e29b-r0-raspberrypi-20150501050433.bin
-rw-r--r-- 2 bueno bueno 6,2M Mai  1 03:46 Image--3.12.26+gitf03cd5e1012d3fe8314a944879308cf0f3d9e29b-r0-raspberrypi-20150501050433.bin
lrwxrwxrwx 1 bueno bueno   92 Mai  1 03:47 Image-raspberrypi.bin -> Image--3.12.26+gitf03cd5e1012d3fe8314a944879308cf0f3d9e29b-r0-raspberrypi-20150501050433.bin
-rw-r--r-- 2 bueno bueno  12M Mai  1 03:47 modules--3.12.26+gitf03cd5e1012d3fe8314a944879308cf0f3d9e29b-r0-raspberrypi-20150501050433.tgz
lrwxrwxrwx 1 bueno bueno   94 Mai  1 03:47 modules-raspberrypi.tgz -> modules--3.12.26+gitf03cd5e1012d3fe8314a944879308cf0f3d9e29b-r0-raspberrypi-20150501050433.tgz
-rw-r--r-- 2 bueno bueno  294 Mai  1 04:21 README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt

Certo, não é difícil entender o que foi feito, em si no diretório bcm2835-bootfiles estão os arquivos configuração e binários para o bootloader, gerado o kernel (Image-raspberrypi.bin) que é um link-simbólico para Image–3.12.26+…tgz, o modules-raspberrypi.tgz que é outro link-simbólico para modules–3.12.26+…tgz e o rootfs, que é gerado um .ext3, .tar.bz2, e um .rpi-sdimg.

No caso do RaspberryPI, o core-image-minimal-raspberrypi.rpi-sdimg é o maior de todos, porque ele é a junção de bootloader + kernel + rootfs em um único arquivo para você apenas gravar no SD-Card, simples assim. Olhe a estrutura desse cara.

bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi/tmp/deploy/images/raspberrypi $ file core-image-minimal-raspberrypi.rpi-sdimg 
core-image-minimal-raspberrypi.rpi-sdimg: symbolic link to `core-image-minimal-raspberrypi-20150501050433.rootfs.rpi-sdimg'
bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi/tmp/deploy/images/raspberrypi $ file core-image-minimal-raspberrypi-20150501050433.rootfs.rpi-sdimg
core-image-minimal-raspberrypi-20150501050433.rootfs.rpi-sdimg: x86 boot sector; partition 1: ID=0xc, active, starthead 0, startsector 8192, 40960 sectors; partition 2: ID=0x83, starthead 0, startsector 49152, 131072 sectors, code offset 0xb8
bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi/tmp/deploy/images/raspberrypi $ fdisk -l core-image-minimal-raspberrypi.rpi-sdimg 

Disk core-image-minimal-raspberrypi.rpi-sdimg: 92 MB, 92274688 bytes
4 heads, 32 sectors/track, 1408 cylinders, total 180224 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bdcee

                                   Device Boot      Start         End      Blocks   Id  System
core-image-minimal-raspberrypi.rpi-sdimg1   *        8192       49151       20480    c  W95 FAT32 (LBA)
core-image-minimal-raspberrypi.rpi-sdimg2           49152      180223       65536   83  Linux

O comando a seguir mostra como gravar no SD-Card.

bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi/tmp/deploy/images/raspberrypi $ sudo umount -f /dev/sdb*
bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi/tmp/deploy/images/raspberrypi $ sudo dd if=core-image-minimal-raspberrypi.rpi-sdimg of=/dev/sdb
180224+0 records in
180224+0 records out
92274688 bytes (92 MB) copied, 30,125 s, 3,1 MB/s
bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi/tmp/deploy/images/raspberrypi $ sync
bueno@nb-bueno /home/bueno/yocto/poky-dizzy/myrasppi/tmp/deploy/images/raspberrypi $ sudo umount -f /dev/sdb1 && sudo umount -f /dev/sdb2

OBS: No meu caso, o SD-Card esta no /dev/sdb, em caso de duvidas, execute o sudo fdisk -l ou o gparted para interface gráfica e certifique qual o device do seu SD-Card.

Testando

Agora vamos inserir o SD-CARD na Raspberry PI e ligar.

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.12.26 (bueno@nb-bueno) (gcc version 4.9.1 (GCC) ) #1 PREEMPT Fri May 1 03:06:02 BRT 2015
[    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] Machine: BCM2708
[    0.000000] cma: CMA: reserved 8 MiB at 1b800000
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] On node 0 totalpages: 114688
[    0.000000] free_area_init_node: node 0, pgdat c0627b48, node_mem_map c06d8000
[    0.000000]   Normal zone: 896 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 114688 pages, LIFO batch:31
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 113792
[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0xf bcm2708.serial=0x83fb188b smsc95xx.macaddr=B8:27:EB:FB:18:8B sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait debug
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 439496K/458752K available (4441K kernel code, 241K rwdata, 1444K rodata, 143K init, 701K bss, 19256K reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xdc800000 - 0xff000000   ( 552 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdc000000   ( 448 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc05c7820   (5887 kB)
[    0.000000]       .init : 0xc05c8000 - 0xc05ebe64   ( 144 kB)
[    0.000000]       .data : 0xc05ec000 - 0xc0628660   ( 242 kB)
[    0.000000]        .bss : 0xc062866c - 0xc06d7e28   ( 702 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:394
[    0.000000] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 4294967ms
[    0.000000] Switching to timer-based delay loop
[    0.000000] Console: colour dummy device 80x30
[    0.000393] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=10000)
[    0.000416] pid_max: default: 32768 minimum: 301
[    0.000883] Mount-cache hash table entries: 512
[    0.001662] Initializing cgroup subsys memory
[    0.001739] Initializing cgroup subsys devices
[    0.001757] Initializing cgroup subsys freezer
[    0.001772] Initializing cgroup subsys blkio
[    0.001894] CPU: Testing write buffer coherency: ok
[    0.002322] Setting up static identity map for 0xc043a938 - 0xc043a994
[    0.004175] devtmpfs: initialized
[    0.020134] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[    0.021656] NET: Registered protocol family 16
[    0.026956] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.027566] cpuidle: using governor ladder
[    0.027588] cpuidle: using governor menu
[    0.027981] bcm2708.uart_clock = 0
[    0.029732] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[    0.029754] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.029769] mailbox: Broadcom VideoCore Mailbox driver
[    0.029845] bcm2708_vcio: mailbox at f200b880
[    0.029929] bcm_power: Broadcom power driver
[    0.029948] bcm_power_open() -> 0
[    0.029959] bcm_power_request(0, 8)
[    0.530667] bcm_mailbox_read -> 00000080, 0
[    0.530685] bcm_power_request -> 0
[    0.530897] Serial: AMBA PL011 UART driver
[    0.531047] dev:f1: ttyAMA0 at MMIO 0x20201000 (irq = 83, base_baud = 0) is a PL011 rev3
[    0.912782] console [ttyAMA0] enabled
[    0.939044] bio: create slab <bio-0> at 0
[    0.944481] SCSI subsystem initialized
[    0.948430] usbcore: registered new interface driver usbfs
[    0.954099] usbcore: registered new interface driver hub
[    0.959623] usbcore: registered new device driver usb
[    0.966137] Switched to clocksource stc
[    0.970358] FS-Cache: Loaded
[    0.973488] CacheFiles: Loaded
[    0.988774] NET: Registered protocol family 2
[    0.994186] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
[    1.001555] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[    1.008116] TCP: Hash tables configured (established 4096 bind 4096)
[    1.014535] TCP: reno registered
[    1.017809] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    1.023654] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    1.030364] NET: Registered protocol family 1
[    1.035239] RPC: Registered named UNIX socket transport module.
[    1.041258] RPC: Registered udp transport module.
[    1.045958] RPC: Registered tcp transport module.
[    1.050686] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.057991] bcm2708_dma: DMA manager at f2007000
[    1.062695] bcm2708_gpio: bcm2708_gpio_probe c05f9ed0
[    1.068226] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[    1.077764] audit: initializing netlink socket (disabled)
[    1.083229] type=2000 audit(0.930:1): initialized
[    1.248445] VFS: Disk quotas dquot_6.5.2
[    1.252666] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    1.261571] FS-Cache: Netfs 'nfs' registered for caching
[    1.268455] NFS: Registering the id_resolver key type
[    1.273588] Key type id_resolver registered
[    1.277884] Key type id_legacy registered
[    1.282611] msgmni has been set to 874
[    1.288345] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.296042] io scheduler noop registered
[    1.300082] io scheduler deadline registered
[    1.304653] io scheduler cfq registered (default)
[    1.310684] BCM2708FB: allocated DMA memory 5bc00000
[    1.315695] BCM2708FB: allocated DMA channel 0 @ f2007000
[    1.332641] Console: switching to colour frame buffer device 82x26
[    1.419416] uart-pl011 dev:f1: no DMA platform data
[    1.424340] kgdb: Registered I/O driver kgdboc.
[    1.429580] vc-cma: Videocore CMA driver
[    1.433504] vc-cma: vc_cma_base      = 0x00000000
[    1.438262] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    1.443653] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    1.458302] brd: module loaded
[    1.466491] loop: module loaded
[    1.469889] vchiq: vchiq_init_state: slot_zero = 0xdb800000, is_master = 0
[    1.477874] Loading iSCSI transport class v2.0-870.
[    1.483850] usbcore: registered new interface driver smsc95xx
[    1.489879] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.695812] Core Release: 2.80a
[    1.699043] Setting default values for core params
[    1.703858] Finished setting default values for core params
[    1.909532] Using Buffer DMA mode
[    1.912853] Periodic Transfer Interrupt Enhancement - disabled
[    1.918750] Multiprocessor Interrupt Enhancement - disabled
[    1.924319] OTG VER PARAM: 0, OTG VER FLAG: 0
[    1.928707] Dedicated Tx FIFOs mode
[    1.932568] WARN::dwc_otg_hcd_init:1042: FIQ DMA bounce buffers: virt = 0xdbc14000 dma = 0x5bc14000 len=9024
[    1.942453] FIQ FSM acceleration enabled for :
[    1.942453] Non-periodic Split Transactions
[    1.942453] Periodic Split Transactions
[    1.942453] High-Speed Isochronous Endpoints
[    1.959164] dwc_otg: Microframe scheduler enabled
[    1.963923] WARN::hcd_init:473: FIQ at 0xc0319030
[    1.968668] WARN::hcd_init:474: FIQ ASM at 0xc03192e4 length 36
[    1.974598] WARN::hcd_init:500: MPHI regs_base at 0xdc806000
[    1.980300] dwc_otg bcm2708_usb: DWC OTG Controller
[    1.985215] dwc_otg bcm2708_usb: new USB bus registered, assigned bus number 1
[    1.992515] dwc_otg bcm2708_usb: irq 32, io mem 0x00000000
[    1.998053] Init: Port Power? op_state=1
[    2.001970] Init: Power Port (0)
[    2.005470] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    2.012303] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.019550] usb usb1: Product: DWC OTG Controller
[    2.024252] usb usb1: Manufacturer: Linux 3.12.26 dwc_otg_hcd
[    2.030021] usb usb1: SerialNumber: bcm2708_usb
[    2.035397] hub 1-0:1.0: USB hub found
[    2.039294] hub 1-0:1.0: 1 port detected
[    2.043699] dwc_otg: FIQ enabled
[    2.047030] dwc_otg: NAK holdoff enabled
[    2.050952] dwc_otg: FIQ split-transaction FSM enabled
[    2.056093] Module dwc_common_port init
[    2.060425] usbcore: registered new interface driver usb-storage
[    2.066835] mousedev: PS/2 mouse device common for all mice
[    2.073088] bcm2835-cpufreq: min=700000 max=700000 cur=700000
[    2.078994] bcm2835-cpufreq: switching to governor powersave
[    2.084650] bcm2835-cpufreq: switching to governor powersave
[    2.090466] sdhci: Secure Digital Host Controller Interface driver
[    2.096719] sdhci: Copyright(c) Pierre Ossman
[    2.101143] sdhci: Enable low-latency mode
[    2.146196] mmc0: SDHCI controller on BCM2708_Arasan [platform] using platform's DMA
[    2.154179] mmc0: BCM2708 SDHC host at 0x20300000 DMA 2 IRQ 77
[    2.160257] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.168047] ledtrig-cpu: registered to indicate activity on CPUs
[    2.178363] hidraw: raw HID events driver (C) Jiri Kosina
[    2.187129] usbcore: registered new interface driver usbhid
[    2.192788] usbhid: USB HID core driver
[    2.201315] TCP: cubic registered
[    2.206737] Initializing XFRM netlink socket
[    2.213115] NET: Registered protocol family 17
[    2.217846] Key type dns_resolver registered
[    2.229722] registered taskstats version 1
�[    2.235235] Waiting for root device /dev/mmcblk0p2...
[    2.240637] Indeed it is in host mode hprt0 = 00021501
[    2.276211] mmc0: new high speed SDHC card at address 0007
[    2.282320] mmcblk0: mmc0:0007 SD4GB 3.67 GiB 
[    2.298536]  mmcblk0: p1 p2
[    2.514850] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    2.521878] Indeed it is in host mode hprt0 = 00001101
[    2.726547] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[    2.733272] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.741340] hub 1-1:1.0: USB hub found
[    2.745258] hub 1-1:1.0: 3 ports detected
[    3.074484] EXT4-fs (mmcblk0p2): recovery complete
[    3.086380] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    3.094543] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    3.103865] devtmpfs: mounted
[    3.107082] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    3.114287] Freeing unused kernel memory: 140K (c05c8000 - c05eb000)
[    3.216929] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    3.223815] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.234509] smsc95xx v1.0.4
�[    3.300278] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:fb:18:8b
INIT: �version 2.88 booting�CC��Starting udev
[    4.136765] udevd[74]: starting version 182
[    4.522501] bcm2708_i2c_init_pinmode(0,0)
[    4.667238] bcm2708_i2c_init_pinmode(0,1)
[    4.671544] bcm2708_i2c bcm2708_i2c.0: BSC0 Controller at 0x20205000 (irq 79) (baudrate 100000)
[    4.763467] bcm2708_i2c_init_pinmode(1,2)
[    5.006263] bcm2708_i2c_init_pinmode(1,3)
[    5.010893] bcm2708_i2c bcm2708_i2c.1: BSC1 Controller at 0x20804000 (irq 79) (baudrate 100000)
[    5.310577] bcm2708_spi bcm2708_spi.0: master is unqueued, this is deprecated
[    5.318283] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
[    5.764066] bcm2708_spi bcm2708_spi.0: SPI Controller at 0x20204000 (irq 80)
Fri May  1 07:25:37 UTC 2015
INIT: Entering runlevel: 5
Configuring network interfaces... [    6.839021] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
udhcpc (v1.22.1) started
Sending discover...
[    7.224607] bcm2708-i2s bcm2708-i2s.0: Failed to create debugfs directory

udevadm settle - timeout of 3 seconds reached, the event queue contains:
  /sys/devices/dev:f1 (1085)
  /sys/devices/platform/alarmtimer (1086)
  /sys/devices/platform/bcm2708-i2s.0 (1087)
  /sys/devices/platform/bcm2708_dma.0 (1088)
  /sys/devices/platform/bcm2708_fb (1089)
  /sys/devices/platform/bcm2708_gpio (1090)
  /sys/devices/platform/bcm2708_i2c.0 (1091)
  /sys/devices/platform/bcm2708_i2c.1 (1092)
  /sys/devices/platform/bcm2708_powerman.0 (1093)
  /sys/devices/platform/bcm2708_sdhci.0 (1094)
  /sys/devices/platform/bcm2708_spi.0 (1095)
  /sys/devices/platform/bcm2708_systemtimer (1096)
  /sys/devices/platform/bcm2708_usb (1097)
  /sys/devices/platform/bcm2708_usb/usb1 (1098)
  /sys/devices/platform/bcm2708_usb/usb1/1-0:1.0 (1099)
  /sys/devices/platform/bcm2708_usb/usb1/1-1 (1100)
  /sys/devices/platform/bcm2708_usb/usb1/1-1/1-1.1 (1101)
  /sys/devices/platform/bcm2708_usb/usb1/1-1/1-1.1/1-1.1:1.0 (1102)
  /sys/devices/platform/bcm2708_usb/usb1/1-1/1-1.1/1-1.1:1.0/net/eth0 (1103)
  /sys/devices/platform/bcm2708_usb/usb1/1-1/1-1:1.0 (1104)
  /sys/devices/platform/bcm2708_vcio (1105)
  /sys/devices/platform/bcm2835_AUD0.0 (1106)
  /sys/devices/platform/bcm2835_AUD1.1 (1107)
  /sys/devices/platform/bcm2835_AUD2.2 (1108)
  /sys/devices/platform/bcm2835_AUD3.3 (1109)
  /sys/devices/platform/bcm2835_AUD4.4 (1110)
  /sys/devices/platform/bcm2835_AUD5.5 (1111)
  /sys/devices/platform/bcm2835_AUD6.6 (1112)
  /sys/devices/platform/bcm2835_AUD7.7 (1113)
  /sys/devices/platform/bcm2835_hwmon.0 (1114)
  /sys/devices/platform/bcm2835_thermal.0 (1115)
  /sys/devices/platform/leds-gpio (1116)
  /sys/devices/platform/mmc_host/mmc0/mmc0:0007 (1118)
  /sys/devices/platform/mmc_host/mmc0/mmc0:0007/block/mmcblk0 (1119)
  /sys/devices/platform/mmc_host/mmc0/mmc0:0007/block/mmcblk0/mmcblk0p1 (1120)
  /sys/devices/platform/mmc_host/mmc0/mmc0:0007/block/mmcblk0/mmcblk0p2 (1121)
  /sys/devices/platform/pcm1794a-codec (1122)
  /sys/devices/platform/pcm5102a-codec (1123)
  /sys/devices/platform/serial8250.0 (1124)
  /sys/devices/platform/snd-hifiberry-dac.0 (1125)
  /sys/devices/platform/snd-hifiberry-digi.0 (1126)
  /sys/devices/platform/snd-rpi-dac.0 (1127)
  /sys/devices/platform/snd-rpi-hifiberry-dacplus.0 (1128)
  /sys/devices/platform/snd-rpi-iqaudio-dac.0 (1129)
  /sys/devices/platform/w1-gpio (1130)
  /sys/devices/virtual/bdi/1:6 (1148)
  /sys/devices/virtual/bdi/1:7 (1149)
[    9.696767] pcm512x 1-004d: Failed to reset device: -5
[    9.702121] pcm512x: probe of 1-004d failed with error -5
[    9.898050] pcm512x 1-004c: Failed to reset device: -5
[    9.903341] pcm512x: probe of 1-004c failed with error -5
Sending discover...
Sending discover...
No lease, forking to background
done.
Starting syslogd/klogd: done
��
Poky (Yocto Project Reference Distro) 1.7.2 raspberrypi /dev/ttyAMA0

raspberrypi login:

Por dentro da RaspberryPI.

root@raspberrypi:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                58.0M     46.8M      8.0M  85% /
devtmpfs                214.6M         0    214.6M   0% /dev
tmpfs                   218.7M    148.0K    218.5M   0% /run
tmpfs                   218.7M     48.0K    218.6M   0% /var/volatile
root@raspberrypi:~# free
             total         used         free       shared      buffers
Mem:        447828        18136       429692            0         1496
-/+ buffers:              16640       431188
Swap:            0            0            0
root@raspberrypi:~# mount
rootfs on / type rootfs (rw)
/dev/root on / type ext4 (rw,relatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=219748k,nr_inodes=54937,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /var/volatile type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
root@raspberrypi:~# cat /etc/issue
Poky (Yocto Project Reference Distro) 1.7.2 \n \l

root@raspberrypi:~# cat /proc/cmdline 
dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0xf bcm2708.serial=0x83fb188b smsc95xx.macaddr=B8:27:EB:FB:18:8B sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait debug
root@raspberrypi:~# cat /proc/cpuinfo 
processor	: 0
model name	: ARMv6-compatible processor rev 7 (v6l)
Features	: swp half thumb fastmult vfp edsp java tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xb76
CPU revision	: 7

Hardware	: BCM2708
Revision	: 000f
Serial		: 0000000083fb188b
root@raspberrypi:~#

 

 

Adicional

O que fizemos hoje foi preparar todo o ambiente para construir e poder customizar images Linux para embarcados, algumas mudanças no que foi feito e podemos construir para Beaglebone Black, Wandboard entre outras.

Eu diria que o que vimos aqui, foi como se tivéssemos a armadura do homem de ferro e usássemos ela para acender um led oO. Pois é, não usufruímos dos muitos poderes que o Yocto Project nos proporciona.

Para aprender mais e ver o que mais podemos fazer, segue uma serie de posts relacionados ao tema que foi publicado no Portal Embarcados.

http://www.embarcados.com.br/raspberrypi-yocto/

http://www.embarcados.com.br/cozinhando-com-o-yocto-project/

http://www.embarcados.com.br/desvendando-yocto-project-primeiros-passos/

http://www.embarcados.com.br/raspberry-pi-qt5-yocto-parte-1/

http://www.embarcados.com.br/raspberry-pi-qt5-yocto-parte-2/

 

Espero que tenham gostado, até a próxima!

 

Referências

http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html

http://layers.openembedded.org

http://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#intro-requirements

https://wiki.yoctoproject.org/wiki/Releases

http://www.yoctoproject.org/docs/1.7/dev-manual/dev-manual.html#build-directory

http://www.embarcados.com.br/cozinhando-com-o-yocto-project/

http://www.embarcados.com.br/raspberrypi-yocto/

Share Button

CC BY-NC-SA 4.0 Yocto Project – Construindo uma distribuição para RaspberryPI by Cleiton Bueno is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.