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.
Files changed (77) hide show
  1. shrinkwrap/__init__.py +1 -0
  2. shrinkwrap/__main__.py +4 -0
  3. shrinkwrap/commands/__init__.py +0 -0
  4. shrinkwrap/commands/build.py +91 -0
  5. shrinkwrap/commands/buildall.py +180 -0
  6. shrinkwrap/commands/clean.py +161 -0
  7. shrinkwrap/commands/inspect.py +235 -0
  8. shrinkwrap/commands/process.py +106 -0
  9. shrinkwrap/commands/run.py +311 -0
  10. shrinkwrap/config/FVP_Base_RevC-2xAEMvA-base.yaml +98 -0
  11. shrinkwrap/config/FVP_Base_RevC-2xAEMvA-rme.yaml +42 -0
  12. shrinkwrap/config/arch/v8.0.yaml +22 -0
  13. shrinkwrap/config/arch/v8.1.yaml +26 -0
  14. shrinkwrap/config/arch/v8.2.yaml +28 -0
  15. shrinkwrap/config/arch/v8.3.yaml +25 -0
  16. shrinkwrap/config/arch/v8.4.yaml +26 -0
  17. shrinkwrap/config/arch/v8.5.yaml +29 -0
  18. shrinkwrap/config/arch/v8.6.yaml +28 -0
  19. shrinkwrap/config/arch/v8.7.yaml +24 -0
  20. shrinkwrap/config/arch/v8.8.yaml +31 -0
  21. shrinkwrap/config/arch/v8.9.yaml +32 -0
  22. shrinkwrap/config/arch/v9.0.yaml +29 -0
  23. shrinkwrap/config/arch/v9.1.yaml +25 -0
  24. shrinkwrap/config/arch/v9.2.yaml +29 -0
  25. shrinkwrap/config/arch/v9.3.yaml +23 -0
  26. shrinkwrap/config/arch/v9.4.yaml +21 -0
  27. shrinkwrap/config/arch/v9.5.yaml +20 -0
  28. shrinkwrap/config/bootwrapper.yaml +76 -0
  29. shrinkwrap/config/buildroot-cca.yaml +113 -0
  30. shrinkwrap/config/buildroot.yaml +54 -0
  31. shrinkwrap/config/cca-3world.yaml +215 -0
  32. shrinkwrap/config/cca-4world.yaml +57 -0
  33. shrinkwrap/config/cca-edk2.yaml +58 -0
  34. shrinkwrap/config/debug/rmm.yaml +15 -0
  35. shrinkwrap/config/debug/tfa.yaml +18 -0
  36. shrinkwrap/config/debug/tftf.yaml +17 -0
  37. shrinkwrap/config/dt-base.yaml +115 -0
  38. shrinkwrap/config/edk2-base.yaml +59 -0
  39. shrinkwrap/config/ffa-hafnium-optee.yaml +45 -0
  40. shrinkwrap/config/ffa-optee.yaml +30 -0
  41. shrinkwrap/config/ffa-tftf.yaml +26 -0
  42. shrinkwrap/config/hafnium-base.yaml +51 -0
  43. shrinkwrap/config/kvm-unit-tests.yaml +32 -0
  44. shrinkwrap/config/kvmtool-base.yaml +33 -0
  45. shrinkwrap/config/linux-base.yaml +80 -0
  46. shrinkwrap/config/ns-edk2-base.yaml +83 -0
  47. shrinkwrap/config/ns-edk2-optee.yaml +41 -0
  48. shrinkwrap/config/ns-edk2.yaml +49 -0
  49. shrinkwrap/config/ns-preload.yaml +98 -0
  50. shrinkwrap/config/optee-base.yaml +37 -0
  51. shrinkwrap/config/rfa-base.yaml +49 -0
  52. shrinkwrap/config/rfa.yaml +47 -0
  53. shrinkwrap/config/rmm-base.yaml +24 -0
  54. shrinkwrap/config/rust.yaml +31 -0
  55. shrinkwrap/config/test/cca.yaml +47 -0
  56. shrinkwrap/config/tfa-base.yaml +45 -0
  57. shrinkwrap/config/tfa-rme.yaml +36 -0
  58. shrinkwrap/config/tftf-base.yaml +32 -0
  59. shrinkwrap/shrinkwrap_main.py +133 -0
  60. shrinkwrap/utils/__init__.py +0 -0
  61. shrinkwrap/utils/clivars.py +16 -0
  62. shrinkwrap/utils/config.py +1166 -0
  63. shrinkwrap/utils/graph.py +263 -0
  64. shrinkwrap/utils/label.py +153 -0
  65. shrinkwrap/utils/logger.py +160 -0
  66. shrinkwrap/utils/process.py +230 -0
  67. shrinkwrap/utils/runtime.py +192 -0
  68. shrinkwrap/utils/ssh_agent.py +98 -0
  69. shrinkwrap/utils/tty.py +46 -0
  70. shrinkwrap/utils/vars.py +14 -0
  71. shrinkwrap/utils/workspace.py +59 -0
  72. shrinkwrap_tool-2026.2.1.dist-info/METADATA +63 -0
  73. shrinkwrap_tool-2026.2.1.dist-info/RECORD +77 -0
  74. shrinkwrap_tool-2026.2.1.dist-info/WHEEL +5 -0
  75. shrinkwrap_tool-2026.2.1.dist-info/entry_points.txt +2 -0
  76. shrinkwrap_tool-2026.2.1.dist-info/licenses/license.rst +41 -0
  77. shrinkwrap_tool-2026.2.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,47 @@
1
+ # Copyright (c) 2025, Arm Limited.
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ %YAML 1.2
5
+ ---
6
+ description: >-
7
+ Add an initscript to buildroot to automatically execute tests.
8
+ The test launches a guest and checks that it is running in a Realm.
9
+
10
+ build:
11
+ buildroot:
12
+ prebuild:
13
+ - mkdir -p ${param:builddir}/overlay/etc/init.d
14
+ - |
15
+ echo -e "#!/bin/sh
16
+ case \$$1 in
17
+ start|stop|restart|reload)
18
+ if [ -e /dev/kvm ]; then
19
+ # Host
20
+ # On failure, exit this script and wait for the test timeout
21
+ gen-run-vmm.sh --kvmtool || exit 1
22
+ else
23
+ # Guest
24
+
25
+ # TODO: When buildroot is built on an arm64 system,
26
+ # cca-workload-attestation is missing and as a result this
27
+ # exits immediately and does not shut down the guest. I
28
+ # think this is due to GO dependencies not being available.
29
+ # More investigation is required. But for now, instead of
30
+ # disabling the whole test, execute the attestation part
31
+ # conditionally. This at least gives us coverage of booting
32
+ # the guest on all platforms.
33
+ if command -v cca-workload-attestation >/dev/null 2>&1; then
34
+ if command -v cca-realm-initial-measurement >/dev/null 2>&1; then
35
+ cca-workload-attestation report | grep cca-realm-initial-measurement || exit 1
36
+ fi
37
+ fi
38
+ fi
39
+ poweroff -f
40
+ ;;
41
+ *)
42
+ echo Usage \$$0 {start|stop|restart|reload}
43
+ exit 1
44
+ ;;
45
+ esac" > ${param:builddir}/overlay/etc/init.d/S50test
46
+ - chmod +x ${param:builddir}/overlay/etc/init.d/S50test
47
+ - ${param:sourcedir}/utils/config --file ${param:builddir}/.config --set-val BR2_ROOTFS_OVERLAY \"${param:builddir}/overlay\"
@@ -0,0 +1,45 @@
1
+ # Copyright (c) 2022, Arm Limited.
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ %YAML 1.2
5
+ ---
6
+ description: >-
7
+ Trusted Firmware for A-class CPUs. This provides a baseline configuration that
8
+ can be customized by higher layers.
9
+
10
+ build:
11
+ tfa:
12
+ repo:
13
+ remote: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
14
+ revision: v2.14.0
15
+
16
+ toolchain: aarch64-none-elf-
17
+
18
+ params:
19
+ PLAT: fvp
20
+ DEBUG: 0
21
+ LOG_LEVEL: 40
22
+ ARM_DISABLE_TRUSTED_WDOG: 1
23
+ FVP_HW_CONFIG_DTS: fdts/fvp-base-gicv3-psci-1t.dts
24
+
25
+ prebuild:
26
+ # tfa does not notice when parameters are changed and can therefore end up
27
+ # with stale compilation units. Let's work around that by saving the
28
+ # parameters and comparing to the last run. If they have changed, force a
29
+ # clean. Also works for the case where shrinkwrap.params doesn't exist.
30
+ - 'echo "${param:join_equal}" > ${param:builddir}/shrinkwrap.params.new'
31
+ - if ! cmp -s "${param:builddir}/shrinkwrap.params.new" "${param:builddir}/shrinkwrap.params"; then
32
+ - make BUILD_BASE=${param:builddir} clean
33
+ - fi
34
+ - mv ${param:builddir}/shrinkwrap.params.new ${param:builddir}/shrinkwrap.params
35
+
36
+ build:
37
+ # tfa has makefile dependency bug that makes parallel make for more than
38
+ # ~8 jobs unreliable, so limit it to 8.
39
+ - "make BUILD_BASE=${param:builddir} ${param:join_equal} -j$$(( ${param:jobs} < 8 ? ${param:jobs} : 8 )) all fip"
40
+
41
+ artifacts:
42
+ BL1: ${param:builddir}/fvp/release/bl1.bin
43
+ BL2: ${param:builddir}/fvp/release/bl2.bin
44
+ BL31: ${param:builddir}/fvp/release/bl31.bin
45
+ FIP: ${param:builddir}/fvp/release/fip.bin
@@ -0,0 +1,36 @@
1
+ # Copyright (c) 2024, Arm Limited.
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ %YAML 1.2
5
+ ---
6
+ description: >-
7
+ Layer builds TF-A, TF-RMM, along with the required device tree, configured for
8
+ RME with Armv9.2 architecture extension. This yaml file can be customized and
9
+ used as base for building higher layers.
10
+
11
+ layers:
12
+ - FVP_Base_RevC-2xAEMvA-rme.yaml
13
+ - tfa-base.yaml
14
+ - rmm-base.yaml
15
+ - dt-base.yaml
16
+ - arch/v9.2.yaml
17
+
18
+ build:
19
+ tfa:
20
+ params:
21
+ ENABLE_RME: 1
22
+ RMM: ${artifact:RMM}
23
+ FVP_HW_CONFIG: ${artifact:DTB}
24
+
25
+ run:
26
+ terminals:
27
+ bp.terminal_3:
28
+ friendly: rmm
29
+
30
+ params:
31
+ # If BRBE is implemented and this is set to true, disable BRBE recording.
32
+ # All registers will be functional, but no branches will be recorded.
33
+ # This will improve model performance for workloads that enable BRBE,
34
+ # but don't care about the information stored in it.
35
+ -C cluster0.brbe_disable_recording: 1
36
+ -C cluster1.brbe_disable_recording: 1
@@ -0,0 +1,32 @@
1
+ # Copyright (c) 2023, Arm Limited.
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ %YAML 1.2
5
+ ---
6
+ description: >-
7
+ The Trusted Firmware-A Tests (TF-A-Tests) is a suite of baremetal tests that
8
+ exercise the Trusted Firmware-A (TF-A) features. This provides a baseline
9
+ configuration that can be customized by higher layers.
10
+
11
+ build:
12
+ tftf:
13
+ repo:
14
+ remote: https://git.trustedfirmware.org/TF-A/tf-a-tests.git
15
+ revision: v2.14.0
16
+
17
+ toolchain: aarch64-none-elf-
18
+
19
+ params:
20
+ PLAT: fvp
21
+ DEBUG: 0
22
+ ENABLE_REALM_PAYLOAD_TESTS: 1
23
+
24
+ build:
25
+ # tfa-tests has makefile dependency bug that makes parallel make for more
26
+ # than ~8 jobs unreliable, so limit it to 8.
27
+ - "make BUILD_BASE=${param:builddir} ${param:join_equal} -j$$(( ${param:jobs} < 8 ? ${param:jobs} : 8 )) all"
28
+
29
+ artifacts:
30
+ TFTF_BIN: ${param:builddir}/fvp/release/tftf.bin
31
+ SP_LAYOUT: ${param:builddir}/fvp/release/sp_layout.json
32
+
@@ -0,0 +1,133 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) 2022-2026, Arm Limited.
3
+ # SPDX-License-Identifier: MIT
4
+
5
+ import argparse
6
+ import shutil
7
+ from shrinkwrap import __version__
8
+
9
+
10
+ from shrinkwrap.commands import build
11
+ from shrinkwrap.commands import buildall
12
+ from shrinkwrap.commands import clean
13
+ from shrinkwrap.commands import inspect
14
+ from shrinkwrap.commands import process
15
+ from shrinkwrap.commands import run
16
+
17
+
18
+ VERBOSE = True
19
+
20
+
21
+ def config_verbose_flag(args):
22
+ global VERBOSE
23
+ # Not all commands (e.g. run) have --verbose. Choose not to change
24
+ # behavior in that case.
25
+ if 'verbose' in args:
26
+ VERBOSE = args.verbose
27
+ else:
28
+ VERBOSE = False
29
+
30
+
31
+ def formatter(prog):
32
+ width = shutil.get_terminal_size().columns
33
+ width -= 2
34
+ width = min(80, width)
35
+ return argparse.HelpFormatter(prog, width=width)
36
+
37
+
38
+ def main():
39
+ """
40
+ Main entry point. Parses command line and dispatches to appropriate
41
+ command handler.
42
+ """
43
+
44
+ tool_name = "shrinkwrap"
45
+
46
+ # Parse the arguments. The parser will raise an exception if the
47
+ # required arguments are not present, which will tell the user what they
48
+ # did wrong.
49
+
50
+ parser = argparse.ArgumentParser(epilog='To file a bug report, contact '
51
+ '<ryan.roberts@arm.com>.',
52
+ formatter_class=formatter)
53
+
54
+ parser.add_argument('--version',
55
+ action='version',
56
+ version=f'{tool_name} version {__version__}')
57
+
58
+ parser.add_argument('-R', '--runtime',
59
+ metavar='engine', required=False, default='docker',
60
+ choices=['null', 'docker', 'docker-local', 'podman', 'podman-local'],
61
+ help="""Specifies the environment in which to execute build and
62
+ run commands. If 'null', executes natively on the host.
63
+ 'docker' attempts to download the image from dockerhub and
64
+ execute the commands in a container. 'docker-local' is like
65
+ 'docker' but will only look for the image locally. 'podman'
66
+ and 'podman-local' are like 'docker' and 'docker-local'
67
+ except podman is used as the runtime instead of docker.
68
+ Defaults to 'docker'.""")
69
+
70
+ parser.add_argument('-I', '--image',
71
+ metavar='name',
72
+ required=False,
73
+ type=str,
74
+ default=None,
75
+ help="""If using a container runtime, specifies the name of the
76
+ image to use. Defaults to the official shrinkwrap image,
77
+ unless a specific image is required in the config file.""")
78
+
79
+ parser.add_argument('--ssh-agent',
80
+ default=False,
81
+ action='store_true',
82
+ required=False,
83
+ help="""Start ssh-agent and add default keys.""")
84
+
85
+ parser.add_argument('--ssh-agent-key',
86
+ dest='ssh_agent_keys',
87
+ default=[],
88
+ metavar='key',
89
+ action='append',
90
+ type=str,
91
+ required=False,
92
+ help="""Start ssh-agent and add specified key.""")
93
+
94
+ subparsers = parser.add_subparsers(dest='command',
95
+ metavar='<command>',
96
+ title=f'Supported commands (run '
97
+ f'"{tool_name} <command> '
98
+ f'--help" for more info)')
99
+
100
+ # Register all the commands.
101
+ cmds = {}
102
+ cmds[build.add_parser(subparsers, formatter)] = build
103
+ cmds[buildall.add_parser(subparsers, formatter)] = buildall
104
+ cmds[clean.add_parser(subparsers, formatter)] = clean
105
+ cmds[inspect.add_parser(subparsers, formatter)] = inspect
106
+ cmds[process.add_parser(subparsers, formatter)] = process
107
+ cmds[run.add_parser(subparsers, formatter)] = run
108
+
109
+ # Parse the arguments.
110
+ args = parser.parse_args()
111
+ config_verbose_flag(args)
112
+
113
+ if args.ssh_agent:
114
+ args.ssh_agent_keys.append(None)
115
+
116
+ # Dispatch to the correct command.
117
+ if args.command in cmds:
118
+ cmds[args.command].dispatch(args)
119
+ else:
120
+ print(f'Unknown command {args.command}')
121
+ parser.print_help()
122
+
123
+
124
+ if __name__ == "__main__":
125
+ try:
126
+ main()
127
+ except SystemExit as e:
128
+ raise
129
+ except BaseException as e:
130
+ if VERBOSE:
131
+ raise
132
+ print(f'{e.__class__.__name__}: {e}')
133
+ exit(1)
File without changes
@@ -0,0 +1,16 @@
1
+ # Copyright (c) 2022, Arm Limited.
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ _defaults = {
5
+ 'jobs': 4,
6
+ }
7
+
8
+
9
+ def get(**kwargs):
10
+ clivars = dict(_defaults)
11
+
12
+ for k, v in kwargs.items():
13
+ assert(k in clivars)
14
+ clivars[k] = v
15
+
16
+ return {k: str(v) for k, v in clivars.items()}