blob: 0de5622cf0a4e7c84a1d147993d1c693abe34b97 [file] [log] [blame]
Manish Pandey270ee152020-03-16 22:25:40 +00001#!/bin/bash
2
3#
Olivier Deprez6baf5b82021-05-14 19:04:40 +02004# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
Manish Pandey270ee152020-03-16 22:25:40 +00005#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8
9# Generate a JSON file which will be fed to TF-A as SPM_LAYOUT_FILE to package
10# Secure Partitions as part of FIP.
Olivier Deprez6baf5b82021-05-14 19:04:40 +020011# Note the script will append the partition to the existing layout file.
12# If you wish to only generate a layout file with this partition first run
13# "make realclean" to remove the existing file.
Manish Pandey270ee152020-03-16 22:25:40 +000014
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010015# $1 = Platform built path
16# $2.. = List of Secure Partitions
17# Output = $1/sp_layout.json
Manish Pandey270ee152020-03-16 22:25:40 +000018
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010019GENERATED_JSON=$1/sp_layout.json
20shift # Shift arguments 1
Olivier Deprez6baf5b82021-05-14 19:04:40 +020021
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010022PARTITION_ALREADY_PRESENT=false
Daniel Boulbya2858262022-07-05 11:03:37 +010023
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010024CACTUS_PRESENT=false
25IVY_PRESENT=false
26IVY_SHIM_PRESENT=false
27
28for target in "$@"
29do
30 case $target in
31 cactus)
32 CACTUS_PRESENT=true
33 ;;
34 ivy)
35 IVY_PRESENT=true
36 ;;
37 ivy_shim)
38 IVY_SHIM_PRESENT=true
39 ;;
40 *)
41 echo "Invalid target $target"
42 exit 1
43 ;;
44 esac
45done
46
47echo -e "{" > $GENERATED_JSON
Manish Pandey270ee152020-03-16 22:25:40 +000048
49# To demonstrate communication between SP's, two cactus S-EL1 instances used.
Max Shvetsov93119e32020-07-01 14:09:48 +010050# To also test mapping of the RXTX region a third cactus S-EL1 instance is used.
51# cactus-primary, cactus-secondary and cactus-tertiary have same binary but
52# different partition manifests.
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010053if [ $CACTUS_PRESENT == "true" ]; then
54 echo -ne "\t\"cactus-primary\" : {\n \
J-Alves31d87952022-04-04 12:34:16 +010055 \t\"image\": {\n \
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010056 \t\t\"file\": \"cactus.bin\",\n \
J-Alves31d87952022-04-04 12:34:16 +010057 \t\t\"offset\":\"0x2000\"\n\
58 \t},\n \
59 \t\"pm\": {\n \
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010060 \t\t\"file\": \"cactus.dts\",\n \
J-Alves31d87952022-04-04 12:34:16 +010061 \t\t\"offset\":\"0x1000\"\n\
62 \t},\n
Karl Meakin657f6b22023-03-07 16:44:24 +000063 \t\"physical-load-address\": \"0x7000000\",\n \
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010064 \t\"owner\": \"SiP\"\n\t},\n\n\t\"cactus-secondary\" : {\n \
65 \t\"image\": \"cactus.bin\",\n \
66 \t\"pm\": \"cactus-secondary.dts\",\n \
Karl Meakin657f6b22023-03-07 16:44:24 +000067 \t\"physical-load-address\": \"0x7100000\",\n \
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010068 \t\"owner\": \"Plat\"\n\t},\n\n\t\"cactus-tertiary\" : {\n \
69 \t\"image\": \"cactus.bin\",\n \
70 \t\"pm\": \"cactus-tertiary.dts\",\n \
Karl Meakin657f6b22023-03-07 16:44:24 +000071 \t\"physical-load-address\": \"0x7200000\",\n \
Olivier Deprez6baf5b82021-05-14 19:04:40 +020072 \t\"owner\": \"Plat\"\n\t}" \
73 >> "$GENERATED_JSON"
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010074 PARTITION_ALREADY_PRESENT=true
75fi
76if [ $IVY_PRESENT == "true" ]; then
77 if [ $PARTITION_ALREADY_PRESENT == "true" ]; then
78 echo -ne ",\n\n" >> $GENERATED_JSON
79 fi
80 echo -ne "\t\"ivy\" : {\n \
Ruari Phipps8747ed22020-09-01 13:32:17 +010081 \t\"image\": \"ivy.bin\",\n \
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010082 \t\"pm\": \"ivy-sel0.dts\",\n \
Karl Meakin657f6b22023-03-07 16:44:24 +000083 \t\"physical-load-address\": \"0x7600000\",\n \
Olivier Deprez6baf5b82021-05-14 19:04:40 +020084 \t\"owner\": \"Plat\"\n\t}" >> "$GENERATED_JSON"
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010085 PARTITION_ALREADY_PRESENT=true
86elif [ $IVY_SHIM_PRESENT == "true" ]; then
87 if [ $PARTITION_ALREADY_PRESENT == "true" ]; then
88 echo -ne ",\n\n" >> $GENERATED_JSON
89 fi
Daniel Boulby427be2a2022-08-01 10:57:37 +010090 echo -ne "\t\"ivy\" : {\n \
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010091 \t\"image\": \"ivy.bin\",\n \
92 \t\"pm\": \"ivy-sel1.dts\",\n \
Karl Meakin657f6b22023-03-07 16:44:24 +000093 \t\"physical-load-address\": \"0x7600000\",\n \
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010094 \t\"owner\": \"Plat\"\n\t}" >> "$GENERATED_JSON"
95 PARTITION_ALREADY_PRESENT=true
Manish Pandey270ee152020-03-16 22:25:40 +000096fi
Olivier Deprez6baf5b82021-05-14 19:04:40 +020097
Daniel Boulbyf6c288e2022-07-25 14:07:57 +010098echo -e "\n}" >> "$GENERATED_JSON"