Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
compile_batocera.linux [2023/05/13 23:25] – [Docker] amend fedora instructions ataricompile_batocera.linux [2026/04/03 02:04] (current) dmanlfc
Line 9: Line 9:
 ===== Install prerequisites ===== ===== Install prerequisites =====
  
-Choose either [[#docker|Docker]] or [[#direct_compilation|Direct Compilation]]. +Make sure you have a reasonably fast CPU, and at least **8GB of RAM** (even **12GB+** if you need to compile MAME). If you have a CPU with 8 cores/16 threads or more (lucky you!), you might need more than 16 GB RAM to compile batocera.linux with all threads in parallel. You also need **between 80GB and 250GB of free disk space** for each platform you intend to compile for in order to download and compile the final Batocera image.
- +
-Make sure you have a reasonably fast CPU, and at least **8GB of RAM** (even **12GB+** if you need to compile MAME). If you have a CPU with 8 cores or more (lucky you!), you might need more than 16 GB RAM to compile batocera.linux with all threads in parallel. You also need **between 80GB and 130GB of free disk space** for each platform you intend to compile for in order to download and compile the final Batocera image.+
  
 For reference, here are some **estimates** of the space required for building certain platforms: For reference, here are some **estimates** of the space required for building certain platforms:
-  * **x86_64**: 170 GB (for Batocera 36+  * **sources download**: up to 120GB for Batocera 41 (x86_64) 
-  * **bcm2837** (rpi4): 80 GB +  * **x86_64**: 165 GB for Batocera 41 (+35GB for x86_wow64) 
-  * **bcm2836** (rpi3): 70 GB +  * **bcm2712** (rpi5): 105GB for Batocera 41 
 +  * **bcm2711** (rpi4): 103GB for Batocera 41 
 +  * **bcm2837** (rpi3): 80 GB 
 +  * **bcm2836** (rpi2): 130 GB for Batocera 40 
 +  * **rk3326**: 74GB for Batocera 40 
 +  * **rk3399**: 45GB for Batocera 40
   * **s905gen2** (radxa zero): 65 GB   * **s905gen2** (radxa zero): 65 GB
   * **rpizero**: 45 GB   * **rpizero**: 45 GB
Line 23: Line 26:
 If compiling inside of a VM, you may need to set its CPU type to ''host'' to avoid "missing CPU instruction" errors like ''%%#error PCSX2 requires compiling for at least SSE 4.1%%''. If compiling inside of a VM, you may need to set its CPU type to ''host'' to avoid "missing CPU instruction" errors like ''%%#error PCSX2 requires compiling for at least SSE 4.1%%''.
 </WRAP> </WRAP>
 +
 +==== Install dev tools ====
 +
 +If never having compiled on the machine before you may need to install the various miscellaneous dev tools needed like ''git'' and ''make''. These can be installed individually, or it may be more convenient to download the entire development group package for your distro (especially if planning on compiling anything else other than Batocera).
 +
 +  * Ubuntu:
 +    * To install the basic dev tools: ''sudo apt-get install build-essential''
 +  * Fedora:
 +    * To check the packages that will be installed with the group, run: ''%%sudo dnf group info "Development Tools" "Development Libraries"%%''
 +    * To install them: ''%%sudo dnf groupinstall "Development Tools" "Development Libraries"%%''
 +  * Arch:
 +    * To install the dev tools: ''sudo pacman -S base-devel''
 +
 +If you wish to be frugal, the only essential packages on the host OS for compiling Batocera in Docker are ''git'' and ''make'', the rest are already included in the Docker image itself.
  
 ==== Docker ==== ==== Docker ====
  
-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 [[compile_batocera.linux#preparations]] section.+If you already have a working Docker installation on your Linux system, skip to the [[compile_batocera.linux#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.+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 January 2022, Docker on Windows was not stable enough to compile Batocera.//+//Please note that most developers use Docket on Ubuntu Linux to compile batocera.linux. In January 2022, Docker on Windows was 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). 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).
  
   * Linux Ubuntu/Debian:    * Linux Ubuntu/Debian: 
-    * Installing from the Distribution packages is not recommended. Refer to the official documentation instead: [[https://docs.docker.com/engine/install/ubuntu/]]+    * Installing Docker from the Distribution packages is not recommended. Refer to the official documentation instead: [[https://docs.docker.com/engine/install/ubuntu/]]
     * To be able to run docker without root privileges don't forget to add your user to the //docker// group:  ''sudo usermod -aG docker your-user'', then log out and log back in.     * To be able to run docker without root privileges don't forget to add your user to the //docker// group:  ''sudo usermod -aG docker your-user'', then log out and log back in.
   * Fedora:   * Fedora:
-    * Installing from the snap/appimages/flatpak packages is not recommended. Refer to the official documentation instead: [[https://docs.docker.com/engine/install/fedora/]]+    * Installing Docker from the snap/appimages/flatpak packages is not recommended. Refer to the official documentation instead: [[https://docs.docker.com/engine/install/fedora/]]
     * To be able to run Docker without root privileges and at boot, don't forget to add your user to the //docker// group. Fedora's own instructions on how to do so: [[https://developer.fedoraproject.org/tools/docker/docker-installation.html]]. In case those instructions fail, run the following sequentially in the terminal: <code bash>sudo groupadd docker     * To be able to run Docker without root privileges and at boot, don't forget to add your user to the //docker// group. Fedora's own instructions on how to do so: [[https://developer.fedoraproject.org/tools/docker/docker-installation.html]]. In case those instructions fail, run the following sequentially in the terminal: <code bash>sudo groupadd docker
 sudo gpasswd -a ${USER} docker sudo gpasswd -a ${USER} docker
Line 48: Line 65:
   * (for reference) MacOS: see [[https://docs.docker.com/docker-for-mac/]]   * (for reference) MacOS: see [[https://docs.docker.com/docker-for-mac/]]
   * (for reference) Windows: see [[https://store.docker.com/editions/community/docker-ce-desktop-windows]]   * (for reference) Windows: see [[https://store.docker.com/editions/community/docker-ce-desktop-windows]]
- 
-==== 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 === 
- 
-May also work with Ubuntu 16.04. 
- 
-<code> 
-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 
-</code> 
- 
-=== Ubuntu 20.04 === 
- 
-Includes requirements for some experimental packages. 
- 
-<code> 
-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 python3-pip 
-sudo dpkg --add-architecture i386 
-sudo apt-get update 
-sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 
-pip3 install conan 
-</code> 
  
 ===== Preparations ===== ===== Preparations =====
Line 132: Line 122:
 **2. Start up Docker** **2. Start up Docker**
  
-Once Docker is installed, you have to get it up and running. For Arch-based distros, this can be accomplished with:+If you haven't already configured the Docker daemon to run at boot, you have to get it up and running. On most distros, this can be accomplished with:
  
 <code bash> <code bash>
Line 138: Line 128:
 </code> </code>
  
-then reboot in order to make sure both the service is running and the actively logged in user is in the group.+then reboot in order to make sure both the service is running.
  
 **3. Install build environment** **3. Install build environment**
  
 <code bash> <code bash>
-make batocera-docker-image+make build-docker-image
 </code> </code>
  
Line 189: Line 179:
 <code bash> <code bash>
 make x86_64-build make x86_64-build
 +</code>
 +
 +If you have a lot of cores/threads on your compilation CPU, and enough RAM to support it, you can accelerate the compilation time by parallelizing package builds with:
 +
 +<code bash>
 +PARALLEL_BUILD=1 make x86_64-build
 </code> </code>
  
Line 285: Line 281:
  
 Of course ''x86_64'' is an example in the commands above, you can use any supported arch. Of course ''x86_64'' is an example in the commands above, you can use any supported arch.
- 
-==== 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: 
- 
-<code bash> 
-make O=$PWD/output/x86_64 BR2_EXTERNAL=$PWD -C $PWD/buildroot batocera-x86_64_defconfig 
-cd output/x86_64 
-make 
-</code> 
- 
-Source tree will stay pristine and we be reused for other builds following the same procedure with a different output directory. For example: 
- 
-<code bash> 
-make O=$PWD/output/rpi3 BR2_EXTERNAL=$PWD -C $PWD/buildroot batocera-rpi3_defconfig 
-cd output/rpi3 
-make 
-</code> 
- 
-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 between 50GB (RPi) and 150+GB (x86_64) of free space on that partition**. 
  
 ===== Locating the image ===== ===== Locating the image =====
Line 315: Line 289:
 For instance: ''output/images/batocera/images/x86_64/batocera-x86_64-33-20220130.img.gz''. For instance: ''output/images/batocera/images/x86_64/batocera-x86_64-33-20220130.img.gz''.
  
-You can then flash it with Etcher by following the [[https://batocera.org/how_to_install|install instructions]], upgrading using the webserver command above, [[:upgrade_manually|manually upgrading]] or by using the following commands:+You can then flash it with Raspberry Pi Imager by following the [[https://batocera.org/how_to_install|install instructions]], upgrading using the webserver command above, [[:upgrade_manually|manually upgrading]] or by using the following command (modify appropriately for your target storage device and platform):
  
 <code bash> <code bash>
-gunzip output/images/batocera/images/<architecture>/batocera-<XXXX>.img.gz +make DEV=/dev/TARGETDEVICE x86_64-flash
-dd if=output/images/batocera/images/<architecture>/batocera-<XXXX>.img of=/dev/<yourtargetdevice> status=progress+
 </code> </code>
  
Line 355: Line 328:
  
 <code bash> <code bash>
-cd output/x86_64 +make x86_64-source
-make source+
 </code> </code>
      
Line 374: Line 346:
  
 <code bash> <code bash>
-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+for i in output/x86_64/build/*; do test -d "$i" && test -e "$i"/.stamp_built || echo "$i"; done | tee /dev/tty | wc -l
 </code> </code>
  
Line 523: Line 495:
       └─ xa-2.3.11.tar.gz       └─ xa-2.3.11.tar.gz
 </code> </code>
 +
 +This can also happen when switching to a brand new Batocera version that you are compiling for x86_64. There is a rather large wine/wow64 package, ''wine-x86-<version>.tar.lzma'', that is uploaded to the Batocera GitHub repository. If none for the ''<version>'' you are building has been uploaded yet, you will get a 404 error. To fix it in your build tree, run ''make x86_wow64-cleanbuild'' and put the resulting package in your ''dl/wine-x86/'' directory.
  
 ==== When compiling under Docker, sometimes wget hangs with no response ==== ==== When compiling under Docker, sometimes wget hangs with no response ====
  • compile_batocera.linux.1684020328.txt.gz
  • Last modified: 3 years ago
  • by atari