libubootenv: adapt recipe for read-only-rootfs

The config file /etc/fw_env.config is generated dynamically basing on
the partition table and, in the case of NAND-based SOMs, on the NAND
geometry. This is done on a postinst script that modifies the file on the
first boot of the target. Since this is not allowed on read-only-rootfs,
this commit adds a default fw_env.config file to use instead when
read-only-rootfs is enabled.

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

https://onedigi.atlassian.net/browse/DEL-7708
This commit is contained in:
Hector Palacios 2021-10-27 18:51:25 +02:00
parent c89a66480b
commit 7cd57a40e3
2 changed files with 20 additions and 2 deletions

View File

@ -0,0 +1,9 @@
# Configuration file for fw_(printenv/setenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# If both copies are set to the same offset, an automatic mechanism will
# determine the first good sectors where each copy lives, skipping bad blocks.
# Device name Offset Size Erase-size No.Blocks
/dev/mtd1 0x0 0x20000 0x20000 8
/dev/mtd1 0x0 0x20000 0x20000 8

View File

@ -2,8 +2,17 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
# Chose a between a default hard-coded config file (for read-only rootfs)
# or a dynamically generated one (with a postinst script)
FW_CONFIG_FILE = "${@bb.utils.contains('STORAGE_MEDIA', 'mtd', \
bb.utils.contains('IMAGE_FEATURES', 'read-only-rootfs', \
'${STORAGE_MEDIA}/fw_env.config_default', \
'${STORAGE_MEDIA}/fw_env.config', d), \
'${STORAGE_MEDIA}/fw_env.config', \
d)}"
SRC_URI += " \
file://${STORAGE_MEDIA}/fw_env.config \
file://${FW_CONFIG_FILE} \
file://0001-Implement-support-for-environment-encryption-by-CAAM.patch \
file://0002-Implement-U-Boot-environment-access-functions.patch \
file://0003-tools-env-add-support-to-set-dynamic-location-of-env.patch \
@ -11,7 +20,7 @@ SRC_URI += " \
do_install_append() {
install -d ${D}${sysconfdir}
install -m 0644 ${WORKDIR}/${STORAGE_MEDIA}/fw_env.config ${D}${sysconfdir}/
install -m 0644 ${WORKDIR}/${FW_CONFIG_FILE} ${D}${sysconfdir}/fw_env.config
}
pkg_postinst_ontarget_${PN}() {