Merge pull request #9987 from chewitt/leiot

distributions: add support for the LEIoT distro and accomodate its needs in the buildsystem
This commit is contained in:
Rudi Heitbaum
2025-05-12 00:26:24 +10:00
committed by GitHub
44 changed files with 689 additions and 190 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@DISTRONAME@_@PROJECT@",
"version": "@LIBREELEC_VERSION@",
"version": "@DISTRO_VERSION@",
"release_date": "@RELEASE_DATE@",
"kernel": "@KERNEL_VERSION@",
"description": "@DESCRIPTION@",

View File

@@ -16,9 +16,9 @@ set -e
[ -z "${HOST_NAME}" ] && export HOST_NAME="$($LOCAL_CC -dumpmachine)"
TARGET_NAME=$TARGET_GCC_ARCH-libreelec-linux-gnu${TARGET_ABI}
BUILD=${BUILD_ROOT}/${BUILD_BASE}.${DISTRONAME}-${DEVICE:-$PROJECT}.${TARGET_ARCH}-${LIBREELEC_VERSION}
if [ "${LIBREELEC_VERSION}" = "devel" ] ; then
BUILD=${BUILD_ROOT}/${BUILD_BASE}.${DISTRONAME}-${DEVICE:-$PROJECT}.${TARGET_ARCH}-${OS_VERSION}-${LIBREELEC_VERSION}
BUILD=${BUILD_ROOT}/${BUILD_BASE}.${DISTRONAME}-${DEVICE:-$PROJECT}.${TARGET_ARCH}-${DISTRO_VERSION}
if [ "${DISTRO_VERSION}" = "devel" ] ; then
BUILD=${BUILD_ROOT}/${BUILD_BASE}.${DISTRONAME}-${DEVICE:-$PROJECT}.${TARGET_ARCH}-${OS_VERSION}-${DISTRO_VERSION}
fi
if [ -n "$BUILD_SUFFIX" ]; then

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

View File

@@ -0,0 +1 @@
distributions/LibreELEC/kernel_options

272
distributions/LEIoT/options Normal file
View File

