sysinfo: adapt script after removal of deprecated fsl_otp driver
- OTP section
- Use just one fixed path to the OTP nvmem device descriptor (instead
of a loop).
- Use '-v' for dumping all values with hexdump.
- TrustFence section
- For cc8x, determine if the device is closed by checking a new boolean
property on the DT: digi,tf-open|closed
- For the rest, check the SEC_CONFIG[1] bit using the new nvmem
descriptor.
- Change log from 'Device status' to 'Security status'
- Report UNKNOWN if nvmem device does not exist.
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
https://jira.digi.com/browse/DEL-7185
(cherry picked from commit f6a8de0067)
This commit is contained in:
parent
6f8944a501
commit
c24d1d96a7
|
|
@ -235,18 +235,17 @@ make_report(){
|
||||||
echo "- -"
|
echo "- -"
|
||||||
echo "--------------------------------------"
|
echo "--------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
if [ -d /sys/fsl_otp ]; then
|
if grep -qs '\<digi,ccimx8x\>' /proc/device-tree/compatible; then
|
||||||
for f in /sys/fsl_otp/*; do
|
OTP_PATH="/sys/devices/platform/scu/scu\:imx8qx-ocotp/imx-scu-ocotp0"
|
||||||
echo -e "$f:\t$(cat $f)"
|
else
|
||||||
done
|
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 ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
for d in /sys/bus/nvmem/devices/imx-ocotp*; do
|
|
||||||
[ -e $d ] || continue
|
|
||||||
echo "$d:"
|
|
||||||
hexdump -C $d/nvmem
|
|
||||||
echo ""
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "--------------------------------------"
|
echo "--------------------------------------"
|
||||||
echo "- -"
|
echo "- -"
|
||||||
|
|
@ -255,11 +254,23 @@ make_report(){
|
||||||
echo "--------------------------------------"
|
echo "--------------------------------------"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ -e /sys/fsl_otp/HW_OCOTP_CFG5 ]; then
|
if grep -qs '\<digi,ccimx8x\>' /proc/device-tree/compatible; then
|
||||||
if [ "$(($(cat /sys/fsl_otp/HW_OCOTP_CFG5) & 2))" != "0" ]; then
|
if [ -f "/proc/device-tree/digi,tf-closed" ]; then
|
||||||
echo "Device status: [CLOSED]"
|
echo "Security status: [CLOSED]"
|
||||||
|
elif [ -f "/proc/device-tree/digi,tf-open" ]; then
|
||||||
|
echo "Security status: [OPEN]"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Device status: [OPEN]"
|
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 "Security status: [UNKNOWN]"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue