libubootenv: flush changes to fw_env.config on post inst script

On devices with NAND as storage media, a post install script
modifies the fw_env.config file basing on the NAND geometry.
This only happens once after deployment, typically on production
environments. If the power is removed soon after the post install
script runs (which is a normal procedure on manufacturing
environments), there are chances that pending file system
operations have not been flushed, which may occasionally lead
to the fw_env.config file end up empty on the next reboot.

This commit adds a sync at the end of the post-install script
to guarantee the changes are written to the file system.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-9059
This commit is contained in:
Hector Palacios 2024-06-26 08:55:20 +02:00
parent 731bee3498
commit f55c084064
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 2021-2023 Digi International Inc. # Copyright (C) 2021-2024 Digi International Inc.
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
@ -83,6 +83,8 @@ pkg_postinst_ontarget:${PN}() {
-e "s/##NBLOCKS##/${NBLOCKS}/g" \ -e "s/##NBLOCKS##/${NBLOCKS}/g" \
${CONFIG_FILE} ${CONFIG_FILE}
fi fi
# Flush the file system to have the changes written
sync ${CONFIG_FILE}
} }
inherit ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)} inherit ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)}