--- title: "Building Yocto on CRACI" source: "https://docs.craci.com/guides/examples/yocto/" --- # Building Yocto on CRACI [Yocto quick installation](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html). ## Minimal workflow ```yaml name: yocto on: workflow_dispatch: jobs: yocto: runs-on: craci steps: - uses: cracicorp/setup@v1 with: size: "32" - name: install system dependencies # The deps come from the quick installation guide + we add `python3-websockets` # so that we don't need to run `bitbake-setup install-buildtools`. run: | set -eo pipefail sudo apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ build-essential chrpath cpio debianutils diffstat file gawk gcc git \ iputils-ping libacl1 libcrypt-dev locales python3 python3-git \ python3-jinja2 python3-pexpect python3-pip python3-subunit \ python3-websockets socat texinfo unzip wget xz-utils zstd - name: configure locale run: | set -eo pipefail if ! sudo grep -q '^en_US.UTF-8 UTF-8$' /etc/locale.gen; then echo 'en_US.UTF-8 UTF-8' | sudo tee -a /etc/locale.gen >/dev/null fi sudo locale-gen - name: create build directory run: | set -eo pipefail mkdir -p "$GITHUB_WORKSPACE/yocto" - name: setup and build working-directory: ${{ github.workspace }}/yocto run: | set -eo pipefail stat -c '%d %n' "$GITHUB_WORKSPACE" "$GITHUB_WORKSPACE/yocto" YOCTO_DIR="$GITHUB_WORKSPACE/yocto" BUILD_DIR="$YOCTO_DIR/bitbake-builds/poky-master/build" [ -d bitbake ] || git clone https://git.openembedded.org/bitbake ./bitbake/bin/bitbake-setup settings set --global default top-dir-prefix "$YOCTO_DIR" ./bitbake/bin/bitbake-setup settings set --global default top-dir-name bitbake-builds [ -f "$BUILD_DIR/init-build-env" ] || ./bitbake/bin/bitbake-setup init --non-interactive poky-master poky distro/poky machine/qemux86-64 . "$BUILD_DIR/init-build-env" # Specify SOURCE_MIRROR_URL to not use arbitrary mirrors which will not make it # through the CRACI proxy. Ignore some tests that fail due to a bug in bitbake. cat >> "$BUILD_DIR/conf/local.conf" <<'EOF' INHERIT += "own-mirrors" SOURCE_MIRROR_URL = "https://downloads.yoctoproject.org/mirror/sources/" BB_ALLOWED_NETWORKS = "downloads.yoctoproject.org" INSANE_SKIP:util-linux-ptest += "buildpaths" EOF bitbake core-image-sato ```