LibreELEC Documentation
repository·master·Indexed 25 days ago
https://github.com/libreelec/libreelec.tvDocumentation for LibreELEC, a minimal Linux distribution optimized for the Kodi media center. Includes detailed guides on creating and configuring packages via package.mk, managing build toolchains (Meson, CMake, Autotools), handling Kodi addons, and device-specific installation and debugging instructions for Amlogic, ARM, NXP, and Qualcomm Dragonboard hardware.
What's inside LibreELEC
- LibreELEC is a 'Just enough OS' Linux distribution designed specifically to run the Kodi media center software on various mediacentre hardware platforms. It is a minimal, optimized operating system focused on providing a stable environment for Kodi.
Identify supported NXP SoC devices
masterLibreELEC provides support for NXP SoC devices, specifically targeting the iMX6 and iMX8 families. Supported hardware includes various development boards and single-board computers listed under these families.Use ARM project device targets for binary add-on compilation
masterThe ARM project provides specific device targets designed for compiling a common set of binary add-ons for ARM SoC projects and devices. It also includes an "everything disabled" distro configuration, which can be used to reduce compile times when performing individual or bulk add-on compilations.
Supported device targets:
ARMv7ARMv8
Follow coding standards within `package.mk`
masterWhen defining packages in
package.mk, follow these rules for variable management and structure:Variable Management
- Prefixing: Prefix package-specific variables with
PKG_(these are automatically unset beforepackage.mkis sourced). - Appending: Use
PKG_VAR+=" value"to append to a variable instead ofPKG_VAR="${PKG_VAR} value". - Git Revisions: Always use the full 40-character revision string.
Logic & Formatting
- Indentation: When creating a directory, indent related lines:
cd ${INSTALL}/blah cp -P foo ${INSTALL}/blah - Error Handling: While
foo && baris allowed, be careful with package functions that might exit with a non-zero code. Usefoo && bar || trueor a multi-lineifblock to prevent unintended exits:if foo; then bar fi
- Prefixing: Prefix package-specific variables with
Follow coding standards for build system scripts and config
masterWhen writing executable build scripts or configuration fragments for the LibreELEC build system, adhere to these shell scripting standards:
Execution & Sourcing
- Use
#!/bin/bashfor executable build scripts. - Sourced config fragments (e.g.,
config/functions,config/options,config/arch.*) must not have a shebang. - Use
. config/blahto source files instead ofsource config/blah.
Syntax & Comparisons
- Use
$()for command substitution instead of backticks. - String comparison: Use
=(not==). - Numeric comparison: Use
-eq(not=). - Tests: Use
[ expr1 -o expr2 ]or[ expr1 -a expr2 ]for simple tests. Use[[ ]]only when regex (=~) or glob/pattern matching is required. - Short-circuiting: If
[[ ]]should be avoided but short-circuiting is needed, use command grouping:[ test1 ] && { [ test2 ] && [ test3 ]; }.
Variables & Quoting
- Use braces for shell variables:
${FOO}instead of$FOO. - Always use double-quotes (
") around variables to prevent issues with special characters, e.g.,cd "${PKG_DIR}/scripts".
Best Practices
- Use
set -eorset -euo pipefailin scripts that must abort on error. - Avoid forking child processes (like
sedorcut) if a shell built-in can be used. - Keep lines under 90 columns unless necessary for maintainability (e.g.,
LINUX_DEPENDS). - Validate scripts using ShellCheck.
- Use
Handle late binding variable assignment in package.mk
masterCertain variables like
PKG_BUILDandPKG_SOURCE_NAMEare only initialized after the package is loaded. To use these variables, you must reference them within theconfigure_package()function.Common variables that require late binding via
configure_package()include:PKG_CONFIGURE_SCRIPTPKG_CMAKE_SCRIPTPKG_MESON_SCRIPT
Additionally, toolchain variables (e.g.,
TARGET_CFLAGS,CC,LDFLAGS,PKG_CONFIG_PATH) and build-time options (e.g.,TARGET_CMAKE_OPTS,HOST_CONFIGURE_OPTS) should be referenced within stage-specific functions (likepre_build_*orpre_configure_*) rather than globally to ensure they are used after being reliably initialized.configure_package() { # now we know where we're building, assign a value PKG_CONFIGURE_SCRIPT="${PKG_BUILD}/gettext-tools/configure" } post_patch() { # replace hardcoded stuff sed -i ${PKG_CONFIGURE_SCRIPT} 's|hardcoded stuff|variable stuff|' } pre_configure_target() { # add extra flag to toolchain default CFLAGS="$CFLAGS -DEXTRA_FLAG=yeah" } post_makeinstall_target() { # remove unused executable, install what remains rm $INSTALL/usr/bin/bigexecutable }Follow coding standards for scripts running on the device
masterScripts intended to run on the LibreELEC device must be compatible with the
busybox sh/ashruntime. Bash is not available on the device.Requirements
- Use
#!/bin/shas the shebang. - Adhere strictly to the POSIX standard. The following Bash extensions are forbidden:
- No
[[ ]]extended tests (use[ ]instead). - No arrays.
- No
sourcecommand. - No
=~regex. - No process substitution.
- No
$'...'escape syntax.
- No
Validation
- Use ShellCheck with the
--shell=shflag to ensure POSIX compliance.
- Use
Build LibreELEC for RK3576 SoC
masterTo build a LibreELEC image for the Rockchip RK3576 SoC, use the
make imagecommand with the appropriatePROJECT,DEVICE,ARCH, andUBOOT_SYSTEMparameters.Depending on your hardware target, use one of the following commands:
For
roc-pcsystems:PROJECT=Rockchip DEVICE=RK3576 ARCH=aarch64 UBOOT_SYSTEM=roc-pc make imageFor
rock-4dsystems:PROJECT=Rockchip DEVICE=RK3576 ARCH=aarch64 UBOOT_SYSTEM=rock-4d make image
Build LibreELEC images for RK3399 devices
masterTo build a LibreELEC image for a device using the Rockchip RK3399 SoC, use themake imagecommand with the appropriatePROJECT,DEVICE,ARCH, andUBOOT_SYSTEMenvironment variables. TheARCHmust be set toaarch64andPROJECTtoRockchip.Enter fastboot mode on DragonBoard 410c
masterTo write the
u-bootbootloader to the eMMC, the DragonBoard 410c must be in fastboot mode. Follow these steps:- While holding the Vol (-) button, power on the DragonBoard 410c by plugging it in.
- Once plugged into power, release the Vol (-) button.
- Wait approximately 20 seconds.
- The board should now be in fastboot mode.
Build LibreELEC images for RK3328 SoC devices
masterTo build LibreELEC images for devices using the Rockchip RK3328 SoC, use the
make imagecommand with the appropriateUBOOT_SYSTEMflag depending on your specific hardware target. ThePROJECT,DEVICE, andARCHparameters must be set as follows:PROJECT=RockchipDEVICE=RK3328ARCH=aarch64
Build LibreELEC images for RK3588 SoC devices
masterTo build LibreELEC images for devices using the Rockchip RK3588 SoC, use themake imagecommand with the following environment variables:PROJECT=Rockchip,DEVICE=RK3588, andARCH=aarch64. You must also specify the correctUBOOT_SYSTEMcorresponding to your specific hardware platform.