├── CoreELEC └── README.md ├── Dockerfile └── README.md /CoreELEC/README.md: -------------------------------------------------------------------------------- 1 | # Build CoreELEC in a docker container on CoreELEC 2 | 3 | These instructions are for creating a Docker container and building a CoreELEC image on a device running CoreELEC. 4 | If you are using another operating system, you should use the [README.md](../README.md) one directory level up. 5 | 6 | * It is highly recommended to avoid building on a micro SD card, please use an external SSD/HDD or internal eMMC. 7 | You may need to modify the paths used as examples in this guide (`~/ce-builder`, `/storage/.swapfile`) to suit your particular setup. 8 | * A full build requires 40GB of free space. If you want to build add-ons, an additional 20GB of free space is required. 9 | 10 | ## Prerequisites 11 | 12 | * Install the `Services - Docker` add-on in Kodi, reboot. 13 | 14 | Log in to CoreELEC via SSH and follow the rest of the guide. 15 | 16 | * Stop Kodi to free up resources: `systemctl stop kodi` 17 | 18 | ## Create swap file 19 | 20 | You may need to create a swap file in order to avoid the system from locking up during the build process. 21 | On S922X you will need a total of 6GB of memory, meaning a 2GB swap if your device has 4GB of RAM and 4GB swap if it has 2GB of RAM. 22 | On S905* devices, you will need 4GB of memory, meaning no swap is necessary if your device has 4GB of RAM and 2GB swap is required if it has 2GB of RAM. 23 | Run the following commands to create and activate a 2GB swap file. Change the `count` value to adjust the swap file size. 24 | 25 | ```sh 26 | dd if=/dev/zero of=/storage/.swapfile bs=1M count=2000 27 | chmod 600 /storage/.swapfile 28 | mkswap /storage/.swapfile 29 | swapon /storage/.swapfile 30 | ``` 31 | 32 | You can place the following code in `/storage/.config/autosart.sh` to make the swap file persist across reboots. 33 | 34 | ```sh 35 | #!/bin/bash 36 | 37 | if [ ! -f /storage/.swapfile ]; then 38 | dd if=/dev/zero of=/storage/.swapfile bs=1M count=2000 39 | chmod 600 /storage/.swapfile 40 | fi 41 | mkswap /storage/.swapfile 42 | swapon /storage/.swapfile 43 | ``` 44 | 45 | ## Prepare your environment 46 | 47 | * If you are using an external (USB) drive, you need to mount it with execute permissions: 48 | `mount -o remount,exec /path-to-external-drive-partition` 49 | * `mkdir -p ~/ce-builder` 50 | * `chown -R 1000 ~/ce-builder` 51 | 52 | ## Pull the image and run the container 53 | 54 | * `docker pull coreelec/coreelec-builder:latest-aarch64` 55 | * `docker run -v ~/ce-builder:/home/docker -h coreelec -it coreelec/coreelec-builder:latest-aarch64` 56 | 57 | ## Clone repo and build image inside container 58 | 59 | * `git clone git://github.com/CoreELEC/CoreELEC.git ~/CoreELEC` 60 | * `cd ~/CoreELEC` 61 | * `time(PROJECT=Amlogic-ng ARCH=arm make image)` 62 | Use `PROJECT=Amlogic` to build images for older S912 and S905/X/D devices 63 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM arm64v8/ubuntu:bionic 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | RUN apt-get update \ 6 | && apt-get dist-upgrade -y \ 7 | && apt-get install -y locales sudo \ 8 | && rm -rf /var/lib/apt/lists/* 9 | 10 | RUN locale-gen en_US.UTF-8 \ 11 | && update-locale LANG=en_US.UTF-8 LANGUAGE=en_US:en 12 | ENV LANG=en_US.UTF-8 \ 13 | LANGUAGE=en_US:en \ 14 | LC_ALL=en_US.UTF-8 15 | 16 | RUN adduser --disabled-password --gecos '' docker \ 17 | && adduser docker sudo \ 18 | && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers 19 | 20 | RUN apt-get update && apt-get install -y \ 21 | wget bash bc gcc sed patch patchutils tar bzip2 gzip perl gawk gperf zip unzip diffutils texinfo lzop python python3 \ 22 | g++ xfonts-utils xfonts-utils xfonts-utils xsltproc default-jre-headless \ 23 | libc6-dev libncurses5-dev \ 24 | u-boot-tools \ 25 | xz-utils make file libxml-parser-perl \ 26 | libjson-perl \ 27 | golang-go \ 28 | git openssh-client \ 29 | qemu-user-binfmt \ 30 | --no-install-recommends \ 31 | && rm -rf /var/lib/apt/lists/* 32 | 33 | USER docker 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build CoreELEC in a docker container 2 | 3 | ## Pull the image and run the container 4 | 5 | * `docker pull coreelec/coreelec-builder:latest` 6 | * `docker run -v ~/:/home/docker -h coreelec -it coreelec/coreelec-builder:latest` 7 | 8 | ## Clone repo and build image inside container 9 | 10 | * `sudo apt-get update` 11 | * `git clone git://github.com/CoreELEC/CoreELEC.git ~/CoreELEC` 12 | * `cd ~/CoreELEC` 13 | * `time(make image)` 14 | Use `PROJECT=Amlogic` to build images for older S912 and S905/X/D devices 15 | --------------------------------------------------------------------------------