diff options
Diffstat (limited to 'tools/generate_json/generate_json.sh')
-rwxr-xr-x | tools/generate_json/generate_json.sh | 107 |
1 files changed, 89 insertions, 18 deletions
diff --git a/tools/generate_json/generate_json.sh b/tools/generate_json/generate_json.sh index f46cf158a..58677004d 100755 --- a/tools/generate_json/generate_json.sh +++ b/tools/generate_json/generate_json.sh @@ -1,36 +1,107 @@ #!/bin/bash # -# Copyright (c) 2020, Arm Limited. All rights reserved. +# Copyright (c) 2020-2022, Arm Limited. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # # Generate a JSON file which will be fed to TF-A as SPM_LAYOUT_FILE to package # Secure Partitions as part of FIP. +# Note the script will append the partition to the existing layout file. +# If you wish to only generate a layout file with this partition first run +# "make realclean" to remove the existing file. -# $1 = Secure Partition (cactus) -# $2 = Platform built path -# Output = $2/sp_layout.json +# $1 = Platform built path +# $2.. = List of Secure Partitions +# Output = $1/sp_layout.json -GENERATED_JSON=$2/sp_layout.json +GENERATED_JSON=$1/sp_layout.json +shift # Shift arguments 1 + +PARTITION_ALREADY_PRESENT=false + +CACTUS_PRESENT=false +IVY_PRESENT=false +IVY_SHIM_PRESENT=false + +for target in "$@"; do + case $target in + cactus) CACTUS_PRESENT=true ;; + ivy) IVY_PRESENT=true ;; + ivy_shim) IVY_SHIM_PRESENT=true ;; + *) echo "Invalid target $target"; exit 1 ;; + esac +done + +echo -e "{" > "$GENERATED_JSON" # To demonstrate communication between SP's, two cactus S-EL1 instances used. # To also test mapping of the RXTX region a third cactus S-EL1 instance is used. # cactus-primary, cactus-secondary and cactus-tertiary have same binary but # different partition manifests. -if [ "$1" == "cactus" ]; then - echo -e "{\n\t\"$1-primary\" : {\n \ - \t\"image\": \"$1.bin\",\n \ - \t\"pm\": \"$1.dts\",\n \ - \t\"owner\": \"SiP\"\n\t},\n\n\t\"$1-secondary\" : {\n \ - \t\"image\": \"$1.bin\",\n \ - \t\"pm\": \"$1-secondary.dts\",\n \ - \t\"owner\": \"Plat\"\n\t},\n\n\t\"$1-tertiary\" : {\n \ - \t\"image\": \"$1.bin\",\n \ - \t\"pm\": \"$1-tertiary.dts\" \n \ - }\n}" \ - > "$GENERATED_JSON" +if [ $CACTUS_PRESENT == "true" ]; then + cat >> "$GENERATED_JSON" << EOF +"cactus-primary" : { + "image": { + "file": "cactus.bin", + "offset":"0x2000" + }, + "pm": { + "file": "cactus.dts", + "offset": "0x1000" + }, + "physical-load-address": "0x7000000", + "owner": "SiP" +}, + +"cactus-secondary" : { + "image": "cactus.bin", + "pm": "cactus-secondary.dts", + "physical-load-address": "0x7100000", + "owner": "Plat" +}, + +"cactus-tertiary" : { + "image": "cactus.bin", + "pm": "cactus-tertiary.dts", + "physical-load-address": "0x7200000", + "owner": "Plat" +EOF + PARTITION_ALREADY_PRESENT=true +fi + +if [ $IVY_PRESENT == "true" ]; then + if [ $PARTITION_ALREADY_PRESENT == "true" ]; then + echo -ne "\t},\n\n" >> "$GENERATED_JSON" + fi + + cat >> "$GENERATED_JSON" << EOF +"ivy" : { + "image": "ivy.bin", + "pm": "ivy-sel0.dts", + "physical-load-address": "0x7600000", + "owner": "Plat" +} +EOF + + PARTITION_ALREADY_PRESENT=true +elif [ $IVY_SHIM_PRESENT == "true" ]; then + if [ $PARTITION_ALREADY_PRESENT == "true" ]; then + echo -ne "\t},\n\n" >> "$GENERATED_JSON" + fi +cat >> "$GENERATED_JSON" << EOF +"ivy" : { + "image": "ivy.bin", + "pm": "ivy-sel1.dts", + "physical-load-address": "0x7600000", + "owner": "Plat" +} +EOF + + PARTITION_ALREADY_PRESENT=true else - echo -e "\nWarning: Only Cactus is supported as Secure Partition\n" + echo -ne "\t},\n" >> "$GENERATED_JSON" fi + +echo -e "\n}" >> "$GENERATED_JSON" |