The official, and recommended, way to compile batocera.linux is by using a development container made on purpose with Docker. Although you can do it directly on your Linux machine, if it's a supported Ubuntu Linux.

If you are not familiar with git, you should first take a look at this page explaining the basics for contributing to Batocera Linux with git.

Choose either Docker or Direct Compilation.

Make sure you have a reasonably fast CPU, and at least 8GB of RAM. If you have a CPU with 8 cores or more (lucky you!), you might need more than 8GB RAM to compile batocera.linux with all threads in parallel. You also need at least 50GB of free disk space to download and compile the whole system.


If you already have a working Docker installation on your Linux system, you just need to install git (if you don't have that already as well), and skip to the preparations section.

Otherwise, the first step is to install Docker on your machine. Each OS and Linux distribution has a particular way to install Docker.

Please note that most developers use Ubuntu Linux to compile batocera.linux. In October 2018, Docker on Windows is not stable enough to compile Batocera.
In March 2020, with the Docker container running as non-root (regular user), you can compile Batocera on MacOS Mojave 10.14 (Darwin 18.0.0).

Once Docker is installed, you have to get it up and running (depending on your OS, for Linux Solus for example, you would start it up with sudo systemctl start docker.service).

Git is used to download the batocera.linux sources, outside of the docker container.

Direct Compilation

The way to install the necessary packages vary for each Linux distribution. You can find the necessary packages for Ubuntu below.

* Ubuntu 18.04 (might still work with 16.04 too)

 sudo apt-get install build-essential git libncurses5-dev libssl-dev mercurial texinfo zip default-jre imagemagick subversion hgsubversion autoconf automake bison scons libglib2.0-dev bc mtools u-boot-tools flex wget cpio dosfstools libtool
 sudo dpkg --add-architecture i386
 sudo apt-get update
 sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

* Ubuntu 20.04 (Includes requirements for some experimental packages)

 sudo apt-get install build-essential git libncurses5-dev libssl-dev mercurial texinfo zip default-jre imagemagick subversion autoconf automake bison scons libglib2.0-dev bc mtools u-boot-tools flex wget cpio dosfstools libtool gcc-multilib g++-multilib
 sudo dpkg --add-architecture i386
 sudo apt-get update
 sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

pip3 install conan

Download the batocera.linux sources

Choose a work directory (your $HOME?) and clone the batocera.linux source code:

git clone

Enter the newly created directory.

 cd batocera.linux

If the buildroot submodule is not created on pull, execute the following commands:

 git submodule init
 git submodule update

You only need to do this once.

If you use Docker, create the image of the container:

 docker build -t batocera-docker

Then start it by using the repository you just cloned as the /build folder of the container itself, with:

 docker container run --user $(id -u) -it --rm -v $PWD/.:/build batocera-docker

If you run the docker container as non-root, you'll be in a I have no name!@xxx:/build container.

Choose the target you want to build

Depending on the target you want to build Batocera for, you need to select one of the batocera-XXXXX_defconfig files, where XXXX has to be replaced with the architecture you are building to. Available ones are:

  • rpi1
  • rpi2
  • rpi3
  • odroidc2
  • odroidn2
  • odroidxu4
  • odroidgoa
  • x86_64
  • x86 (32 bits, old PCs)
  • tinkerboard
  • miqi
  • s905
  • s912
  • rockpro64
  • rock960

You can find them all listed in the configs directory.

Easy compilation

To make things easier, there is makefile described here that makes the compilation process smoother.

1. Install build environment

 make batocera-docker-image

2. Customize directories

You can check the default directories with the following command:

 make vars

You can change directories in I recommend you disable tracking of changes in that file with:

 git update-index --assume-unchanged

3. Build an image

Command is different for each target architecture, but share the same suffix like make rockpro64-build or:

 make x86_64-build

You can check valid targets architectures with make vars.

4. Shell

It's also possible to get a shell to the desired build environment. Similar to -build, with make rockpro64-shell or:

 make x86_64-shell

5. Build a single package

To build a single package, you can open a shell or use the -pkg target. Examples:

 make rockpro64-pkg PKG=batocera-splash
 make x86_64-shell PKG=libretro-mame

6. ccache

To enable ccache for all builds, add the necessary options to An example is provided there. See EXTRA_OPTS. No need to edit defconfig.

7. Compile clean builds

 make x86_64-cleanbuild

8. Build a webserver to upgrade your Batocera

You can easily upgrade your Batocera test machine with the build you have just compiled. Let's imagine your build box's IP address is If your build machine has Python3 installed, you can run a webserver with:

 make x86_64-webserver

Then, you can launch an upgrade from your Batocera test box. If your build box hosting the web server is on, you can simply upgrade to your freshly brewed build by entering from your Batocera SSH:


Traditional compilation method

Of course you can still use out of tree builds to compile Batocera. So, for x86_64, you can do the following:

make O=$PWD/output/x86_64 BR2_EXTERNAL=$PWD -C $PWD/buildroot batocera-x86_64_defconfig
cd output/x86_64

Source tree will stay pristine and we be reused for other builds following the same procedure with a different output directory. For example:

make O=$PWD/output/rpi3 BR2_EXTERNAL=$PWD -C $PWD/buildroot batocera-rpi3_defconfig
cd output/rpi3

Then, you can take some time for a coffee (or two, or two hundreds actually). Depending on how powerful your CPU is, how much RAM you have, and how fast your SSD/HDD is, compiling a whole Batocera system can take many hours. Don't forget, it's the full OS with all the emulators that we are compiling here, it's not a small task.

Please also mind that the process will take a significant amount of space, so ensure to have at least 50GB free on that partition.

Exit the container if you ran the build inside of it.

The output will be under output/images/batocera and will be gzipped. Its name contains the release version, the platform, and the build date. For instance: output/images/batocera/batocera-5.25-x86_64-20200221.img.gz

You can then flash it with Etcher by following the instructions or by using dd if you don't want to leave the command line:

gunzip output/images/batocera/batocera-XXXX.img.gz
dd if=output/images/batocera/batocera-XXXX.img of=/dev/**yourtargetdevice** status=progress

Download sources

You can download sources from Internet before compiling by running the following command, assuming you started with x86_64:

cd output/x86_64
make source

Personally, I even run it during 10 minutes and then run make in parallel.

Follow the current compilations

If you want to check on the current status for your x86_64 build:

tail -f output/x86_64/build/build-time.log

What isn't compiled yet?

If you ran make source, you can easily find what's remaining to compile by running :

for i in output/x86_64/build/*; do test -d "$i" && test -e "$i"/.stamp_built || echo "$i"; done; for i in output/x86_64/build/*; do test -d "$i" && test -e "$i"/.stamp_built || echo "$i"; done | wc -l

Sharing a single download folder among all builds

docker run -it --rm -v $PWD:/build -v $HOME/dev/batocera/DL:/build/dl batocera-docker

List docker images

docker image ls

Remove docker images

docker rmi [image]

List docker containers

docker ps

Remove docker containers

docker kill [container name]

Folder structure and other tips

Follow this page to know more about the structure of the Batocera source code and where your modifications need to be made.

qt5base compilation error in ubuntu docker

Add –security-opt seccomp:unconfined to your docker command line or update the libseccomp2 package

As of February 2020, it looks like this step is not required any longer.

  • compile_batocera.linux.txt
  • Last modified: 3 weeks ago
  • by liberodark