libubootenv: adapt recipe to platforms with bootloader environment in UBI volume
This commit adds support to read bootloader environment from a UBI volume. https://onedigi.atlassian.net/browse/DEL-8133 Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
parent
05d25ab36d
commit
d4544a7f43
|
|
@ -12,10 +12,11 @@ UBOOT_CONFIG[ccimx6ulsbc1GB] = "ccimx6ulsbc1GB_defconfig,,u-boot-dtb.${UBOOT_SUF
|
|||
UBOOT_CONFIG[ccimx6ulsbc512MB] = "ccimx6ulsbc512MB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
|
||||
UBOOT_CONFIG[ccimx6ulsbc] = "ccimx6ulsbc_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
|
||||
|
||||
# U-Boot environment offset (within partition)
|
||||
UBOOT_ENV_OFFSET ?= "0x0"
|
||||
# U-Boot environment size
|
||||
UBOOT_ENV_SIZE ?= "0x20000"
|
||||
# U-Boot environment offset (within partition)
|
||||
UBOOT_ENV_OFFSET ?= "0x0"
|
||||
UBOOT_ENV_REDUND_OFFSET ?= "${UBOOT_ENV_SIZE}"
|
||||
# U-Boot environment range: size (in hex) in the environment partition that
|
||||
# the U-Boot environment can take up (if undefined, it will take up all the
|
||||
# available space in the environment partition)
|
||||
|
|
|
|||
|
|
@ -12,10 +12,11 @@ UBOOT_CONFIG[ccimx6ulstarter1GB] = "ccimx6ulstarter1GB_defconfig,,u-boot-dtb.${U
|
|||
UBOOT_CONFIG[ccimx6ulstarter512MB] = "ccimx6ulstarter512MB_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
|
||||
UBOOT_CONFIG[ccimx6ulstarter] = "ccimx6ulstarter_defconfig,,u-boot-dtb.${UBOOT_SUFFIX}"
|
||||
|
||||
# U-Boot environment offset (within partition)
|
||||
UBOOT_ENV_OFFSET ?= "0x0"
|
||||
# U-Boot environment size
|
||||
UBOOT_ENV_SIZE ?= "0x20000"
|
||||
# U-Boot environment offset (within partition)
|
||||
UBOOT_ENV_OFFSET ?= "0x0"
|
||||
UBOOT_ENV_REDUND_OFFSET ?= "${UBOOT_ENV_SIZE}"
|
||||
# U-Boot environment range: size (in hex) in the environment partition that
|
||||
# the U-Boot environment can take up (if undefined, it will take up all the
|
||||
# available space in the environment partition)
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ IMAGE_CLASSES = "image_types_digi image_types-stubi"
|
|||
|
||||
# U-Boot environment offset (within partition)
|
||||
UBOOT_ENV_OFFSET ?= "0x0"
|
||||
UBOOT_ENV_REDUND_OFFSET ?= "0x0"
|
||||
# U-Boot environment size
|
||||
UBOOT_ENV_SIZE ?= "0x20000"
|
||||
# U-Boot environment range: size (in hex) in the environment partition that
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
# Configuration file for fw_(printenv/setenv) utility.
|
||||
# Up to two entries are valid, in this case the redundant
|
||||
# environment sector is assumed present.
|
||||
# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
|
||||
# Futhermore, if the Flash sector size is omitted, this value is assumed to
|
||||
# be the same as the Environment size, which is valid for NOR and SPI-dataflash
|
||||
# Device offset must be prefixed with 0x to be parsed as a hexadecimal value.
|
||||
|
||||
# UBI volume by name Offset Size Erase-size
|
||||
/dev/ubi0:uboot_config ##ENV_OFFSET## ##ENV_SIZE## ##ENV_SIZE##
|
||||
/dev/ubi0:uboot_config_r ##ENV_REDUND_OFFSET## ##ENV_SIZE## ##ENV_SIZE##
|
||||
|
|
@ -11,6 +11,8 @@ FW_CONFIG_FILE = "${@bb.utils.contains('STORAGE_MEDIA', 'mtd', \
|
|||
'${STORAGE_MEDIA}/fw_env.config', \
|
||||
d)}"
|
||||
|
||||
FW_CONFIG_FILE:ccmp1 = "ubi/fw_env.config"
|
||||
|
||||
SRC_URI += " \
|
||||
file://${FW_CONFIG_FILE} \
|
||||
file://0001-Implement-support-for-environment-encryption-by-CAAM.patch \
|
||||
|
|
@ -23,6 +25,9 @@ do_install:append() {
|
|||
install -m 0644 ${WORKDIR}/${FW_CONFIG_FILE} ${D}${sysconfdir}/fw_env.config
|
||||
}
|
||||
|
||||
UBOOT_ENV_PARTITION = "environment"
|
||||
UBOOT_ENV_PARTITION:ccmp1 = "UBI"
|
||||
|
||||
pkg_postinst_ontarget:${PN}() {
|
||||
CONFIG_FILE="/etc/fw_env.config"
|
||||
MMCDEV="$(sed -ne 's,.*root=/dev/mmcblk\([0-9]\)p.*,\1,g;T;p' /proc/cmdline)"
|
||||
|
|
@ -31,12 +36,12 @@ pkg_postinst_ontarget:${PN}() {
|
|||
fi
|
||||
|
||||
PARTTABLE="/proc/mtd"
|
||||
MTDINDEX="$(sed -ne "s/\(^mtd[0-9]\+\):.*\<environment\>.*/\1/g;T;p" ${PARTTABLE} 2>/dev/null)"
|
||||
MTDINDEX="$(sed -ne "s/\(^mtd[0-9]\+\):.*\<${UBOOT_ENV_PARTITION}\>.*/\1/g;T;p" ${PARTTABLE} 2>/dev/null)"
|
||||
if [ -n "${MTDINDEX}" ]; then
|
||||
# Initialize variables for fixed offset values
|
||||
# (backwards compatible with old U-Boot)
|
||||
ENV_OFFSET="${UBOOT_ENV_OFFSET}"
|
||||
ENV_REDUND_OFFSET="${UBOOT_ENV_SIZE}"
|
||||
ENV_REDUND_OFFSET="${UBOOT_ENV_REDUND_OFFSET}"
|
||||
ENV_SIZE="${UBOOT_ENV_SIZE}"
|
||||
ERASEBLOCK=""
|
||||
NBLOCKS=""
|
||||
|
|
|
|||
Loading…
Reference in New Issue