Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Production Test Suite
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
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
Production Test Suite
Commits
19a85bcd
Commit
19a85bcd
authored
Jan 16, 2017
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sdbfs: generate sdbfs flash image also for SVEC
parent
e7b79118
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
13 additions
and
49 deletions
+13
-49
gen_flash_image.py
sdbfs/gen_flash_image.py
+13
-19
--SDB-CONFIG--
sdbfs/sdbfs-eeprom/--SDB-CONFIG--
+0
-30
calibration
sdbfs/sdbfs-flash/calibration
+0
-0
mac-address
sdbfs/sdbfs-flash/mac-address
+0
-0
sfp-database
sdbfs/sdbfs-flash/sfp-database
+0
-0
wr-init
sdbfs/sdbfs-flash/wr-init
+0
-0
--SDB-CONFIG--
sdbfs/sdbfs-spec/--SDB-CONFIG--
+0
-0
bitstream
sdbfs/sdbfs-spec/bitstream
+0
-0
calibration
sdbfs/sdbfs-spec/calibration
+0
-0
mac-address
sdbfs/sdbfs-spec/mac-address
+0
-0
sfp-database
sdbfs/sdbfs-spec/sfp-database
+0
-0
wr-init
sdbfs/sdbfs-spec/wr-init
+0
-0
No files found.
sdbfs/gen_flash_image.py
View file @
19a85bcd
...
...
@@ -21,10 +21,9 @@ import shutil
#class CSDBGenerator :
SDBFS_MAC
=
"{path}sdbfs-{type}/mac-address"
SDBFS_BSTR
=
"{path}sdbfs-
flash
/bitstream"
SDBFS_BSTR
=
"{path}sdbfs-
{type}
/bitstream"
SDBFS_IMG
=
"{path}sdbfs-{type}-{mac}.bin"
GEN_FLASH_CMD
=
"{path}./gensdbfs -b 65536 {path}sdbfs-flash {img}"
GEN_EEPROM_CMD
=
"{path}./gensdbfs {path}sdbfs-eeprom {img}"
GEN_FLASH_CMD
=
"{path}./gensdbfs -b 65536 {path}sdbfs-{type} {img}"
###########################################################
...
...
@@ -37,7 +36,7 @@ def check_mac(mac):
###########################################################
# type can be either "
flash" or "eeprom
"
# type can be either "
spec" or "svec
"
def
gen_sdb_image
(
type
,
mac
,
bstr
,
output
=
None
):
if
mac
and
not
check_mac
(
mac
):
...
...
@@ -46,7 +45,7 @@ def gen_sdb_image(type, mac, bstr, output=None):
# Translate MAC to be always in XX-XX-XX-XX-XX-XX format
mac
=
mac
.
replace
(
':'
,
'-'
)
# Get the absolute path where this script resides. This lets us have always
# access to the sdbfs-
flash/eeprom
structure, no matter where this script is
# access to the sdbfs-
spec/svec
structure, no matter where this script is
# called.
abs_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
+
'/'
...
...
@@ -60,25 +59,20 @@ def gen_sdb_image(type, mac, bstr, output=None):
f
.
close
()
# 2. copy bitstream to SDBFS, if needed
sdbfs_bstr
=
SDBFS_BSTR
.
format
(
path
=
abs_path
)
#<abs_path>/sdbfs-flash
/bitstream
if
type
==
"flash"
and
bstr
:
sdbfs_bstr
=
SDBFS_BSTR
.
format
(
path
=
abs_path
,
type
=
type
)
#<abs_path>/sdbfs-<type>
/bitstream
if
bstr
:
print
"Including bitstream "
+
bstr
shutil
.
copy
(
bstr
,
sdbfs_bstr
)
el
if
type
==
"flash"
:
#truncate bitstream file if not given
for flash
el
se
:
#truncate bitstream file if not given
f
=
open
(
sdbfs_bstr
,
'wb'
)
f
.
truncate
()
f
.
close
()
# 3. generate SDBFS image
sdbfs_img
=
SDBFS_IMG
.
format
(
path
=
abs_path
,
type
=
type
,
mac
=
mac
)
if
type
==
"flash"
:
# gensdbfs for flash
cmd
=
GEN_FLASH_CMD
.
format
(
path
=
abs_path
,
img
=
sdbfs_img
)
elif
type
==
"eeprom"
:
# gensdbfs for eeprom
cmd
=
GEN_EEPROM_CMD
.
format
(
path
=
abs_path
,
img
=
sdbfs_img
)
# gensdbfs for spec/svec
cmd
=
GEN_FLASH_CMD
.
format
(
path
=
abs_path
,
type
=
type
,
img
=
sdbfs_img
)
subprocess
.
Popen
(
cmd
,
shell
=
True
)
.
wait
()
print
"Generated "
+
sdbfs_img
# 4. Copy generated SDBFS image to <output>
...
...
@@ -90,13 +84,13 @@ def gen_sdb_image(type, mac, bstr, output=None):
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
<
3
:
print
"Wrong syntax"
print
sys
.
argv
[
0
]
+
" <
flash/eeprom
> <mac> [bitstream]"
print
sys
.
argv
[
0
]
+
" <
spec/svec
> <mac> [bitstream]"
sys
.
exit
()
type
=
sys
.
argv
[
1
]
if
type
!=
"
flash"
and
type
!=
"eeprom
"
:
if
type
!=
"
spec"
and
type
!=
"svec
"
:
print
"Wrong syntax"
print
sys
.
argv
[
0
]
+
" <
flash/eeprom
> <mac> [bitstream]"
print
sys
.
argv
[
0
]
+
" <
spec/svec
> <mac> [bitstream]"
sys
.
exit
()
#mac = check_mac(sys.argv[2])
...
...
sdbfs/sdbfs-eeprom/--SDB-CONFIG--
deleted
100644 → 0
View file @
e7b79118
#
# Even though in I2C eeproms we are going to be a subdirectory, not starting
# at offset zero at all, we want to start at zero *wihin* our space.
# This is actually the default, but stating it is better.
.
position = 0
# Then, we have a number of writable files. By default (i.e. no config)
# all existing files are created as read-only files with current contents
# and exact size.
#
# Allocation granularity is 64 bytes
mac-address
write = 1
maxsize = 6
wr-init
write = 1
maxsize = 256
# each sfp takes 29 bytes, 4 of them fit in 128 bytes
sfp-database
write = 1
maxsize = 128
# I don't know what this is
calibration
write = 1
maxsize = 128
sdbfs/sdbfs-flash/calibration
deleted
100644 → 0
View file @
e7b79118
sdbfs/sdbfs-flash/mac-address
deleted
100644 → 0
View file @
e7b79118
sdbfs/sdbfs-flash/sfp-database
deleted
100644 → 0
View file @
e7b79118
sdbfs/sdbfs-flash/wr-init
deleted
100644 → 0
View file @
e7b79118
sdbfs/sdbfs-
flash
/--SDB-CONFIG--
→
sdbfs/sdbfs-
spec
/--SDB-CONFIG--
View file @
19a85bcd
File moved
sdbfs/sdbfs-
flash
/bitstream
→
sdbfs/sdbfs-
spec
/bitstream
View file @
19a85bcd
File moved
sdbfs/sdbfs-
eeprom
/calibration
→
sdbfs/sdbfs-
spec
/calibration
View file @
19a85bcd
File moved
sdbfs/sdbfs-
eeprom
/mac-address
→
sdbfs/sdbfs-
spec
/mac-address
View file @
19a85bcd
File moved
sdbfs/sdbfs-
eeprom
/sfp-database
→
sdbfs/sdbfs-
spec
/sfp-database
View file @
19a85bcd
File moved
sdbfs/sdbfs-
eeprom
/wr-init
→
sdbfs/sdbfs-
spec
/wr-init
View file @
19a85bcd
File moved
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