Ciao a tutti in questo post affronto la build di yocto su archlinux ma approcciandomi diversamente, su questa sezione la documentazione non include esplicitamente arch tra le distro supportate.

Quindi quello che andrò a fare e usare una delle distro supportate su docker e procederò a buildare al suo interno mantenendo la workdir su una cartella condivisa con l’host.

La distro che sceglo è Debian, per riprodurre l’esecuzione avvenuta con successo è necessario eseguire la segquenza di comandi necessari:

$ mkdir build_yocto
$ docker run -ti -v $(pwd)/build_yocto:/build_yocto --rm --name build_yocto debian # from now you are in container
$ apt update
$ apt install gawk wget git-core diffstat unzip texinfo gcc-multilib \
 build-essential chrpath socat cpio python python3 python3-pip python3 \ 
 pexpect xz-utils debianutils iputils-ping libsdl1.2-dev xterm \
 vim locales
$ vim /etct/locale.gen # enable a locale
$ locale-gen
$ useradd -m -s /bin/bash poky 
$ su - poky
$ cd /build_yocto/
$ git clone git://git.yoctoproject.org/poky
$ cd poky
$ git fetch --tags
$ git checkout tags/yocto-3.1.3 -b my-yocto-3.1.3
$ source oe-init-build-env
$ bitbake core-image-minimal

Ora provo a riprodurre il primo tentativo fallito:

$ pwd # mi assicuro di essere nalla cartella giusta
.../build_yocto/poky 
$ git checkout morty
Branch 'morty' impostato per tracciare il branch remoto 'morty' da 'origin'.
Si è passati a un nuovo branch 'morty'
$ git log --name-status HEAD^..HEAD # con qusto comando vediamo l'ultimo commit
commit e56be3cee517c5262486136dbd6d649b68c3a8b7 (HEAD -> morty, origin/morty)
Author: Yong, Jonathan <jonathan.yong@intel.com>
Date: Mon Dec 10 10:46:03 2018 -0800

    bitbake: bitbake-user-manual: Added "usehead" parameter.
    
    (Bitbake rev: 195c7d19896ded7358154194926a3e3f5524ffef)
    
    Signed-off-by: Scott Rifenbark <srifenbark@gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

M bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.xml
$

Da quello che possiamo vedere l’ulitma modifica su questo branch è stata apportata a Dicembre 2018, quindi usando la versione di debian disponibile in quel periodo dovrebbe funzionare.

Su Wikipedia a questa pagina sono riportati in ordine cronologico i rilasci di Debian, e quella che ci interessa è Debian Stretch

$ cd ../.. # Ci portiamo nella cartella che contiene build_yocto
$ ls
build_yocto
$ docker run -ti -v $(pwd)/build_yocto:/build_yocto --rm --name build_yocto debian:stretch # da adesso sarete loggati nel container
$ apt update
$ apt install gawk wget git-core diffstat unzip texinfo gcc-multilib \
 build-essential chrpath socat cpio python python-pip \
 xz-utils debianutils iputils-ping libsdl1.2-dev xterm \
 vim locales
$ vim /etct/locale.gen # enable a locale
$ locale-gen
$ useradd -m -s /bin/bash poky 
$ su - poky
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ export LANGUAGE=en_US.UTF-8
$ cd /build_yocto/poky
$ source oe-init-build-env
$ bitbake core-image-minimal
WARNING: Host distribution "DebianGNULinux-9" 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.
ERROR: OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    Error, TMPDIR has changed its layout version number (12 to 11) and you need to either rebuild, revert or adjust it at your own risk.


Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

Abbiamo 2 errori :

  • la versione di Debian è ancora troppo recente
  • non abbiamo pulito la cartella temporanea.

Per capire quali sono le distro supportate ho cercato la definizione della varibile SANITY_TESTED_DISTROS:

$ grep "SANITY_TESTED_DISTROS" -A 20 meta-poky/conf/distro/poky.conf
SANITY_TESTED_DISTROS ?= " \
            poky-1.8 \n \
            poky-2.0 \n \
            poky-2.1 \n \
            poky-2.2 \n \
            Ubuntu-14.04 \n \
            Ubuntu-14.10 \n \
            Ubuntu-15.04 \n \
            Ubuntu-15.10 \n \
            Ubuntu-16.04 \n \
            Fedora-22 \n \
            Fedora-23 \n \
            Fedora-24 \n \
            CentOSLinux-7.* \n \
            Debian-8.* \n \
            openSUSE-13.2 \n \
            SUSELINUX-42.1 \n \
            "
#
# OELAYOUT_ABI allows us to notify users when the format of TMPDIR changes in 
# an incompatible way. Such changes should usually be detailed in the commit

quindi ci serve Debian 8!!

Per la puliza, ci limiteremo a eliminare o a rinominare la cartella build, a seconda dello spazio disponibile.

Quindi riproviamo:

$ cd ../.. # Ci portiamo nella cartella che contiene build_yocto
$ ls
build_yocto
$ docker run -ti -v $(pwd)/build_yocto:/build_yocto --rm --name build_yocto debian:jessie # da adesso sarete loggati nel container
$ apt update
$ apt install -y gawk wget git-core diffstat unzip texinfo gcc-multilib \
     build-essential chrpath socat libsdl1.2-dev xterm python3 \
     python3-pip python cpio vim locales
$ vim /etc/locale.gen # enable a locale
$ locale-gen
$ useradd -m -s /bin/bash poky 
$ su - poky
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ export LANGUAGE=en_US.UTF-8
$ cd /build_yocto/poky
$ source oe-init-build-env   

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

You can now run 'bitbake <target>'

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

