diff options
author | Bunnaroath Sou <35707615+bsousi5@users.noreply.github.com> | 2019-01-31 16:26:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-31 16:26:06 -0800 |
commit | d730034120ff78f1cb06d49b6a2e7470b6f43993 (patch) | |
tree | cf48cce074f14caa04a66826e5f0c2329cdf0196 | |
parent | fcbe8509cdef170ce45b882ded3febf7c085d85b (diff) | |
parent | 992f67709cdaba787d57530c613eb41d5bfe219a (diff) |
Merge pull request #166 from sifive/private-bsp
Update to generate bsp at a custom location
-rwxr-xr-x | bsp/update-targets.sh | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/bsp/update-targets.sh b/bsp/update-targets.sh index 780d662..fc1b76c 100755 --- a/bsp/update-targets.sh +++ b/bsp/update-targets.sh @@ -1,5 +1,60 @@ #!/usr/bin/env sh +help() { + cat >&2 <<EOF +$0: BSP Generator for the SiFive Freedom E SDK + --help Prints this help text. + --target-name Specify bsp target name. + --sdk-path=* The path to the freedom-e-sdk clone directory, public or private. + --target-dts=*.dts The path to the target device tree that will be used. + --ipdelivery-tgz=*.tar.gz The path to the ipdelivery that will be used. +EOF +} + +unset DTSFILE +unset CUSTOM_PATH +unset CUSTOM_NAME +while [[ "$1" != "" ]] +do + case "$1" in + --help) help "$0"; exit 0;; + --target-name) CUSTOM_NAME="$2"; shift 2;; + --sdk-path=*) CUSTOM_PATH="$(echo "$1" | cut -d= -f2-)"; shift 1;; + --sdk-path) CUSTOM_PATH="$2"; shift 2;; + --target-dts=*) DTSFILE="$(echo "$1" | cut -d= -f2-)"; shift 1;; + --target-dts) DTSFILE="$2"; shift 2;; + *) echo "$0: Unknown argument $1" >&2; exit 1;; + esac +done + +if [[ "$CUSTOM_PATH" == "" && "$CUSTOM_NAME" == "" && "$DTSFILE" == "" ]] +then + TARGET_LIST="$(ls -d coreip*) " + TARGET_LIST+="sifive-hifive1 freedom-e310-arty " +else + if [[ ! -f "$DTSFILE" && "$DTSFILE" != "*.dts" ]] + then + echo "[ERROR] $0: $DTSFILE must be a dts file" >&2 + help "$0" + exit 1 + fi + if [[ "$CUSTOM_NAME" == "" ]] + then + echo "[ERROR] $0: --target-name is mandatory" >&2 + help "$0" + exit 1 + fi + CUSTOM_TARGET="$CUSTOM_PATH/bsp/$CUSTOM_NAME" + if [[ ! -d "$CUSTOM_TARGET" ]] + then + echo "[ERROR] $0: "$CUSTOM_TARGET" not found!" >&2 + help "$0" + exit 1 + fi + cp $DTSFILE $CUSTOM_TARGET + TARGET_LIST="$CUSTOM_TARGET " +fi + DTC=dtc MEE_HEADER_GENERATOR=freedom-mee_header-generator LDSCRIPT_GENERATOR=freedom-ldscript-generator @@ -9,9 +64,6 @@ DTB_FILENAME=temp.dtb HEADER_FILENAME=mee.h LDSCRIPT_FILENAME=mee.lds -TARGET_LIST="$(ls -d coreip*) " -TARGET_LIST+="sifive-hifive1 freedom-e310-arty " - update_target() { TARGET=$1 @@ -30,6 +82,7 @@ update_target() { echo "" } +echo $PWD for TARGET in $TARGET_LIST do update_target $TARGET |