@@ -0,0 +1,272 @@
### DISTRO INFORMATION ###
# Distro name (full name, without special characters)
DISTRONAME="LEIoT"
# Short distro description
DESCRIPTION="LibreELEC for IoT (LEIoT) is a simple appliance OS for containers."
# Distribution Source location
DISTRO_MIRROR="https://src.leiot.org/mirror"
DISTRO_SRC="https://src.leiot.org/$DISTRO_VERSION"
# Distribution Home URL
DISTRO_HOME_URL="https://leiot.org"
# Welcome Message for SSH Server (up to 5 Lines)
GREETING0="##############################################"
GREETING1="# LEIoT #"
GREETING2="# https://leiot.org #"
GREETING3="##############################################"
GREETING4=""
# Root password to integrate in the target system
ROOT_PASSWORD="libreelec"
# Partition labels for USB/SD installation media
DISTRO_BOOTLABEL="LEIOT"
DISTRO_DISKLABEL="STORAGE"
### BUILDSYSTEM SETTINGS ####
# LTO (Link Time Optimization) support
LTO_SUPPORT="yes"
# GOLD (Google Linker) support
GOLD_SUPPORT="yes"
# MOLD (Modern Linker) support
MOLD_SUPPORT="no"
# default linker (bfd / gold / mold)
DEFAULT_LINKER="gold"
# HARDENING (security relevant linker and compiler flags) support
HARDENING_SUPPORT="no"
# Default supported get handlers (archive, git, file etc.)
GET_HANDLER_SUPPORT="archive"
# use local ccache on build host, if available, for early package
# builds before ccache has been built
LOCAL_CCACHE_SUPPORT="yes"
### OS CONFIGURATION ###
# Install glibc locales to the build (yes / no)
GLIBC_LOCALES="yes"
# Install arm-mem package on ARM32 (yes / no)
if [ "${TARGET_ARCH}" = "arm" ]; then
ARM_MEM_SUPPORT="yes"
else
ARM_MEM_SUPPORT="no"
fi
# additional drivers to install:
# for a list of additional drivers see packages/linux-drivers
# Space separated list is supported,
# e.g. ADDITIONAL_DRIVERS="DRIVER1 DRIVER2"
ADDITIONAL_DRIVERS=""
# Default size of system partition, in MB, eg. 512
SYSTEM_SIZE=1024
# Default system partition offset, in sectors, eg. 2048
SYSTEM_PART_START=8192
# Size of storage partition, in MB. Must be >=32
STORAGE_SIZE=32
# build with swap support (yes / no)
SWAP_SUPPORT="yes"
# swap support enabled per default (yes / no)
SWAP_ENABLED_DEFAULT="yes"
# swapfile size if SWAP_SUPPORT=yes in MB
SWAPFILESIZE="2048"
# debug tty path
DEBUG_TTY="/dev/tty3"
# local console login prompt (yes / no)
LOCAL_LOGIN="yes"
# Enable SSH on boot (yes / no)
SSH_ENABLED_DEFAULT="yes"
### KODI SETTINGS ###
# Mediacenter to use (kodi / no)
MEDIACENTER="no"
# Skins to install (Estuary)
# Space separated list is supported,
# e.g. SKINS="Estuary"
SKINS=""
# Default Skin (Estuary)
SKIN_DEFAULT=""
# install extra subtitle Fonts for KODI (yes / no)
KODI_EXTRA_FONTS="no"
# build and install PulseAudio support (yes / no)
PULSEAUDIO_SUPPORT="no"
# build and install pipewire support (yes / no)
PIPEWIRE_SUPPORT="no"
# build and install eSpeak-NG support (yes / no)
ESPEAK_SUPPORT="no"
# build and install with BluRay support (yes / no)
KODI_BLURAY_SUPPORT="no"
# build and install with BD+ support
# (BD+ decryption support in KODI) (yes / no)
BLURAY_BDPLUS_SUPPORT="no"
# build and install with AACS support
# (BD decryption support in KODI) (yes / no)
BLURAY_AACS_SUPPORT="no"
# build and install with DVDCSS support
# (DVD decryption support in KODI) (yes / no)
KODI_DVDCSS_SUPPORT="no"
# build and install bluetooth support (yes / no)
BLUETOOTH_SUPPORT="no"
# build and install with KODI webfrontend (yes / no)
KODI_WEBSERVER_SUPPORT="no"
# build and install Avahi (Zeroconf) daemon (yes / no)
AVAHI_DAEMON="yes"
# build with UPnP support (yes / no)
KODI_UPNP_SUPPORT="yes"
# build with MySQL support (mariadb / none)
KODI_MYSQL_SUPPORT="mariadb"
# build Kodi with optical drive support (yes / no)
KODI_OPTICAL_SUPPORT="yes"
# build with AirPlay support (stream videos from iDevices to KODI) (yes / no)
KODI_AIRPLAY_SUPPORT="yes"
# build with AirTunes support (stream music from iDevices to KODI) (yes / no)
KODI_AIRTUNES_SUPPORT="yes"
# build with libnfs support (mounting nfs shares with KODI) (yes / no)
KODI_NFS_SUPPORT="yes"
# build with Samba Client support (mounting SAMBA shares with KODI) (yes / no)
KODI_SAMBA_SUPPORT="yes"
# build kodi with alsa support (yes/no)
KODI_ALSA_SUPPORT="yes"
# build kodi with pulseaudio support (yes/no)
KODI_PULSEAUDIO_SUPPORT="yes"
# build kodi with pipewire support (yes/no)
KODI_PIPEWIRE_SUPPORT="no"
### KODI ADDONS ###
# Addon Server Url
ADDON_SERVER_URL="https://addons.libreelec.tv"
# set the default addon project
ADDON_PROJECT="${DEVICE:-$PROJECT}"
# Settings package name - blank if not required
DISTRO_PKG_SETTINGS=""
DISTRO_PKG_SETTINGS_ID=""
### ADDITIONAL PROGRAMS / FUNCTIONS ###
# Testpackages for development (yes / no)
TESTING="no"
# Configure debug groups (space delimited key=value pairs, with each value comma-delimited) and default group when DEBUG=yes
# Use ! or - prefix to prevent a dependent package from being built with debug. Add + suffix to build dependenencies with debug.
DEBUG_GROUPS=""
DEBUG_GROUP_YES=""
# build and install iSCSI support - iscsistart (yes / no)
ISCSI_SUPPORT="no"
# build with NFS support (mounting nfs shares via the OS) (yes / no)
NFS_SUPPORT="no"
# build with Samba Client support (mounting samba shares via the OS) (yes / no)
SAMBA_SUPPORT="no"
# build and install Samba Server (yes / no)
SAMBA_SERVER="no"
# build and install SFTP Server (yes / no)
SFTP_SERVER="yes"
# build and install OpenVPN support (yes / no)
OPENVPN_SUPPORT="yes"
# build and install WireGuard support (yes / no)
WIREGUARD_SUPPORT="yes"
# build and install diskmounter support (udevil)
# this service provide auto mounting support for external drives in the
# mediacenter also automount internally drives at boottime via udev (yes / no)
UDEVIL="yes"
# Support for partitioning and formatting disks in initramfs (yes / no)
# This adds support for parted and mkfs.ext3/4 to initramfs for OEM usage
INITRAMFS_PARTED_SUPPORT="no"
# build and install nano text editor (yes / no)
NANO_EDITOR="yes"
# cron support (yes / no)
CRON_SUPPORT="yes"
# build with installer (yes / no)
INSTALLER_SUPPORT="yes"
# build and install remote support (yes / no)
REMOTE_SUPPORT="no"
# IR remote keymaps supported in default config
IR_REMOTE_KEYMAPS="rc6_mce xbox_360 xbox_one"
# build and install Joystick support (yes / no)
JOYSTICK_SUPPORT="no"
# build and install CEC adapter support (yes / no)
CEC_SUPPORT="no"
# build and install CEC framework support (yes / no)
CEC_FRAMEWORK_SUPPORT="no"
# OEM packages for OEM's (yes / no)
OEM_SUPPORT="no"
# build and install ALSA Audio support (yes / no)
ALSA_SUPPORT="no"
# additional packages to install:
# Space separated list is supported,
# e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2"
ADDITIONAL_PACKAGES="avahi curl docker htop Python3"
# build and install driver addons (yes / no)
DRIVER_ADDONS_SUPPORT="no"
# driver addons to install:
# for a list of additional drivers see packages/linux-driver-addons
# Space separated list is supported,
DRIVER_ADDONS=""

