When running kernel-overlays-setup as a systemd service we have
a short window where /lib/firmware isn't available.
This causes drm edid override to occasionally fail if the edid file
is requested between switching to sysroot and completion of the
kernel-overlays-setup script.
Setting up firmware and module overlays in init, before switching
to sysroot, closes the gap and also has the benefit that we no longer
need to care about the rather tedious systemd unit ordering.
Signed-off-by: Matthias Reichl <hias@horus.com>
Create the module and firmware symlink trees in /run/kernel-overlays
instead of /var/lib as recommended by FHS 3.0. This also allows us
to drop the After=var.mount ordering in the systemd service.
Signed-off-by: Matthias Reichl <hias@horus.com>
connman's NTP client can't be used if it's not managing the network
interface so use systemd's timesyncd as we already build it.
timesyncd is automatically configured to use the NTP servers provided
by kernel ip config, if they are missing the default fallback NTP
servers (currently the ones from Google) are used.
Users can also provide timesyncd configuration files via
/storage/.config/timesyncd.conf.d/ eg to change the (fallback) servers.
Signed-off-by: Matthias Reichl <hias@horus.com>
Setup system hostname, /etc/resolv.conf and /etc/hosts in a service
that can be run independently of connman.
The volatile etc files are created in /run/libreelec instead of
/run/connman so they can be modified similarily to standard linux
installations with a writable /etc. Connman can then hook into
that and move resolv.conf management to /run/connman/resolv.conf when
it's started.
If kernel IP configuration is used the resolv info from the kernel
will be used to create resolv.conf. Users can also provide their
own resolv.conf file in /storage/.config/resolv.conf which takes
precedence over ther kernel info. If no resolv.conf info is present
a fallback with use the Google nameservers is created (as before).
Loopback network interface setup has been removed, this is already
set up by systemd.
Signed-off-by: Matthias Reichl <hias@horus.com>
Creating an updates symlink to /storage/.config/firmware in the
kernel firmware directory makes it impossible to add firmware
overlays with an updates folder.
Furthermore bluez/hciattach only looks for firmware files directly in
the /lib/firmware directory and ignores the /lib/firmware/updates
directory. So adding BT firmware via .config/firmware didn't work.
Solve this by adding files from /storage/.config/firmware as the
last step in kernel overlays setup so firmware files from there
will show up directly under /lib/firmware and override other firmware
files installed by the system and kernel overlays.
Signed-off-by: Matthias Reichl <hias@horus.com>
Core Kernel modules are now installed to
/usr/lib/kernel-overlays/base/lib/modules instead of /usr/lib/modules
Firmware files are installed to
/usr/lib/kernel-overlays/base/lib/firmware instead of /usr/lib/firmware
Packages can choose to install their modules and/or firmwareinto a
different overlay directory than base so they are not automatically enabled.
A new systemd service kernel-overlays, which is run before any modules
are loaded, adds overlays enabled via /storage/.cache/kernel-overlays/*.conf
These conf files must either contain the name of a system overlay,
which will then be searched for in /usr/lib/kernel-overlays/, or an
absolute path starting with '/'.
Overlaying is implemented by symlinking files from the overlays
to /usr/lib/modules and /usr/lib/firmware as not all platforms
support overlayfs.
This overlaying system can also be used by addons to provide optional
kernel modules and/or firmware by storing the absolute path to the addon
directory in the conf file and shipping kernel modules in
<addondir>/lib/modules/<KERNELVER>.
To save space only symlinks for modules matching the currently
running kernel version are created as addons may want to ship
modules for older kernel versions as well to be backward-compatible
to older LibreELEC versions.
Changes since v1:
- fixup kernel-overlays-service: add before kmod-static-nodes.service
Fix static device nodes for module autoloading not being created.
- fixup kernel-overlays-service: fail if /usr/lib/modules exists
- squash kernel overlays: use get_kernel_overlay_dir in linux/package.mk
- Add support for firmware files via kernel overlays
- config/functions: include kernel overlays in addon installation
Signed-off-by: Matthias Reichl <hias@horus.com>