mirror of
https://github.com/libretro/Lakka-LibreELEC.git
synced 2024-11-24 11:26:19 +00:00
47c07c60ba
* Latest 4.3 changes poorly merged * Build fixes * Squash? * Fix ppsspp on switch * Fix video recording, add base stuff for nvv4l2 decoder/encoder, but leave disabled for now * Clean up left over files * Switch: Dont build xpadneo driver, but install configs * FFMpeg: Add back L4T decoder Patches
86 lines
2.1 KiB
Bash
Executable File
86 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
|
|
|
|
SYSTEM_OVERLAYS_DIR=/usr/lib/kernel-overlays
|
|
OVERLAY_CONFIG_DIR=/storage/.cache/kernel-overlays
|
|
KVER=$(uname -r)
|
|
RUNTIME_DIR="/run/kernel-overlays"
|
|
MODULES_DIR="${RUNTIME_DIR}/modules/${KVER}"
|
|
FIRMWARE_DIR="${RUNTIME_DIR}/firmware"
|
|
USER_FIRMWARE_DIR="/storage/.config/firmware"
|
|
|
|
mkdir -p "${MODULES_DIR}"
|
|
mkdir -p "${FIRMWARE_DIR}"
|
|
|
|
log() {
|
|
echo "kernel-overlays-setup: $@" > /dev/kmsg
|
|
}
|
|
|
|
apply_overlay() {
|
|
case "$1" in
|
|
/*)
|
|
modules_overlay_dir="${1}/lib/modules/${KVER}"
|
|
firmware_overlay_dir="${1}/lib/firmware"
|
|
;;
|
|
*)
|
|
modules_overlay_dir="${SYSTEM_OVERLAYS_DIR}/${1}/lib/modules/${KVER}"
|
|
firmware_overlay_dir="${SYSTEM_OVERLAYS_DIR}/${1}/lib/firmware"
|
|
;;
|
|
esac
|
|
|
|
if [ -d "${modules_overlay_dir}" ] ; then
|
|
GOT_MODULE_OVERLAY="yes"
|
|
|
|
if cp -rfs "${modules_overlay_dir}"/* "${MODULES_DIR}" ; then
|
|
log "added modules from $modules_overlay_dir"
|
|
else
|
|
log "failed to add modules from $modules_overlay_dir"
|
|
fi
|
|
fi
|
|
|
|
if [ -d "${firmware_overlay_dir}" ] ; then
|
|
if cp -rfs "${firmware_overlay_dir}"/* "${FIRMWARE_DIR}" ; then
|
|
log "added firmware from $firmware_overlay_dir"
|
|
else
|
|
log "failed to add firmware from $firmware_overlay_dir"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# setup system base modules
|
|
|
|
log "setup base modules"
|
|
apply_overlay base
|
|
|
|
# apply user-configured module overlays
|
|
|
|
if [ -d "${OVERLAY_CONFIG_DIR}" ] ; then
|
|
log "adding overlays from ${OVERLAY_CONFIG_DIR}"
|
|
GOT_MODULE_OVERLAY="no"
|
|
|
|
for conf in "${OVERLAY_CONFIG_DIR}/"*.conf ; do
|
|
if [ -e "$conf" ] ; then
|
|
log "processing conf $conf"
|
|
overlay=$(cat "$conf")
|
|
[ -n "$overlay" ] && apply_overlay "$overlay"
|
|
fi
|
|
done
|
|
|
|
if [ "yes" = "$GOT_MODULE_OVERLAY" ] ; then
|
|
log "running depmod"
|
|
/usr/sbin/depmod -a >/dev/kmsg 2>&1
|
|
fi
|
|
fi
|
|
|
|
if [ -d "${USER_FIRMWARE_DIR}" ] && [ -n "$(ls ${USER_FIRMWARE_DIR})" ] ; then
|
|
if cp -rfs "${USER_FIRMWARE_DIR}"/* "${FIRMWARE_DIR}" ; then
|
|
log "added firmware from ${USER_FIRMWARE_DIR}"
|
|
else
|
|
log "failed to add firmware from ${USER_FIRMWARE_DIR}"
|
|
fi
|
|
fi
|
|
|
|
log "done"
|