From f55c08406449733b41a77e20de426d0d21c1e30d Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Wed, 26 Jun 2024 08:55:20 +0200 Subject: [PATCH] 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 https://onedigi.atlassian.net/browse/DEL-9059 --- meta-digi-arm/recipes-bsp/libubootenv/libubootenv_%.bbappend | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meta-digi-arm/recipes-bsp/libubootenv/libubootenv_%.bbappend b/meta-digi-arm/recipes-bsp/libubootenv/libubootenv_%.bbappend index 3a0ee0f8d..15ffa5c44 100644 --- a/meta-digi-arm/recipes-bsp/libubootenv/libubootenv_%.bbappend +++ b/meta-digi-arm/recipes-bsp/libubootenv/libubootenv_%.bbappend @@ -1,4 +1,4 @@ -# Copyright (C) 2021-2023 Digi International Inc. +# Copyright (C) 2021-2024 Digi International Inc. FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" @@ -83,6 +83,8 @@ pkg_postinst_ontarget:${PN}() { -e "s/##NBLOCKS##/${NBLOCKS}/g" \ ${CONFIG_FILE} 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)}