libubootenv: adjust postinstall script and fix inherit usage

* Replace the hard-coded '/etc' with ${sysconfdir}
* Extend the mmcblk check to prevent updating the environment configuration
  when booting from the EMMC (even though the kernel command line root
  passed is in the form of /dev/mmcblk).
* Switch the conditional inherit to inherit_defer as it depends on
  IMAGE_FEATURES to avoid parse-time ordering issues.

https://onedigi.atlassian.net/browse/DEL-9768

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2025-10-21 17:53:07 +02:00
parent da00e61f80
commit a02d48dc78
1 changed files with 3 additions and 3 deletions

View File

@ -41,9 +41,9 @@ UBOOT_ENV_PARTITION = "environment"
UBOOT_ENV_PARTITION:ccmp1 = "UBI"
pkg_postinst_ontarget:${PN}() {
CONFIG_FILE="/etc/fw_env.config"
CONFIG_FILE="${sysconfdir}/fw_env.config"
MMCDEV="$(sed -ne 's,.*root=/dev/mmcblk\([0-9]\)p.*,\1,g;T;p' /proc/cmdline)"
if [ -n "${MMCDEV}" ]; then
if [ -n "${MMCDEV}" ] && ! [ -b "/dev/mmcblk${MMCDEV}boot0" ]; then
sed -i -e "s,^/dev/mmcblk[^[:blank:]]\+,/dev/mmcblk${MMCDEV},g" ${CONFIG_FILE}
fi
@ -90,4 +90,4 @@ pkg_postinst_ontarget:${PN}() {
sync ${CONFIG_FILE}
}
inherit ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)}
inherit_defer ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)}