shrinkwrap-tool 2026.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shrinkwrap/__init__.py +1 -0
- shrinkwrap/__main__.py +4 -0
- shrinkwrap/commands/__init__.py +0 -0
- shrinkwrap/commands/build.py +91 -0
- shrinkwrap/commands/buildall.py +180 -0
- shrinkwrap/commands/clean.py +161 -0
- shrinkwrap/commands/inspect.py +235 -0
- shrinkwrap/commands/process.py +106 -0
- shrinkwrap/commands/run.py +311 -0
- shrinkwrap/config/FVP_Base_RevC-2xAEMvA-base.yaml +98 -0
- shrinkwrap/config/FVP_Base_RevC-2xAEMvA-rme.yaml +42 -0
- shrinkwrap/config/arch/v8.0.yaml +22 -0
- shrinkwrap/config/arch/v8.1.yaml +26 -0
- shrinkwrap/config/arch/v8.2.yaml +28 -0
- shrinkwrap/config/arch/v8.3.yaml +25 -0
- shrinkwrap/config/arch/v8.4.yaml +26 -0
- shrinkwrap/config/arch/v8.5.yaml +29 -0
- shrinkwrap/config/arch/v8.6.yaml +28 -0
- shrinkwrap/config/arch/v8.7.yaml +24 -0
- shrinkwrap/config/arch/v8.8.yaml +31 -0
- shrinkwrap/config/arch/v8.9.yaml +32 -0
- shrinkwrap/config/arch/v9.0.yaml +29 -0
- shrinkwrap/config/arch/v9.1.yaml +25 -0
- shrinkwrap/config/arch/v9.2.yaml +29 -0
- shrinkwrap/config/arch/v9.3.yaml +23 -0
- shrinkwrap/config/arch/v9.4.yaml +21 -0
- shrinkwrap/config/arch/v9.5.yaml +20 -0
- shrinkwrap/config/bootwrapper.yaml +76 -0
- shrinkwrap/config/buildroot-cca.yaml +113 -0
- shrinkwrap/config/buildroot.yaml +54 -0
- shrinkwrap/config/cca-3world.yaml +215 -0
- shrinkwrap/config/cca-4world.yaml +57 -0
- shrinkwrap/config/cca-edk2.yaml +58 -0
- shrinkwrap/config/debug/rmm.yaml +15 -0
- shrinkwrap/config/debug/tfa.yaml +18 -0
- shrinkwrap/config/debug/tftf.yaml +17 -0
- shrinkwrap/config/dt-base.yaml +115 -0
- shrinkwrap/config/edk2-base.yaml +59 -0
- shrinkwrap/config/ffa-hafnium-optee.yaml +45 -0
- shrinkwrap/config/ffa-optee.yaml +30 -0
- shrinkwrap/config/ffa-tftf.yaml +26 -0
- shrinkwrap/config/hafnium-base.yaml +51 -0
- shrinkwrap/config/kvm-unit-tests.yaml +32 -0
- shrinkwrap/config/kvmtool-base.yaml +33 -0
- shrinkwrap/config/linux-base.yaml +80 -0
- shrinkwrap/config/ns-edk2-base.yaml +83 -0
- shrinkwrap/config/ns-edk2-optee.yaml +41 -0
- shrinkwrap/config/ns-edk2.yaml +49 -0
- shrinkwrap/config/ns-preload.yaml +98 -0
- shrinkwrap/config/optee-base.yaml +37 -0
- shrinkwrap/config/rfa-base.yaml +49 -0
- shrinkwrap/config/rfa.yaml +47 -0
- shrinkwrap/config/rmm-base.yaml +24 -0
- shrinkwrap/config/rust.yaml +31 -0
- shrinkwrap/config/test/cca.yaml +47 -0
- shrinkwrap/config/tfa-base.yaml +45 -0
- shrinkwrap/config/tfa-rme.yaml +36 -0
- shrinkwrap/config/tftf-base.yaml +32 -0
- shrinkwrap/shrinkwrap_main.py +133 -0
- shrinkwrap/utils/__init__.py +0 -0
- shrinkwrap/utils/clivars.py +16 -0
- shrinkwrap/utils/config.py +1166 -0
- shrinkwrap/utils/graph.py +263 -0
- shrinkwrap/utils/label.py +153 -0
- shrinkwrap/utils/logger.py +160 -0
- shrinkwrap/utils/process.py +230 -0
- shrinkwrap/utils/runtime.py +192 -0
- shrinkwrap/utils/ssh_agent.py +98 -0
- shrinkwrap/utils/tty.py +46 -0
- shrinkwrap/utils/vars.py +14 -0
- shrinkwrap/utils/workspace.py +59 -0
- shrinkwrap_tool-2026.2.1.dist-info/METADATA +63 -0
- shrinkwrap_tool-2026.2.1.dist-info/RECORD +77 -0
- shrinkwrap_tool-2026.2.1.dist-info/WHEEL +5 -0
- shrinkwrap_tool-2026.2.1.dist-info/entry_points.txt +2 -0
- shrinkwrap_tool-2026.2.1.dist-info/licenses/license.rst +41 -0
- shrinkwrap_tool-2026.2.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Copyright (c) 2022, Arm Limited.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import shrinkwrap.utils.config as config
|
|
6
|
+
import shrinkwrap.utils.vars as vars
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
cmd_name = os.path.splitext(os.path.basename(__file__))[0]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def add_parser(parser, formatter):
|
|
13
|
+
"""
|
|
14
|
+
Part of the command interface expected by shrinkwrap.py. Adds the
|
|
15
|
+
subcommand to the parser, along with all options and documentation.
|
|
16
|
+
Returns the subcommand name.
|
|
17
|
+
"""
|
|
18
|
+
cmdp = parser.add_parser(cmd_name,
|
|
19
|
+
formatter_class=formatter,
|
|
20
|
+
help="""Outputs to stdout the result of either merging down the
|
|
21
|
+
config layers, or resolving macros within the merged
|
|
22
|
+
config.""",
|
|
23
|
+
epilog="""Custom config store(s) can be defined at at
|
|
24
|
+
<SHRINKWRAP_CONFIG> as a colon-separated list of
|
|
25
|
+
directories. Shrinkwrap will always search its default
|
|
26
|
+
config store even if <SHRINKWRAP_CONFIG> is not
|
|
27
|
+
defined.""")
|
|
28
|
+
|
|
29
|
+
cmdp.add_argument('config',
|
|
30
|
+
metavar='config',
|
|
31
|
+
help="""Config to process. If the config exists relative to the
|
|
32
|
+
current directory that config is used. Else if the config
|
|
33
|
+
exists relative to the config store then it is used.""")
|
|
34
|
+
|
|
35
|
+
cmdp.add_argument('-a', '--action',
|
|
36
|
+
metavar='action', required=True,
|
|
37
|
+
choices=['merge', 'resolveb', 'resolver'],
|
|
38
|
+
help="""Action to take. Either "merge" (merge down the config
|
|
39
|
+
layers), "resolveb" (resolve build-time macros within the
|
|
40
|
+
merged config) or "resolver" (resolve run-time macros
|
|
41
|
+
within the build-time resolved config).""")
|
|
42
|
+
|
|
43
|
+
cmdp.add_argument('-o', '--overlay',
|
|
44
|
+
metavar='cfgfile', required=False, default=[],
|
|
45
|
+
action='append',
|
|
46
|
+
help="""Optional config file overlay to override run-time and
|
|
47
|
+
build-time settings. Only entries within the "build",
|
|
48
|
+
"buildex" and "run" sections are used. Can be specified
|
|
49
|
+
multiple times; left-most overlay is the first overlay
|
|
50
|
+
applied.""")
|
|
51
|
+
|
|
52
|
+
cmdp.add_argument('-b', '--btvar',
|
|
53
|
+
metavar='key=value', required=False, default=[],
|
|
54
|
+
action='append',
|
|
55
|
+
help="""Override value for a single build-time variable defined
|
|
56
|
+
by the config. Specify option multiple times for multiple
|
|
57
|
+
variables. Overrides for variables that have a default
|
|
58
|
+
specified by the config are optional. Only used if action
|
|
59
|
+
is "resolveb" or "resolver".""")
|
|
60
|
+
|
|
61
|
+
cmdp.add_argument('-r', '--rtvar',
|
|
62
|
+
metavar='key=value', required=False, default=[],
|
|
63
|
+
action='append',
|
|
64
|
+
help="""Override value for a single runtime variable defined by
|
|
65
|
+
the config. Specify option multiple times for multiple
|
|
66
|
+
variables. Overrides for variables that have a default
|
|
67
|
+
specified by the config are optional. Only used if action
|
|
68
|
+
is "resolver".""")
|
|
69
|
+
|
|
70
|
+
return cmd_name
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def dispatch(args):
|
|
74
|
+
"""
|
|
75
|
+
Part of the command interface expected by shrinkwrap.py. Called to
|
|
76
|
+
execute the subcommand, with the arguments the user passed on the
|
|
77
|
+
command line. The arguments comply with those requested in add_parser().
|
|
78
|
+
"""
|
|
79
|
+
overlays = []
|
|
80
|
+
for overlayname in args.overlay:
|
|
81
|
+
overlay = config.filename(overlayname)
|
|
82
|
+
overlay = config.load(overlay)
|
|
83
|
+
overlay = {
|
|
84
|
+
'build': overlay['build'],
|
|
85
|
+
'buildex': overlay['buildex'],
|
|
86
|
+
'run': overlay['run'],
|
|
87
|
+
}
|
|
88
|
+
overlays.append(overlay)
|
|
89
|
+
|
|
90
|
+
filename = config.filename(args.config)
|
|
91
|
+
merged = config.load(filename, overlays)
|
|
92
|
+
|
|
93
|
+
if args.action == 'merge':
|
|
94
|
+
print(config.dumps(merged))
|
|
95
|
+
else:
|
|
96
|
+
btvars = vars.parse(args.btvar, type='bt')
|
|
97
|
+
resolveb = config.resolveb(merged, btvars)
|
|
98
|
+
|
|
99
|
+
if args.action == 'resolveb':
|
|
100
|
+
print(config.dumps(resolveb))
|
|
101
|
+
else:
|
|
102
|
+
rtvars_dict = vars.parse(args.rtvar, type='rt')
|
|
103
|
+
resolver = config.resolver(resolveb, rtvars_dict)
|
|
104
|
+
|
|
105
|
+
if args.action == 'resolver':
|
|
106
|
+
print(config.dumps(resolver))
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# Copyright (c) 2022, Arm Limited.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
import tempfile
|
|
7
|
+
import shrinkwrap.utils.config as config
|
|
8
|
+
import shrinkwrap.utils.logger as logger
|
|
9
|
+
import shrinkwrap.utils.process as process
|
|
10
|
+
import shrinkwrap.utils.vars as vars
|
|
11
|
+
import shrinkwrap.utils.runtime as runtime
|
|
12
|
+
import shrinkwrap.utils.workspace as workspace
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
cmd_name = os.path.splitext(os.path.basename(__file__))[0]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def add_parser(parser, formatter):
|
|
19
|
+
"""
|
|
20
|
+
Part of the command interface expected by shrinkwrap.py. Adds the
|
|
21
|
+
subcommand to the parser, along with all options and documentation.
|
|
22
|
+
Returns the subcommand name.
|
|
23
|
+
"""
|
|
24
|
+
cmdp = parser.add_parser(cmd_name,
|
|
25
|
+
formatter_class=formatter,
|
|
26
|
+
help="""Boot and run the FVP for the specified config.""",
|
|
27
|
+
epilog="""FW is accessed from <SHRINKWRAP_PACKAGE>.
|
|
28
|
+
<SHRINKWRAP_PACKAGE> defaults to '~/.shrinkwrap/package',
|
|
29
|
+
but the user can override it by setting the environment
|
|
30
|
+
variable.""")
|
|
31
|
+
|
|
32
|
+
cmdp.add_argument('config',
|
|
33
|
+
metavar='config',
|
|
34
|
+
help="""Config to run. Must have been previously built into
|
|
35
|
+
<SHRINKWRAP_PACKAGE>.""")
|
|
36
|
+
|
|
37
|
+
cmdp.add_argument('-o', '--overlay',
|
|
38
|
+
metavar='cfgfile', required=False, default=[],
|
|
39
|
+
action='append',
|
|
40
|
+
help="""Optional config file overlay to override run-time
|
|
41
|
+
settings. Only entries within the "run" section are used.
|
|
42
|
+
This is in addition to any overlay passed at build-time.
|
|
43
|
+
Can be specified multiple times; left-most overlay is the
|
|
44
|
+
first overlay applied.""")
|
|
45
|
+
|
|
46
|
+
cmdp.add_argument('-r', '--rtvar',
|
|
47
|
+
metavar='key=value', required=False, default=[],
|
|
48
|
+
action='append',
|
|
49
|
+
help="""Override value for a single runtime variable defined by
|
|
50
|
+
the config. Specify option multiple times for multiple
|
|
51
|
+
variables. Overrides for variables that have a default
|
|
52
|
+
specified by the config are optional.""")
|
|
53
|
+
|
|
54
|
+
cmdp.add_argument('-n', '--dry-run',
|
|
55
|
+
required=False, default=False, action='store_true',
|
|
56
|
+
help="""If specified, none of the run commands will be
|
|
57
|
+
executed. Instead the set of commands that would have been
|
|
58
|
+
executed are output to stdout.""")
|
|
59
|
+
|
|
60
|
+
cmdp.add_argument('-c', '--no-color',
|
|
61
|
+
required=False, default=False, action='store_true',
|
|
62
|
+
help="""If specified, logs will not be colorized.""")
|
|
63
|
+
|
|
64
|
+
cmdp.add_argument('-t', '--timeout',
|
|
65
|
+
required=False, default=None, type=int,
|
|
66
|
+
help="""Number of days after which to automatically shutdown the
|
|
67
|
+
container, if using a container runtime. Defaults to 1 day.
|
|
68
|
+
""")
|
|
69
|
+
|
|
70
|
+
return cmd_name
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def dispatch(args):
|
|
74
|
+
"""
|
|
75
|
+
Part of the command interface expected by shrinkwrap.py. Called to
|
|
76
|
+
execute the subcommand, with the arguments the user passed on the
|
|
77
|
+
command line. The arguments comply with those requested in add_parser().
|
|
78
|
+
"""
|
|
79
|
+
overlays = []
|
|
80
|
+
for overlayname in args.overlay:
|
|
81
|
+
overlay = config.filename(overlayname)
|
|
82
|
+
overlay = config.load(overlay)
|
|
83
|
+
overlay = {'run': overlay['run']}
|
|
84
|
+
overlays.append(overlay)
|
|
85
|
+
|
|
86
|
+
filename = os.path.join(workspace.package, args.config)
|
|
87
|
+
resolveb = config.load(filename, overlays)
|
|
88
|
+
rtvars_dict = vars.parse(args.rtvar, type='rt')
|
|
89
|
+
resolver = config.resolver(resolveb, rtvars_dict)
|
|
90
|
+
cmds = _pretty_print_sh(resolver['run'])
|
|
91
|
+
|
|
92
|
+
# If dry run, just output the FVP command that we would have run. We
|
|
93
|
+
# don't include the netcat magic to access the fvp terminals.
|
|
94
|
+
if args.dry_run:
|
|
95
|
+
print(cmds)
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
# The FVP and any associated uart terminals are output to our terminal
|
|
99
|
+
# with a tag to indicate where each line originated. Figure out how big
|
|
100
|
+
# that tag field needs to be so that everything remains aligned.
|
|
101
|
+
max_name_field = 10
|
|
102
|
+
name_field = 0
|
|
103
|
+
terminals = resolver['run']['terminals']
|
|
104
|
+
terminals = dict(sorted(terminals.items()))
|
|
105
|
+
for t in terminals.values():
|
|
106
|
+
t['port'] = None
|
|
107
|
+
t['strip'] = False
|
|
108
|
+
if len(t['friendly']) > name_field:
|
|
109
|
+
name_field = min(len(t['friendly']), max_name_field)
|
|
110
|
+
|
|
111
|
+
log = logger.Logger(name_field)
|
|
112
|
+
|
|
113
|
+
def _strip_telnet_header(pm, proc, data, streamid):
|
|
114
|
+
"""
|
|
115
|
+
For any stdinout terminals (which use telnet), strip the first
|
|
116
|
+
few lines of output, which is output by telnet. This is
|
|
117
|
+
confusing for users since telnet is an implementation detail.
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
match = "Escape character is '^]'."
|
|
121
|
+
pdata = proc.data
|
|
122
|
+
|
|
123
|
+
for line in logger.splitlines(data):
|
|
124
|
+
if len(pdata) >= 2 and terminals[pdata[1]]['strip']:
|
|
125
|
+
if line.find(match) >= 0:
|
|
126
|
+
terminals[pdata[1]]['strip'] = False
|
|
127
|
+
if all([not t['strip'] \
|
|
128
|
+
for t in terminals.values()]):
|
|
129
|
+
pm.set_handler(log.log)
|
|
130
|
+
else:
|
|
131
|
+
log.log(pm, proc, line, streamid)
|
|
132
|
+
|
|
133
|
+
def _colorize(global_no_color, terminal):
|
|
134
|
+
if global_no_color:
|
|
135
|
+
return False
|
|
136
|
+
elif 'no_color' in terminal:
|
|
137
|
+
return not terminal['no_color']
|
|
138
|
+
else:
|
|
139
|
+
return True
|
|
140
|
+
|
|
141
|
+
def _escape(terminal):
|
|
142
|
+
if 'no_escapes' in terminal:
|
|
143
|
+
return terminal['no_escapes']
|
|
144
|
+
else:
|
|
145
|
+
return False
|
|
146
|
+
|
|
147
|
+
def _logfile(terminal):
|
|
148
|
+
if terminal['type'] in ['stdinout', 'stdout']:
|
|
149
|
+
logfile = terminal.get('logfile')
|
|
150
|
+
return logfile if logfile else None
|
|
151
|
+
else:
|
|
152
|
+
return None
|
|
153
|
+
|
|
154
|
+
def _find_term_ports(pm, proc, data, streamid):
|
|
155
|
+
"""
|
|
156
|
+
Initial handler function called by ProcessManager. When the fvp
|
|
157
|
+
starts, we must parse the output to determine the port numbers
|
|
158
|
+
to connect to with netcat to access the fvp uart terminals. We
|
|
159
|
+
look for all the ports, start the netcat instances, add them to
|
|
160
|
+
the process manager and finally switch the handler to the
|
|
161
|
+
standard logger.
|
|
162
|
+
"""
|
|
163
|
+
# First, forward to the standard log handler.
|
|
164
|
+
log.log(pm, proc, data, streamid)
|
|
165
|
+
|
|
166
|
+
found_all_ports = True
|
|
167
|
+
|
|
168
|
+
# Iterate over the terminals dict from the config applying the
|
|
169
|
+
# supplied regexes to try to find the ports for all the
|
|
170
|
+
# terminals.
|
|
171
|
+
for t in terminals.values():
|
|
172
|
+
if t['port'] is None:
|
|
173
|
+
res = re.search(t['port_regex'], data)
|
|
174
|
+
if res:
|
|
175
|
+
t['port'] = res.group(1)
|
|
176
|
+
else:
|
|
177
|
+
found_all_ports = False
|
|
178
|
+
|
|
179
|
+
# Once all ports have been found, launch the netcat processes
|
|
180
|
+
# and change the handler so we never get called again.
|
|
181
|
+
if found_all_ports:
|
|
182
|
+
wait = False
|
|
183
|
+
strip = False
|
|
184
|
+
for k, t in terminals.items():
|
|
185
|
+
name = t['friendly']
|
|
186
|
+
type = t['type']
|
|
187
|
+
port = t["port"]
|
|
188
|
+
colorize = _colorize(args.no_color, t)
|
|
189
|
+
escape = _escape(t)
|
|
190
|
+
|
|
191
|
+
if type in ['stdout']:
|
|
192
|
+
cmd = f'nc localhost {port}'
|
|
193
|
+
pm.add(process.Process(cmd,
|
|
194
|
+
False,
|
|
195
|
+
(log.alloc_data(name, colorize, escape, _logfile(t)), k),
|
|
196
|
+
False))
|
|
197
|
+
if type in ['stdinout']:
|
|
198
|
+
cmd = f'telnet localhost {port}'
|
|
199
|
+
pm.add(process.Process(cmd,
|
|
200
|
+
True,
|
|
201
|
+
(log.alloc_data(name, colorize, escape, _logfile(t)), k),
|
|
202
|
+
False))
|
|
203
|
+
t['strip'] = True
|
|
204
|
+
strip = True
|
|
205
|
+
if type in ['xterm']:
|
|
206
|
+
# Nothing to do. The FVP will start this
|
|
207
|
+
# automatically.
|
|
208
|
+
pass
|
|
209
|
+
if type in ['telnet']:
|
|
210
|
+
wait = True
|
|
211
|
+
ip = runtime.get().ip_address()
|
|
212
|
+
print(f'To start {name} terminal, run:')
|
|
213
|
+
print(f' telnet {ip} {port}')
|
|
214
|
+
if wait:
|
|
215
|
+
# Temporarily restore sys.stdin for input().
|
|
216
|
+
pm._stdin_deactivate()
|
|
217
|
+
print()
|
|
218
|
+
input("Press Enter to continue...")
|
|
219
|
+
pm._stdin_activate()
|
|
220
|
+
|
|
221
|
+
if strip:
|
|
222
|
+
pm.set_handler(_strip_telnet_header)
|
|
223
|
+
else:
|
|
224
|
+
pm.set_handler(log.log)
|
|
225
|
+
|
|
226
|
+
def _complete(pm, proc, retcode):
|
|
227
|
+
log.free_data(proc.data[0])
|
|
228
|
+
|
|
229
|
+
# If the FVP exits with non-zero exit code, we propagate that
|
|
230
|
+
# error so that shrinkwrap also exits with non-zero exit code.
|
|
231
|
+
if retcode not in [0, None] and proc.run_to_end:
|
|
232
|
+
raise Exception(f'FVP failed with {retcode}')
|
|
233
|
+
|
|
234
|
+
# Run under a runtime environment, which may just run commands natively
|
|
235
|
+
# on the host or may execute commands in a container, depending on what
|
|
236
|
+
# the user specified.
|
|
237
|
+
with runtime.Runtime(name=args.runtime, image=config.get_image([resolveb], args),
|
|
238
|
+
ssh_agent_keys=args.ssh_agent_keys,
|
|
239
|
+
timeout=args.timeout) as rt:
|
|
240
|
+
for rtvar in resolver['run']['rtvars'].values():
|
|
241
|
+
if rtvar['type'] == 'path':
|
|
242
|
+
rt.add_volume(rtvar['value'])
|
|
243
|
+
for t in terminals.values():
|
|
244
|
+
logfile = _logfile(t)
|
|
245
|
+
if logfile:
|
|
246
|
+
logdir = os.path.abspath(os.path.dirname(logfile))
|
|
247
|
+
os.makedirs(logdir, exist_ok=True)
|
|
248
|
+
rt.add_volume(logdir)
|
|
249
|
+
rt.add_volume(workspace.package)
|
|
250
|
+
rt.start()
|
|
251
|
+
|
|
252
|
+
# Write the script out to a file in a temp directory, and wrap
|
|
253
|
+
# the directory name and command to run in a Process. Add the
|
|
254
|
+
# Process to the ProcessManager. On completion, the caller must
|
|
255
|
+
# destroy the directory.
|
|
256
|
+
with tempfile.TemporaryDirectory(dir=workspace.package) as tmpdir:
|
|
257
|
+
tmpfilename = os.path.join(tmpdir, 'script.sh')
|
|
258
|
+
with open(tmpfilename, 'w') as tmpfile:
|
|
259
|
+
tmpfile.write(cmds)
|
|
260
|
+
|
|
261
|
+
# Create a process manager with 1 process; the fvp. As
|
|
262
|
+
# it boots _find_term_ports() will add the netcat
|
|
263
|
+
# processes in parallel. It will exit once all processes
|
|
264
|
+
# have terminated. The fvp will terminate when its told
|
|
265
|
+
# to `poweroff` and netcat will terminate when it sees
|
|
266
|
+
# the fvp has gone.
|
|
267
|
+
pm = process.ProcessManager(_find_term_ports, _complete)
|
|
268
|
+
pm.add(process.Process(f'bash {tmpfilename}',
|
|
269
|
+
False,
|
|
270
|
+
(log.alloc_data('fvp', not args.no_color),),
|
|
271
|
+
True))
|
|
272
|
+
|
|
273
|
+
rt_ip = runtime.get().ip_address()
|
|
274
|
+
|
|
275
|
+
print()
|
|
276
|
+
print("Press '^]' to quit shrinkwrap.")
|
|
277
|
+
print("All other keys are passed through.")
|
|
278
|
+
print(f"Environment ip address: {rt_ip}.")
|
|
279
|
+
print()
|
|
280
|
+
|
|
281
|
+
pm.run(forward_stdin=True)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _pretty_print_sh(run):
|
|
285
|
+
prerun = run['prerun']
|
|
286
|
+
run = run['run']
|
|
287
|
+
|
|
288
|
+
# This is a hack to improve the way the FVP arguments look. It tends to
|
|
289
|
+
# be huge so attempt to make it more readable by putting each option on
|
|
290
|
+
# a separate line and sorting alphabetically. Only likely to work for
|
|
291
|
+
# FVP so try to infer its definitely the FVP.
|
|
292
|
+
if len(run) == 1:
|
|
293
|
+
prog = run[0].split(' ')[0].lower()
|
|
294
|
+
if prog.find('isim') >= 0 or prog.find('fvp') >= 0:
|
|
295
|
+
parts = run[0].split(' -')
|
|
296
|
+
prog = parts[0]
|
|
297
|
+
args = sorted(parts[1:])
|
|
298
|
+
run = [' \\\n -'.join([prog] + args)]
|
|
299
|
+
|
|
300
|
+
pre = config.script_preamble(False)
|
|
301
|
+
script = config.Script('run model', preamble=pre)
|
|
302
|
+
|
|
303
|
+
if len(prerun) > 0:
|
|
304
|
+
script.append('# Execute prerun commands.')
|
|
305
|
+
script.append('\n'.join(prerun))
|
|
306
|
+
script.append()
|
|
307
|
+
|
|
308
|
+
script.append('# Run the model.')
|
|
309
|
+
script.append('\n'.join(run))
|
|
310
|
+
|
|
311
|
+
return script.commands()
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Copyright (c) 2022, Arm Limited.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
%YAML 1.2
|
|
5
|
+
---
|
|
6
|
+
description: >-
|
|
7
|
+
Arm Architecture Envelope Model FVP configured with 8 CPUs across 2 clusters
|
|
8
|
+
(2x4) and 4GB DRAM. By default doesn't explicitly enable any architecture
|
|
9
|
+
features. Apply the architecture overlays at arch/v*.*.yaml to configure the
|
|
10
|
+
FVP for a sepcific architecture revision.
|
|
11
|
+
|
|
12
|
+
run:
|
|
13
|
+
name: FVP_Base_RevC-2xAEMvA
|
|
14
|
+
|
|
15
|
+
rtvars:
|
|
16
|
+
LOCAL_NET_PORT:
|
|
17
|
+
type: string
|
|
18
|
+
value: 8022
|
|
19
|
+
|
|
20
|
+
params:
|
|
21
|
+
# Basic dimensions for RAM and CPU.
|
|
22
|
+
-C bp.dram_size: 4
|
|
23
|
+
-C cluster0.NUM_CORES: 4
|
|
24
|
+
-C cluster1.NUM_CORES: 4
|
|
25
|
+
-C cluster0.PA_SIZE: 48
|
|
26
|
+
-C cluster1.PA_SIZE: 48
|
|
27
|
+
|
|
28
|
+
# Misc FVP controls.
|
|
29
|
+
--stat: null
|
|
30
|
+
-C bp.vis.disable_visualisation: 1
|
|
31
|
+
-C bp.refcounter.non_arch_start_at_default: 1 # Firmware is expected to enable the timer at boot time. However, turning this parameter on is a model-specific way of enabling the counter module out of reset.
|
|
32
|
+
-C bp.secure_memory: 1 # enable security checking by TZC-400
|
|
33
|
+
-C bp.ve_sysregs.exit_on_shutdown: 1 # SYS_CFG_SHUTDOWN exits simulation
|
|
34
|
+
-C pctl.startup: 0.0.0.0 # Comma-separated list of cores (wildcards allowed) to be powered up at startup or system reset
|
|
35
|
+
-C cluster0.clear_reg_top_eret: 2 # Behaviour of the upper 32-bits of the Xn registers when changing between AArch32 state and AArch64 state. 2: upper 32-bits set to 0 for a random selection of accessible registers.
|
|
36
|
+
-C cluster1.clear_reg_top_eret: 2
|
|
37
|
+
|
|
38
|
+
# Networking. By default use user-space networking, mapping port 22 in the
|
|
39
|
+
# FVP to a user-specified port on the host (see rtvar:LOCAL_NET_PORT). This
|
|
40
|
+
# enables ssh.
|
|
41
|
+
-C bp.smsc_91c111.enabled: 1
|
|
42
|
+
-C bp.hostbridge.userNetworking: 1
|
|
43
|
+
-C bp.hostbridge.userNetPorts: ${rtvar:LOCAL_NET_PORT}=22
|
|
44
|
+
|
|
45
|
+
# FVP Performance tweaks.
|
|
46
|
+
-C cache_state_modelled: 0 # Disable d-cache and i-cache state for all components
|
|
47
|
+
-C cluster0.stage12_tlb_size: 1024 # Increase TLB size from default of 128
|
|
48
|
+
-C cluster1.stage12_tlb_size: 1024
|
|
49
|
+
-C cluster0.check_memory_attributes: 0 # Disable checking that SW-set memory attributes conform to architecturally required constraints
|
|
50
|
+
-C cluster1.check_memory_attributes: 0
|
|
51
|
+
|
|
52
|
+
# GIC config options.
|
|
53
|
+
-C cluster0.gicv3.cpuintf-mmap-access-level: 2 # Allowed values are: 0-mmap access is supported for GICC,GICH,GICV registers. 1-mmap access is supported only for GICV registers. 2-mmap access is not supported.
|
|
54
|
+
-C cluster1.gicv3.cpuintf-mmap-access-level: 2
|
|
55
|
+
-C cluster0.gicv3.without-DS-support: 1 # GICv3 CPU interfaces do not support disabling security in the distributor
|
|
56
|
+
-C cluster1.gicv3.without-DS-support: 1
|
|
57
|
+
-C cluster0.gicv4.mask-virtual-interrupt: 1 # If true, virtual interrupts can be masked from being reported to virtual CPU interface by setting ICH_HCR_EL2.DVIM 1. No control otherwise.
|
|
58
|
+
-C cluster1.gicv4.mask-virtual-interrupt: 1
|
|
59
|
+
|
|
60
|
+
# These SMMU registers are configuring the arch model with a personality. Features to implement/expose. The model defaults plus a few useful features.
|
|
61
|
+
# SMMUv3.2
|
|
62
|
+
-C pci.pci_smmuv3.mmu.SMMU_AIDR: 2
|
|
63
|
+
# Enable ASID16, for sharing process address spaces with devices
|
|
64
|
+
-C pci.pci_smmuv3.mmu.SMMU_IDR0: 0x080FF6BF
|
|
65
|
+
-C pci.pci_smmuv3.mmu.SMMU_IDR1: 0x0CE73D20
|
|
66
|
+
# Enable FWB, Small TT, Range invalidation, and BBM level 2.
|
|
67
|
+
-C pci.pci_smmuv3.mmu.SMMU_IDR3: 0x1714
|
|
68
|
+
# Enable 16kB pages, VAX. Bit[3] is res0.
|
|
69
|
+
-C pci.pci_smmuv3.mmu.SMMU_IDR5: 0xFFFF0475
|
|
70
|
+
# Enable secure side, SEL2, 2-bit SID
|
|
71
|
+
-C pci.pci_smmuv3.mmu.SMMU_S_IDR1: 0xA0000002
|
|
72
|
+
-C pci.pci_smmuv3.mmu.SMMU_S_IDR2: 0
|
|
73
|
+
-C pci.pci_smmuv3.mmu.SMMU_S_IDR3: 0
|
|
74
|
+
|
|
75
|
+
# Enable virtio-rng. If Linux/DT is correctly configured, it can use this to
|
|
76
|
+
# speed up RNG init.
|
|
77
|
+
-C bp.virtio_rng.enabled: 1
|
|
78
|
+
|
|
79
|
+
terminals:
|
|
80
|
+
bp.terminal_0:
|
|
81
|
+
friendly: term0
|
|
82
|
+
port_regex: 'terminal_0: Listening for serial connection on port (\d+)'
|
|
83
|
+
type: stdout
|
|
84
|
+
|
|
85
|
+
bp.terminal_1:
|
|
86
|
+
friendly: term1
|
|
87
|
+
port_regex: 'terminal_1: Listening for serial connection on port (\d+)'
|
|
88
|
+
type: stdout
|
|
89
|
+
|
|
90
|
+
bp.terminal_2:
|
|
91
|
+
friendly: term2
|
|
92
|
+
port_regex: 'terminal_2: Listening for serial connection on port (\d+)'
|
|
93
|
+
type: stdout
|
|
94
|
+
|
|
95
|
+
bp.terminal_3:
|
|
96
|
+
friendly: term3
|
|
97
|
+
port_regex: 'terminal_3: Listening for serial connection on port (\d+)'
|
|
98
|
+
type: stdout
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Copyright (c) 2024, Arm Limited.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
%YAML 1.2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
layers:
|
|
8
|
+
- FVP_Base_RevC-2xAEMvA-base.yaml
|
|
9
|
+
- arch/v9.2.yaml
|
|
10
|
+
|
|
11
|
+
run:
|
|
12
|
+
params:
|
|
13
|
+
-C cluster0.rme_support_level: 2
|
|
14
|
+
-C cluster1.rme_support_level: 2
|
|
15
|
+
-C bp.secure_memory: 0 # Disable security checking by TZC-400
|
|
16
|
+
-C bp.has_rme: 1 # Enable Realm Management Extension(RME) support
|
|
17
|
+
# Only Root access to Trusted ROM and SRAM.
|
|
18
|
+
# SECURE/ROOT access only for below peripherals:
|
|
19
|
+
# -Trusted DRAM
|
|
20
|
+
# -REFCLK CNTControl (Generic Timer)
|
|
21
|
+
# -Trusted Watchdog SP805, Trustzone address space controller
|
|
22
|
+
# -AP_REFCLK CNTBase0 (Generic Timer)
|
|
23
|
+
# -Trusted RNG, Non-Volatile Counter and Root-Key Storage
|
|
24
|
+
# -Flash0, Flash1
|
|
25
|
+
# -uart0, uart1, uart2, uart3
|
|
26
|
+
|
|
27
|
+
# Suppress "WARNING: MPAM_NS is deprecated when RME is in use. Should use MPAM_SP"
|
|
28
|
+
-C cluster0.output_attributes: ExtendedID[62:55]=MPAM_PMG,ExtendedID[54:39]=MPAM_PARTID,ExtendedID[38:37]=MPAM_SP
|
|
29
|
+
-C cluster1.output_attributes: ExtendedID[62:55]=MPAM_PMG,ExtendedID[54:39]=MPAM_PARTID,ExtendedID[38:37]=MPAM_SP
|
|
30
|
+
|
|
31
|
+
# CCA-specific SMMU settings.
|
|
32
|
+
-C pci.pci_smmuv3.mmu.SMMU_ROOT_IDR0: 3
|
|
33
|
+
-C pci.pci_smmuv3.mmu.SMMU_ROOT_IIDR: 0x43B
|
|
34
|
+
-C pci.pci_smmuv3.mmu.root_register_page_offset: 0x20000
|
|
35
|
+
|
|
36
|
+
# Enable FEAT_CSV2_2, which is optional. But TFA 2.10 force-enables it when
|
|
37
|
+
# ENABLE_RME=1 so if it's not there we see an exception.
|
|
38
|
+
-C cluster0.restriction_on_speculative_execution: 2
|
|
39
|
+
-C cluster1.restriction_on_speculative_execution: 2
|
|
40
|
+
-C cluster0.restriction_on_speculative_execution_aarch32: 2
|
|
41
|
+
-C cluster1.restriction_on_speculative_execution_aarch32: 2
|
|
42
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Copyright (c) 2022, Arm Limited.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
%YAML 1.2
|
|
5
|
+
---
|
|
6
|
+
description: >-
|
|
7
|
+
Implements all mandatory requirements and features as well as a sensible
|
|
8
|
+
selection of optional ones for the Armv8.0 architecture extension within the
|
|
9
|
+
Base_RevC-2xAEMvA FVP. Intended for use as an overlay to
|
|
10
|
+
FVP_Base_RevC-2xAEMvA-base.yaml.
|
|
11
|
+
|
|
12
|
+
build:
|
|
13
|
+
tfa:
|
|
14
|
+
params:
|
|
15
|
+
ARM_ARCH_MAJOR: 8
|
|
16
|
+
ARM_ARCH_MINOR: 0
|
|
17
|
+
BRANCH_PROTECTION: 0
|
|
18
|
+
|
|
19
|
+
run:
|
|
20
|
+
params:
|
|
21
|
+
-C cluster0.has_16k_granule: 1 # Implement the 16k LPAE translation granule.
|
|
22
|
+
-C cluster1.has_16k_granule: 1
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (c) 2022, Arm Limited.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
%YAML 1.2
|
|
5
|
+
---
|
|
6
|
+
description: >-
|
|
7
|
+
Implements all mandatory requirements and features as well as a sensible
|
|
8
|
+
selection of optional ones for the Armv8.1 architecture extension within the
|
|
9
|
+
Base_RevC-2xAEMvA FVP. Intended for use as an overlay to
|
|
10
|
+
FVP_Base_RevC-2xAEMvA-base.yaml.
|
|
11
|
+
|
|
12
|
+
layers:
|
|
13
|
+
- arch/v8.0.yaml
|
|
14
|
+
|
|
15
|
+
build:
|
|
16
|
+
tfa:
|
|
17
|
+
params:
|
|
18
|
+
ARM_ARCH_MAJOR: 8
|
|
19
|
+
ARM_ARCH_MINOR: 1
|
|
20
|
+
|
|
21
|
+
run:
|
|
22
|
+
params:
|
|
23
|
+
-C cluster0.has_arm_v8-1: 1
|
|
24
|
+
-C cluster1.has_arm_v8-1: 1
|
|
25
|
+
-C cluster0.has_large_system_ext: 1 # Implement the ARMv8 Large System Extensions (FEAT_LSE).
|
|
26
|
+
-C cluster1.has_large_system_ext: 1
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright (c) 2022, Arm Limited.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
%YAML 1.2
|
|
5
|
+
---
|
|
6
|
+
description: >-
|
|
7
|
+
Implements all mandatory requirements and features as well as a sensible
|
|
8
|
+
selection of optional ones for the Armv8.2 architecture extension within the
|
|
9
|
+
Base_RevC-2xAEMvA FVP. Intended for use as an overlay to
|
|
10
|
+
FVP_Base_RevC-2xAEMvA-base.yaml.
|
|
11
|
+
|
|
12
|
+
layers:
|
|
13
|
+
- arch/v8.1.yaml
|
|
14
|
+
|
|
15
|
+
build:
|
|
16
|
+
tfa:
|
|
17
|
+
params:
|
|
18
|
+
ARM_ARCH_MAJOR: 8
|
|
19
|
+
ARM_ARCH_MINOR: 2
|
|
20
|
+
|
|
21
|
+
run:
|
|
22
|
+
params:
|
|
23
|
+
-C cluster0.has_arm_v8-2: 1
|
|
24
|
+
-C cluster1.has_arm_v8-2: 1
|
|
25
|
+
-C cluster0.has_large_va: 1 # Implement support for the extended 52-bit virtual addresses from ARMv8.2 (FEAT_LVA). 2:feature is implemented.
|
|
26
|
+
-C cluster1.has_large_va: 1
|
|
27
|
+
-C cluster0.has_sve: 1 # Whether SVE is implemented (FEAT_SVE).
|
|
28
|
+
-C cluster1.has_sve: 1
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Copyright (c) 2022, Arm Limited.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
%YAML 1.2
|
|
5
|
+
---
|
|
6
|
+
description: >-
|
|
7
|
+
Implements all mandatory requirements and features as well as a sensible
|
|
8
|
+
selection of optional ones for the Armv8.3 architecture extension within the
|
|
9
|
+
Base_RevC-2xAEMvA FVP. Intended for use as an overlay to
|
|
10
|
+
FVP_Base_RevC-2xAEMvA-base.yaml.
|
|
11
|
+
|
|
12
|
+
layers:
|
|
13
|
+
- arch/v8.2.yaml
|
|
14
|
+
|
|
15
|
+
build:
|
|
16
|
+
tfa:
|
|
17
|
+
params:
|
|
18
|
+
ARM_ARCH_MAJOR: 8
|
|
19
|
+
ARM_ARCH_MINOR: 3
|
|
20
|
+
BRANCH_PROTECTION: 2
|
|
21
|
+
|
|
22
|
+
run:
|
|
23
|
+
params:
|
|
24
|
+
-C cluster0.has_arm_v8-3: 1
|
|
25
|
+
-C cluster1.has_arm_v8-3: 1
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Copyright (c) 2022, Arm Limited.
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
%YAML 1.2
|
|
5
|
+
---
|
|
6
|
+
description: >-
|
|
7
|
+
Implements all mandatory requirements and features as well as a sensible
|
|
8
|
+
selection of optional ones for the Armv8.4 architecture extension within the
|
|
9
|
+
Base_RevC-2xAEMvA FVP. Intended for use as an overlay to
|
|
10
|
+
FVP_Base_RevC-2xAEMvA-base.yaml.
|
|
11
|
+
|
|
12
|
+
layers:
|
|
13
|
+
- arch/v8.3.yaml
|
|
14
|
+
|
|
15
|
+
build:
|
|
16
|
+
tfa:
|
|
17
|
+
params:
|
|
18
|
+
ARM_ARCH_MAJOR: 8
|
|
19
|
+
ARM_ARCH_MINOR: 4
|
|
20
|
+
|
|
21
|
+
run:
|
|
22
|
+
params:
|
|
23
|
+
-C cluster0.has_arm_v8-4: 1
|
|
24
|
+
-C cluster1.has_arm_v8-4: 1
|
|
25
|
+
-C cluster0.has_amu: 1 # Implement activity monitor functionality from ARMv8.4 (FEAT_AMUv1). 1:feature is implemented if ARMv8.4 is enabled.
|
|
26
|
+
-C cluster1.has_amu: 1
|