> For the complete documentation index, see [llms.txt](https://amobile-solutions.gitbook.io/yocto-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://amobile-solutions.gitbook.io/yocto-developer-guide/getting-started/iot-800n-g420/build-environment-setup.md).

# Build Environment Setup

## Host requirements

|         |                                                                                      |
| ------- | ------------------------------------------------------------------------------------ |
| OS      | Ubuntu 22.04 LTS or 24.04 LTS, 64-bit                                                |
| Disk    | About 100 GB free                                                                    |
| RAM     | 16 GB minimum, 32 GB recommended                                                     |
| Network | Only needed if building upstream layers from git; the SDK release bundles everything |

## Install the packages

```
sudo apt update
sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential \
     chrpath socat cpio python3 python3-pip python3-pexpect xz-utils \
     debianutils iputils-ping python3-git python3-jinja2 python3-subunit \
     zstd liblz4-tool file locales libacl1
```

## Set the locale

Yocto requires a UTF-8 locale. Without it the build fails partway through with a Python encoding error.

```
sudo locale-gen en_US.UTF-8
```

## Check the shell

The build assumes `/bin/sh` is `bash`. On Ubuntu it is `dash` by default, which is fine for Yocto itself, but if you hit unexplained script errors:

```
ls -l /bin/sh
```

## Parallelism

Left unset, bitbake uses every core. On a machine with many cores but relatively little memory this can thrash until the build hangs, with the symptom being a ping timeout from the cooker process.

Total concurrency is roughly `BB_NUMBER_THREADS × PARALLEL_MAKE`, and about 2 GB of RAM per task is a reasonable budget. Set both in `conf/local.conf` once the build directory exists:

```
BB_NUMBER_THREADS = "12"
PARALLEL_MAKE = "-j 12"
```

## Sharing downloads between projects

If you build more than one product on the same host, sharing the download directory saves 20–30 GB and a great deal of fetching:

```
DL_DIR ?= "${TOPDIR}/../shared-downloads"
```

{% hint style="warning" %}
Do not share `sstate-cache` between projects. Let each one grow its own.
{% endhint %}