You can also run generated qemu images with a command like 'runqemu qemux86'

$ bitbake core-image-minimal
WARNING: Host distribution "DebianGNULinux-8" 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.                      
Parsing recipes: 100% |##############################################################################| Time: 0:01:36
Parsing of 864 .bb files complete (0 cached, 864 parsed). 1320 targets, 50 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION = "1.32.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "DebianGNULinux-8"
TARGET_SYS = "i586-poky-linux"
MACHINE = "qemux86"
DISTRO = "poky"
DISTRO_VERSION = "2.2.4"
TUNE_FEATURES = "m32 i586"
TARGET_FPU = ""
meta              
meta-poky         
meta-yocto-bsp = "morty:e56be3cee517c5262486136dbd6d649b68c3a8b7"

NOTE: Fetching uninative binary shim from http://downloads.yoctoproject.org/releases/uninative/1.8/x86_64-nativesdk-libc.tar.bz2;sha256sum=de4947e98e09e1432d069311cc2093974ecb9138a714fd5466f73524de66a693
--2020-11-02 17:21:15-- http://downloads.yoctoproject.org/releases/uninative/1.8/x86_64-nativesdk-libc.tar.bz2
Resolving downloads.yoctoproject.org (downloads.yoctoproject.org)... 198.145.29.63
Connecting to downloads.yoctoproject.org (downloads.yoctoproject.org)|198.145.29.63|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14304759 (14M) [application/octet-stream]
Saving to: ‘/build_yocto/poky/build/downloads/uninative/de4947e98e09e1432d069311cc2093974ecb9138a714fd5466f73524de66a693/x86_64-nativesdk-libc.tar.bz2’


2020-11-02 17:22:28 (193 KB/s) - ‘/build_yocto/poky/build/downloads/uninative/de4947e98e09e1432d069311cc2093974ecb9138a714fd5466f73524de66a693/x86_64-nativesdk-libc.tar.bz2’ saved [14304759/14304759]

Initialising tasks: 100% |###########################################################################| Time: 0:00:09
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: bzip2-1.0.6-r5 do_fetch: Checksum mismatch for local file /build_yocto/poky/build/downloads/bzip2-1.0.6.tar.gz
Cleaning and trying again.
WARNING: bzip2-1.0.6-r5 do_fetch: Renaming /build_yocto/poky/build/downloads/bzip2-1.0.6.tar.gz to /build_yocto/poky/build/downloads/bzip2-1.0.6.tar.gz_bad-checksum_d6dfbd05a9af0e7c35f05e75ab1d25f9
WARNING: bzip2-1.0.6-r5 do_fetch: Checksum failure encountered with download of http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz - will attempt other sources if available
WARNING: libpcre-native-8.39-r0 do_fetch: Checksum mismatch for local file /build_yocto/poky/build/downloads/pcre-8.39.tar.bz2
Cleaning and trying again.
WARNING: libpcre-native-8.39-r0 do_fetch: Renaming /build_yocto/poky/build/downloads/pcre-8.39.tar.bz2 to /build_yocto/poky/build/downloads/pcre-8.39.tar.bz2_bad-checksum_0fad05e2f5796ad7a2e306b1c3112e05
WARNING: libpcre-native-8.39-r0 do_fetch: Checksum failure encountered with download of http://downloads.sourceforge.net/projects/pcre/files/prce/8.39/pcre-8.39.tar.bz2 - will attempt other sources if available
WARNING: popt-native-1.16-r3 do_fetch: Checksum mismatch for local file /build_yocto/poky/build/downloads/popt-1.16.tar.gz
Cleaning and trying again.
WARNING: popt-native-1.16-r3 do_fetch: Renaming /build_yocto/poky/build/downloads/popt-1.16.tar.gz to /build_yocto/poky/build/downloads/popt-1.16.tar.gz_bad-checksum_9e09d0bf772649c5ba385c48ba2d3547
WARNING: popt-native-1.16-r3 do_fetch: Checksum failure encountered with download of http://rpm5.org/files/popt/popt-1.16.tar.gz - will attempt other sources if available
WARNING: rpm-native-5.4.16-r0 do_fetch: Checksum mismatch for local file /build_yocto/poky/build/downloads/rpm-5.4.15-0.20140824.src.rpm
Cleaning and trying again.
WARNING: rpm-native-5.4.16-r0 do_fetch: Renaming /build_yocto/poky/build/downloads/rpm-5.4.15-0.20140824.src.rpm to /build_yocto/poky/build/downloads/rpm-5.4.15-0.20140824.src.rpm_bad-checksum_83a71f0624ac6078a419a18cd2dd95c9
WARNING: rpm-native-5.4.16-r0 do_fetch: Checksum failure encountered with download of http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.15-0.20140824.src.rpm;name=srpm;extract=rpm-5.4.15.tar.gz - will attempt other sources if available
WARNING: shadow-native-4.2.1-r0 do_fetch: Failed to fetch URL http://pkg-shadow.alioth.debian.org/releases/shadow-4.2.1.tar.xz, attempting MIRRORS if available
WARNING: coreutils-8.25-r0 do_fetch: Failed to fetch URL http://distfiles.gentoo.org/distfiles/coreutils-8.25-man.tar.xz;name=manpages, attempting MIRRORS if available
NOTE: Tasks Summary: Attempted 2046 tasks of which 7 didn't need to be rerun and all succeeded.

Summary: There were 15 WARNING messages shown.
$ 

Ed ecco come ho risolto il problema di compilare vecchie versioni di yocto su sistemi non ufficialmente supportati o troppo aggiornati.

Riferimenti