diff --git a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo index 03f93b264..ca3e7cd44 100755 --- a/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo +++ b/meta-digi-dey/recipes-digi/sysinfo/sysinfo/sysinfo @@ -235,18 +235,17 @@ make_report(){ echo "- -" echo "--------------------------------------" echo "" - if [ -d /sys/fsl_otp ]; then - for f in /sys/fsl_otp/*; do - echo -e "$f:\t$(cat $f)" - done + if grep -qs '\' /proc/device-tree/compatible; then + OTP_PATH="/sys/devices/platform/scu/scu\:imx8qx-ocotp/imx-scu-ocotp0" + else + OTP_PATH="/sys/bus/nvmem/devices/imx-ocotp0" + fi + + if [ -e ${OTP_PATH}/nvmem ]; then + echo "${OTP_PATH}:" + hexdump -C -v ${OTP_PATH}/nvmem echo "" fi - for d in /sys/bus/nvmem/devices/imx-ocotp*; do - [ -e $d ] || continue - echo "$d:" - hexdump -C $d/nvmem - echo "" - done echo "--------------------------------------" echo "- -" @@ -255,11 +254,23 @@ make_report(){ echo "--------------------------------------" echo "" - if [ -e /sys/fsl_otp/HW_OCOTP_CFG5 ]; then - if [ "$(($(cat /sys/fsl_otp/HW_OCOTP_CFG5) & 2))" != "0" ]; then - echo "Device status: [CLOSED]" + if grep -qs '\' /proc/device-tree/compatible; then + if [ -f "/proc/device-tree/digi,tf-closed" ]; then + echo "Security status: [CLOSED]" + elif [ -f "/proc/device-tree/digi,tf-open" ]; then + echo "Security status: [OPEN]" + fi + else + if [ -e ${OTP_PATH}/nvmem ]; then + # Check SEC_CONFIG on OCOTP_CFG5 (ADDR=6) bit 1. + SEC_CONFIG_WORD=$(dd if=${OTP_PATH}/nvmem of=/dev/stdout bs=4 skip=6 count=1 status=none | hexdump -n 4 -v -e '1/4 "%08x\n"') + if [ "$((${SEC_CONFIG_WORD} & 0x2))" != "0" ]; then + echo "Security status: [CLOSED]" + else + echo "Security status: [OPEN]" + fi else - echo "Device status: [OPEN]" + echo "Security status: [UNKNOWN]" fi fi