Skip to content
Snippets Groups Projects
Commit ae0825a5 authored by David Mondou's avatar David Mondou
Browse files

Added ability to read custom serial numbers.

parent 17ba8816
No related branches found
No related tags found
No related merge requests found
......@@ -15,10 +15,10 @@ get_sn () {
local base=$1
local arena=$(get_fuse HW_OCOTP_GP$base 7)
if [[ ${arena:0:2} == "00" ]] ; then
# starts with "00", so doesn't start with ascii hex value
# starts with "00", so doesn't start with ascii hex value
arena=${arena:2}
else
# doesn't start with "00", so starts with ascii hex value
# doesn't start with "00", so starts with ascii hex value
arena=$(printf "\x${arena:0:2}${arena:2}")
fi
......@@ -28,11 +28,45 @@ get_sn () {
echo "$arena$build-$unit"
}
if [[ "$(cat /sys/fsl_otp/HW_OCOTP_GP37)" == "0x0" ]] ; then
#Read create custom serial number from fuses
get_custom_sn() {
local fuse_70=`cat /sys/fsl_otp/HW_OCOTP_GP70`
local fuse_71=`cat /sys/fsl_otp/HW_OCOTP_GP71`
local fuse_72=`cat /sys/fsl_otp/HW_OCOTP_GP72`
local strhex
#Check for empty fuse bank
if [ ${fuse_72} != "0x0" ]; then
strhex=${fuse_72:2:8}
fi
#Check for empty fuse bank
if [ ${fuse_71} != "0x0" ]; then
strhex=${strhex}${fuse_71:2:8}
fi
strhex=${strhex}${fuse_70:2:8}
local i=1
max=$(( ${#strhex} + 1 ))
#convert hex string to ascii string
while [ $i -lt $max ]
do
hex='\x'`echo $strhex | cut -c $i-$(( i + 1 ))`
custom_sn=$custom_sn$hex
i=$(( i + 2 ))
done
echo -e $custom_sn
}
if [[ "$(cat /sys/fsl_otp/HW_OCOTP_GP70)" != "0x0" ]] ; then
hostname $(get_custom_sn)
elif [[ "$(cat /sys/fsl_otp/HW_OCOTP_GP37)" == "0x0" ]] ; then
# No unit serial number set, use board serial number
hostname $(get_sn 34).$url
else
# unit serial number set, use it
hostname $(get_sn 37).$url
fi
......@@ -4,7 +4,7 @@ SUMMARY = "Rigado's general purpose tool"
DESCRIPTION = "A tool for the gateway which changes functionality based on how it is linked"
# The latest commit
SRCREV = "313aef4435f7a03cfde79c2e480f3768d195e284"
SRCBRANCH ?= "v2.0.0"
SRCREV = "27ca31691fdd0a2e1aa5989e9fa9e22001b643e6"
SRCBRANCH ?= "v2.1.0"
require recipes-core/rigtools/rigtools.inc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment