@@ -7,4 +7,6 @@ Type=oneshot
RemainAfterExit=yes
TimeoutStartSec=30sec
ExecStart=@LIBEXECDIR@/zram-swap-init /dev/zram0
+# Trigger device discovery after the swap signature is written.
+ExecStartPost=-@BASE_BINDIR@/udevadm trigger --action=change /sys/block/zram0
ExecStop=@LIBEXECDIR@/zram-swap-deinit /dev/zram0
@@ -5,7 +5,7 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda
inherit update-rc.d systemd
RDEPENDS:${PN} = "kmod util-linux-swaponoff \
- ${@bb.utils.contains('DISTRO_FEATURES','systemd','util-linux-zramctl','',d)}"
+ ${@bb.utils.contains('DISTRO_FEATURES','systemd','util-linux-zramctl udev','',d)}"
RRECOMMENDS:${PN} = "kernel-module-zram"
@@ -32,7 +32,8 @@ do_install () {
install -m 0755 ${UNPACKDIR}/zram-swap-deinit ${D}${libexecdir}
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${UNPACKDIR}/zram-swap.service ${D}${systemd_unitdir}/system/zram-swap.service
- sed -i -e "s,@LIBEXECDIR@,${libexecdir},g" ${D}${systemd_unitdir}/system/zram-swap.service
+ sed -i -e "s,@LIBEXECDIR@,${libexecdir},g" \
+ -e "s,@BASE_BINDIR@,${base_bindir},g" ${D}${systemd_unitdir}/system/zram-swap.service
install -m 0644 ${UNPACKDIR}/dev-zram0.swap ${D}${systemd_unitdir}/system/dev-zram0.swap
fi
}
When zram is initialized before real-root coldplug, systemd may still wait for udev to discover the device before activating swap. The initial capacity change from zero does not emit a change event. Trigger one after zram-swap-init completes so udev can process the initialized device earlier. Ignore trigger failures to retain the coldplug fallback. On rb3gen2-core-kit, median times after real-root PID1 startup decreased from 2.66 s to 1.71 s for zram device readiness and from 2.68 s to 1.78 s for swap activation in alternating warm boots. AI-Generated: Uses Codex (GPT-6) Signed-off-by: Wenwen Fu <wenwfu@qti.qualcomm.com> --- meta-oe/recipes-extended/zram/zram/zram-swap.service | 2 ++ meta-oe/recipes-extended/zram/zram_0.2.bb | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) base-commit: 914fca8c896edcde152e8a77661840130bbcc517