From f85cd4e2eeb1248cfe95e1ad354b20c4c4d87617 Mon Sep 17 00:00:00 2001 From: Alex Gonzalez Date: Thu, 31 May 2018 14:20:06 +0200 Subject: [PATCH] meta-digi-dey: sysinfo: Fix for use with mainline kernels * Check for file before using it This just avoids the failure, on mainline access to OTP would need to be done differently, see: https://jira.digi.com/browse/ACL-163 * Use compatible node instead of digi,machine,name Signed-off-by: Alex Gonzalez --- meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo index f938a6efc..43a0e2802 100755 --- a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo +++ b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo @@ -236,10 +236,12 @@ make_report(){ echo "--------------------------------------" echo "" - if [ "$(($(cat /sys/fsl_otp/HW_OCOTP_CFG5) & 2))" != "0" ]; then - echo "Device status: [CLOSED]" - else - echo "Device status: [OPEN]" + if [ -e /sys/fsl_otp/HW_OCOTP_CFG5 ]; then + if [ "$(($(cat /sys/fsl_otp/HW_OCOTP_CFG5) & 2))" != "0" ]; then + echo "Device status: [CLOSED]" + else + echo "Device status: [OPEN]" + fi fi if [ -f "/proc/device-tree/digi,uboot-env,encrypted" ]; then @@ -260,7 +262,7 @@ if [ -z "${UBOOT_VERSION}" ]; then [ -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 | tr -d '\0')" +MACHINE="$(cat /proc/device-tree/compatible | tr '\0' '\t' | cut -f 1)" BOARD_VARIANT="$(cat /proc/device-tree/digi,hwid,variant | tr -d '\0')" BOARD_SN="$(cat /proc/device-tree/digi,hwid,sn | tr -d '\0')" BOARD_VERSION="$(cat /proc/device-tree/digi,carrierboard,version | tr -d '\0')"