diff --git a/README.md b/README.md index 5387127..9321541 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,6 @@ service configuration and further, available services. See [docs/network.md](docs/network.md) for a description on how to do static network configuration with the provided script and service. + +See [docs/swclock.md](docs/swclock.md) for a description on the software pseudo +RTC implementation for systems that do not have a hardware real time clock. diff --git a/docs/defconfig.md b/docs/defconfig.md index f0a6c86..c58848e 100644 --- a/docs/defconfig.md +++ b/docs/defconfig.md @@ -113,10 +113,6 @@ For the shutdown and reboot targets, the following services are executed: kernels clock from the hardware at bootup, between the `vfs` and `sysinit` targets. * nft - If enabled, restores net filter table rules during boot. - * swclock - For systems that don't have a hardware clock, this service - restores a somewhat usable time from a file during boot. - * swclocksave - For systems that don't have a hardware clock, this service - saves the current time to a file during shutdown or reboot. * sshd_keygen - A wait type service that generates host keys for the OpenSSH server and then disables itself. * sshd - Starts an OpenSSH server after the network pseudo service and after diff --git a/docs/network.md b/docs/network.md index f111a8f..3403932 100644 --- a/docs/network.md +++ b/docs/network.md @@ -81,3 +81,14 @@ follows is passed on to `ip route add` or `ip rule add` respectively. An additional service is provided that restores the nft rule set from `/etc/nftables.rules`. + + +# DHCP based network configuration + +If the configure option `--enable-dhcpclient` is set, two services are added. +The service `dhpcdmaster` launches a global dhcpcd instance. + +For each port that should be configured via DHCP, the service `dhcpcd` needs +to be enabled manually with the port name as argument. The service the runs +after the master service and sends a signal to the master to operate on that +port. diff --git a/docs/swclock.md b/docs/swclock.md new file mode 100644 index 0000000..40ce0c0 --- /dev/null +++ b/docs/swclock.md @@ -0,0 +1,25 @@ +# Software Pseudo RTC + +If the configure flag `--enable-swclock` is set, a few service and cron jobs +are enabled that try to help with systems that don't have a hardware real +time clock. + +The software pseudo RTC uses a file in `/var/lib` (exact path can be +configured) as backing store for the current date and time. + +When booting the system, a service called `swclock` restores the current time +from the file. When performing a reboot or shutdown, a service called +`swclocksave` writes the current time back to the file. + +A cron job is enabled that writes the current time to the backing file hourly, +so in case the system momentarily loses power, it loses "only" up to one hour. +The time will drift much worse anyway if the system is powered off (even +intentionally) for a while. + +All this is ensures that the system clock is monotonically increasing and only +somewhat behind the actual wall clock time. + +To catch up with real time, an additional cron job is enabled that tries to +update the time from an NTP server every four hours. This functionality is +implemented in a small shell script, that is also called from a dhcpcd hook +once a lease is obtained, assuming the DHCP client configure option was set.