Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Starting Kit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Starting Kit
Commits
70996edc
Commit
70996edc
authored
Mar 28, 2014
by
Benoit Rat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
script: add function to ease writting eeprom
parent
cf5c34c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
wr-ssk-get
scripts/wr-ssk-get
+44
-0
No files found.
scripts/wr-ssk-get
View file @
70996edc
...
...
@@ -133,6 +133,48 @@ checkdrv()
}
weeprom
()
{
##Compile the fru generator lib
if
!
(
test
-f
${
scriptdir
}
/../spec-sw/fmc-bus/tools/libipmi/libipmi.so
)
;
then
make
-C
${
scriptdir
}
/../spec-sw/fmc-bus/tools/libipmi/
fi
i
=
0
cd
/sys/bus/fmc/devices/
echo
"Found"
$(
ls
|
grep
fmc- |
wc
-w
)
"FMC board(s) with empty EEPROM"
for
fmc
in
$(
ls
|
grep
fmc-
)
;
do
i
=
$((
$i
+
1
))
sn
=
$(
eval echo
"
\$
{
${
i
}
}"
)
##echo "#$i: fmc=$fmc S/N=$sn"
##Ask user about the SN
while
[
"x"
$(
echo
$sn
|
grep
"^
\(
[0-9]
\{
1,2
\}
-
\)\?
[0-9]
\{
1,3
\}
$"
)
=
"x"
]
;
do
read
-p
"Enter S/N for board
${
fmc
}
in the format xx-XXX (or 0) : "
sn
done
## Parse it
if
(
echo
${
sn
}
|
grep
"-"
>
/dev/null
)
;
then
sn
=
$(
echo
${
sn
}
|
awk
-F
"-"
'{ print "7S-DIO-v2-S" $1 "-" $2 }'
)
else
sn
=
$(
printf
"7S-DIO-v2-S00-%03d"
${
sn
})
fi
echo
"Writing eeprom with S/N:
${
sn
}
..."
## Write EEPROM file
${
scriptdir
}
/../spec-sw/fmc-bus/tools/fru-generator
\
-v
"CERN"
-n
"FmcDio5cha"
-p
"EDA-02408-V2-0"
-s
${
sn
}
>
/tmp/fmc-dio-eeprom.bin
## Write to device
cat
/tmp/fmc-dio-eeprom.bin
>
/sys/bus/fmc/devices/
${
fmc
}
/eeprom
if
[
$?
-eq
0
]
;
then
echo
"Done"
;
fi
done
}
done
}
### Load module
loadmodule
()
{
...
...
@@ -208,6 +250,7 @@ Options:
-f|--fetch) Fetch files only
-i|--install) Install the gateware for the driver (require sudo)
-l|--load) Load modules in kernel (require sudo)
-w|--weeprom [sn1 [sn2] ...]) Write fmc eeprom with the given serial number for each slots
--insert) Insert modules in kernel (require sudo)
--report) Make everything and generate report.log
EOF
...
...
@@ -229,6 +272,7 @@ while [ $# -gt 0 ]; do # Until you run out of parameters . . .
-f
|
--fetch
)
fetch
;
exit
;;
-i
|
--install
)
insthdl
;
exit
;;
-l
|
--load
)
loadmodule
;
exit
;;
-w
|
--weeprom
)
weeprom
$2
$3
$4
$5
$6
;
exit
;;
--insert
)
insertmodule
;
exit
;;
--report
)
reportlog
;
exit
;;
*
)
help
;;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment