sysinfo: read U-Boot from the device tree

This allows to correctly read the U-Boot version when using encrypted images.
Leave the current implementation as a fallback, in case the system is using an
old U-Boot which does not populate the device tree property.

https://jira.digi.com/browse/DEL-3025

Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
This commit is contained in:
Diaz de Grenu, Jose 2016-10-25 12:59:58 +02:00
parent 2405428230
commit 66728c99fd
1 changed files with 6 additions and 3 deletions

View File

@ -188,9 +188,12 @@ make_report(){
DISTRO="$(sed -ne 's,DISTRO = \(.*\)$,\1,g;T;p' /etc/build)"
DEY_VERSION="$(sed -ne 's,DISTRO_VERSION = \(.*\)$,\1,g;T;p' /etc/build)"
UBOOT_PARTITION="/dev/mmcblk0boot0"
[ -c "/dev/mtd0" ] && UBOOT_PARTITION="/dev/mtd0"
UBOOT_VERSION="$(strings ${UBOOT_PARTITION} | grep -m 1 dub | cut -d' ' -f2)"
UBOOT_VERSION="$(cat /proc/device-tree/digi,uboot,version 2>/dev/null)"
if [ -z "${UBOOT_VERSION}" ]; then
UBOOT_PARTITION="/dev/mmcblk0boot0"
[ -c "/dev/mtd0" ] && UBOOT_PARTITION="/dev/mtd0"
UBOOT_VERSION="$(strings ${UBOOT_PARTITION} | grep -m 1 dub | cut -d' ' -f2)"
fi
MACHINE="$(cat /proc/device-tree/digi,machine,name)"
BOARD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant)"
BOARD_SN="$(cat /proc/device-tree/digi,hwid,sn)"