View File

@@ -0,0 +1,3 @@
show_distro_config() {
: no-op
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,5 @@
# VERSION: set full version, use "devel" for development version
DISTRO_VERSION="devel"
# OS_VERSION: OS Version
OS_VERSION="13.0"

View File

@@ -1,15 +1,19 @@
### DISTRO INFORMATION ###
# Name of the Distro to build (full name, without special characters)
# Distro name (full name, without special characters)
DISTRONAME="LibreELEC"
# short project description
# Short distro description
DESCRIPTION="LibreELEC is a fast and user-friendly Kodi Entertainment Center distribution."
# Distribution Source location
DISTRO_MIRROR="https://sources.libreelec.tv/mirror"
DISTRO_SRC="https://sources.libreelec.tv/$DISTRO_VERSION"
### USER INTERFACE SETTINGS ###
# Distribution Home URL
DISTRO_HOME_URL="https://libreelec.tv"
# Welcome Message for e.g. SSH Server (up to 5 Lines)
# Welcome Message for SSH Server (up to 5 Lines)
GREETING0="##############################################"
GREETING1="# LibreELEC #"
GREETING2="# https://libreelec.tv #"
@@ -90,6 +94,9 @@
# local console login prompt (yes / no)
LOCAL_LOGIN="no"
# Enable SSH on boot (yes / no)
SSH_ENABLED_DEFAULT="no"
### KODI SETTINGS ###
# Mediacenter to use (kodi / no)
MEDIACENTER="kodi"
@@ -170,10 +177,6 @@
### KODI ADDONS ###
# Distribution Specific source location
DISTRO_MIRROR="http://sources.libreelec.tv/mirror"
DISTRO_SRC="http://sources.libreelec.tv/$LIBREELEC_VERSION"
# Addon Server Url
ADDON_SERVER_URL="https://addons.libreelec.tv"
@@ -259,3 +262,11 @@
# Space separated list is supported,
# e.g. ADDITIONAL_PACKAGES="PACKAGE1 PACKAGE2"
ADDITIONAL_PACKAGES=""
# build and install driver addons (yes / no)
DRIVER_ADDONS_SUPPORT="no"
# driver addons to install:
# for a list of additional drivers see packages/linux-driver-addons
# Space separated list is supported,
DRIVER_ADDONS="crazycat digital_devices dvb-latest"

View File

@@ -1,5 +1,5 @@
# VERSION: set full version, use "devel" for development version
LIBREELEC_VERSION="devel"
DISTRO_VERSION="devel"
# OS_VERSION: OS Version
OS_VERSION="13.0"

View File

@@ -0,0 +1,32 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="docker-compose"
PKG_VERSION="2.35.1"
PKG_LICENSE="Apache-2.0"
PKG_SITE="https://github.com/docker/compose"
PKG_LONGDESC="Define and run multi-container applications with Docker."
PKG_TOOLCHAIN="manual"
case ${ARCH} in
x86_64)
PKG_URL="${PKG_SITE}/releases/download/v${PKG_VERSION}/docker-compose-linux-x86_64"
PKG_SHA256="7bdb2ce2916e5dd0354e5d129892bf96fdcdb1a9ab8eed69b9173e131db4c230"
;;
aarch64)
PKG_URL="${PKG_SITE}/releases/download/v${PKG_VERSION}/docker-compose-linux-aarch64"
PKG_SHA256="a91e930a076b91e6c69f11d1dbe3c06729ae765fb9dbb3f97cb808e784647399"
;;
arm)
PKG_URL="${PKG_SITE}/releases/download/v${PKG_VERSION}/docker-compose-linux-armv7"
PKG_SHA256="50aba1c8fe1eb8efefede3dab9e6c2226ba756a5ffa5cf4f4f5baadaee9a7455"
;;
esac
PKG_SOURCE_NAME="docker-compose-linux-${ARCH}-${PKG_VERSION}"
unpack() {
mkdir -p ${PKG_BUILD}
cp -P ${SOURCES}/${PKG_NAME}/${PKG_SOURCE_NAME} ${PKG_BUILD}/docker-compose
chmod +x ${PKG_BUILD}/docker-compose
}

View File

@@ -0,0 +1,2 @@
DOCKER_DAEMON_OPTS="--data-root=/storage/docker"
DOCKER_STORAGE_OPTS="--storage-driver=overlay2"

View File

@@ -0,0 +1,161 @@
#!/usr/bin/env python
"""docker monitor using docker /events HTTP streaming API"""
"""https://github.com/CyberInt/dockermon"""
from contextlib import closing
from functools import partial
from socket import socket, AF_UNIX, timeout
from subprocess import Popen, PIPE
from sys import stdout, version_info
import json
import shlex
if version_info[:2] < (3, 0):
from httplib import OK as HTTP_OK
from urlparse import urlparse
else:
from http.client import OK as HTTP_OK
from urllib.parse import urlparse
__version__ = '0.2.2'
# buffer size must be 256 or lower otherwise events won't show in realtime
bufsize = 256
default_sock_url = 'ipc:///var/run/docker.sock'
class DockermonError(Exception):
pass
def read_http_header(sock):
"""Read HTTP header from socket, return header and rest of data."""
buf = []
hdr_end = '\r\n\r\n'
while True:
buf.append(sock.recv(bufsize).decode('utf-8'))
data = ''.join(buf)
i = data.find(hdr_end)
if i == -1:
continue
return data[:i], data[i + len(hdr_end):]
def header_status(header):
"""Parse HTTP status line, return status (int) and reason."""
status_line = header[:header.find('\r')]
# 'HTTP/1.1 200 OK' -> (200, 'OK')
fields = status_line.split(None, 2)
return int(fields[1]), fields[2]
def connect(url):
"""Connect to UNIX or TCP socket.
url can be either tcp://<host>:port or ipc://<path>
"""
url = urlparse(url)
if url.scheme == 'tcp':
sock = socket()
netloc = tuple(url.netloc.rsplit(':', 1))
hostname = socket.gethostname()
elif url.scheme == 'ipc':
sock = socket(AF_UNIX)
netloc = url.path
hostname = 'localhost'
else:
raise ValueError('unknown socket type: %s' % url.scheme)
sock.connect(netloc)
return sock, hostname
def watch(callback, url=default_sock_url, run=None):
"""Watch docker events. Will call callback with each new event (dict).
url can be either tcp://<host>:port or ipc://<path>
"""
sock, hostname = connect(url)
if run:
sock.settimeout(1.5)
request = 'GET /events HTTP/1.1\nHost: %s\n\n' % hostname
request = request.encode('utf-8')
with closing(sock):
sock.sendall(request)
header, payload = read_http_header(sock)
status, reason = header_status(header)
if status != HTTP_OK:
raise DockermonError('bad HTTP status: %s %s' % (status, reason))
# Messages are \r\n<size in hex><JSON payload>\r\n
buf = [payload]
while True:
try:
chunk = sock.recv(bufsize)
except timeout:
if run():
continue
if run and not run():
raise DockermonError('stopped')
if not chunk:
raise EOFError('socket closed')
buf.append(chunk.decode('utf-8'))
data = ''.join(buf)
i = data.find('\r\n')
if i == -1:
continue
size = int(data[:i], 16)
start = i + 2 # Skip initial \r\n
if len(data) < start + size + 2:
continue
payload = data[start:start+size]
callback(json.loads(payload))
buf = [data[start+size+2:]] # Skip \r\n suffix
def print_callback(msg):
"""Print callback, prints message to stdout as JSON in one line."""
json.dump(msg, stdout)
stdout.write('\n')
stdout.flush()
def prog_callback(prog, msg):
"""Program callback, calls prog with message in stdin"""
pipe = Popen(prog, stdin=PIPE)
data = json.dumps(msg)
pipe.stdin.write(data.encode('utf-8'))
pipe.stdin.close()
if __name__ == '__main__':
from argparse import ArgumentParser
parser = ArgumentParser(description=__doc__)
parser.add_argument('--prog', default=None,
help='program to call (e.g. "jq --unbuffered .")')
parser.add_argument(
'--socket-url', default=default_sock_url,
help='socket url (ipc:///path/to/sock or tcp:///host:port)')
parser.add_argument(
'--version', help='print version and exit',
action='store_true', default=False)
args = parser.parse_args()
if args.version:
print('dockermon %s' % __version__)
raise SystemExit
if args.prog:
prog = shlex.split(args.prog)
callback = partial(prog_callback, prog)
else:
callback = print_callback
try:
watch(callback, args.socket_url)
except (KeyboardInterrupt, EOFError):
pass

View File

@@ -6,7 +6,7 @@ PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="ASL"
PKG_SITE="http://www.docker.com/"
PKG_DEPENDS_TARGET="cli containerd ctop moby runc tini"
PKG_DEPENDS_TARGET="cli containerd ctop docker-compose moby runc tini"
PKG_SECTION="service/system"
PKG_SHORTDESC="Docker is an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere."
PKG_LONGDESC="Docker containers can encapsulate any payload, and will run consistently on and between virtually any server. The same container that a developer builds and tests on a laptop will run at scale, in production*, on VMs, bare-metal servers, OpenStack clusters, public instances, or combinations of the above."
@@ -43,3 +43,40 @@ addon() {
post_install_addon() {
sed -e "s/@DISTRO_PKG_SETTINGS_ID@/${DISTRO_PKG_SETTINGS_ID}/g" -i "${INSTALL}/default.py"
}
post_makeinstall_target() {
mkdir -p ${INSTALL}/etc
# docker.conf
cp -P ${PKG_DIR}/config/docker.conf ${INSTALL}/etc
mkdir -p ${INSTALL}/usr/bin
# dockermon.py
cp -P ${PKG_DIR}/lib/dockermon.py ${INSTALL}/usr/bin/dockermon
# cli
cp -P $(get_build_dir cli)/bin/docker ${INSTALL}/usr/bin
# moby
cp -P $(get_build_dir moby)/bin/dockerd ${INSTALL}/usr/bin
cp -P $(get_build_dir moby)/bin/docker-proxy ${INSTALL}/usr/bin/docker-proxy
# containerd
cp -P $(get_build_dir containerd)/bin/containerd ${INSTALL}/usr/bin/containerd
cp -P $(get_build_dir containerd)/bin/containerd-shim-runc-v2 ${INSTALL}/usr/bin/containerd-shim-runc-v2
# ctop
cp -P $(get_build_dir ctop)/bin/ctop ${INSTALL}/usr/bin/ctop
# docker-compose
cp -P $(get_build_dir docker-compose)/docker-compose ${INSTALL}/usr/bin/docker-compose
# runc
cp -P $(get_build_dir runc)/bin/runc ${INSTALL}/usr/bin/runc
# tini
cp -P $(get_build_dir tini)/.${TARGET_NAME}/tini-static ${INSTALL}/usr/bin/docker-init
}
post_install() {
enable_service docker.service
}

View File

@@ -0,0 +1,23 @@
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target
[Service]
Type=notify
EnvironmentFile=-/etc/docker.conf
ExecStart=/usr/bin/dockerd --exec-opt native.cgroupdriver=systemd \
--log-driver=journald \
--group=root \
$DOCKER_DAEMON_OPTS \
$DOCKER_STORAGE_OPTS
ExecReload=/bin/kill -s HUP $MAINPID
TasksMax=8192
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
Restart=on-abnormal
[Install]
WantedBy=multi-user.target

Some files were not shown because too many files have changed in this diff Show More