Preserve random seed across reboots
At first I tried to just use systemd's systemd-random-seed, but that one
does not actually use an appropriate ioctl for persuading kernel that
entropy is there. There's a patch [1] for this, but its fate is far from
certain, and even with it, I am not completely sure that I got
everything working correctly (some boots were quick, others waited for
systemd-resolved in the same manner as before this patch).
In the end, just seeding stuff from the initrd [2] is much easier. A
downside is that the systemd unit systemd-random-seed.service will add
the contents of that file once again -- but that doesn't matter much
because we do not patch it, and therefore it does not increase kernel's
idea about available entropy.
Changes from that upstream rndaddentropy:
- larger buffer
- more conservative entropy contribution
[1] https://github.com/systemd/systemd/pull/10621 .
[2] https://github.com/rfinnie/twuewand/blob/master/rndaddentropy/rndaddentropy.c
Change-Id: Ibe3c926c241d75fb7d7c40f3df2a96813931971b
diff --git a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
index 98ca80c..67f2e55 100644
--- a/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
+++ b/package/czechlight-cfg-fs/czechlight-cfg-fs.mk
@@ -12,10 +12,15 @@
$(error CZECHLIGHT_CFG_FS_SIZE cannot be empty)
endif
+define CZECHLIGHT_CFG_FS_BUILD_CMDS
+ $(TARGET_CC) $(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/czechlight-random-seed.c -o czechlight-random-seed
+endef
+
define CZECHLIGHT_CFG_FS_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 \
$(BR2_EXTERNAL_CZECHLIGHT_PATH)/package/czechlight-cfg-fs/init-czechlight.sh \
$(TARGET_DIR)/sbin/init-czechlight.sh
+ $(INSTALL) -D -m 0755 czechlight-random-seed $(TARGET_DIR)/sbin/czechlight-random-seed
mkdir -p $(TARGET_DIR)/cfg
$(ifeq ($(CZECHLIGHT_CFG_FS_PERSIST_SYSREPO),y))
mkdir -p $(TARGET_DIR)/usr/lib/systemd/system/multi-user.target.wants/