From: Pan Xiuli xiuli.pan@linux.intel.com
Add a flag "-l" to make rimage install only in pdw/local. Also add parse for args, then simplify platform build for loop since in parse the args will be all legal
Signed-off-by: Pan Xiuli xiuli.pan@linux.intel.com --- scripts/xtensa-build-all.sh | 130 ++++++++++++++++++++++++++------------------ 1 file changed, 76 insertions(+), 54 deletions(-)
diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh index 99db2b0..8406414 100755 --- a/scripts/xtensa-build-all.sh +++ b/scripts/xtensa-build-all.sh @@ -1,5 +1,34 @@ #!/bin/bash
+SUPPORTED_PLATFORMS=(byt cht bdw hsw apl cnl) + +# parse the args +for args in $@ +do + if [[ "$args" == "-l" ]] + then + BUILD_LOCAL=1 + + # build all images for chosen targets + if [ "$#" -eq 1 ] + then + PLATFORMS=${SUPPORTED_PLATFORMS[@]} + break + fi + else + for j in ${SUPPORTED_PLATFORMS[@]} + do + if [ $j == $args ] + then + PLATFORMS+=$j" " + fi + done + fi +done + +# now build the firmware (depends on rimage) +rm -fr src/arch/xtensa/*.ri + # fail on any errors set -e
@@ -8,67 +37,60 @@ set -e
pwd=`pwd`
-# make sure rimage is built and aligned with code -./configure --enable-rimage -make -sudo make install - -# now build the firmware (depends on rimage) -rm -fr src/arch/xtensa/*.ri
-SUPPORTED_PLATFORMS=(byt cht bdw hsw apl cnl) - -# build all images for chosen targets -if [ "$#" -eq 0 ] +# make sure rimage is built and aligned with code +if [[ "x$BUILD_LOCAL" == "x" ]] then - PLATFORMS=${SUPPORTED_PLATFORMS[@]} + ./configure --enable-rimage + make + sudo make install else - PLATFORMS=$@ + echo "BUILD IN ~/bin" + rm -rf $pwd/local/ + ./configure --enable-rimage --prefix=$pwd/local + make + make install + PATH=$pwd/local/bin:$PATH fi
+# build platform for i in ${PLATFORMS[@]} do - for j in ${SUPPORTED_PLATFORMS[@]} - do - if [ $j == $i ] - then - if [ $j == "byt" ] - then - PLATFORM="baytrail" - ROOT="xtensa-byt-elf" - fi - if [ $j == "cht" ] - then - PLATFORM="cherrytrail" - ROOT="xtensa-byt-elf" - fi - if [ $j == "bdw" ] - then - PLATFORM="broadwell" - ROOT="xtensa-hsw-elf" - fi - if [ $j == "hsw" ] - then - PLATFORM="haswell" - ROOT="xtensa-hsw-elf" - fi - if [ $j == "apl" ] - then - PLATFORM="apollolake" - ROOT="xtensa-bxt-elf" - fi - if [ $j == "cnl" ] - then - PLATFORM="cannonlake" - ROOT="xtensa-cnl-elf" - fi - PATH=$pwd/../xtensa-root/$ROOT/bin:$PATH - ./configure --with-arch=xtensa --with-platform=$PLATFORM --with-root-dir=$pwd/../xtensa-root/$ROOT --host=$ROOT - make clean - make - make bin - fi - done + if [ $j == "byt" ] + then + PLATFORM="baytrail" + ROOT="xtensa-byt-elf" + fi + if [ $j == "cht" ] + then + PLATFORM="cherrytrail" + ROOT="xtensa-byt-elf" + fi + if [ $j == "bdw" ] + then + PLATFORM="broadwell" + ROOT="xtensa-hsw-elf" + fi + if [ $j == "hsw" ] + then + PLATFORM="haswell" + ROOT="xtensa-hsw-elf" + fi + if [ $j == "apl" ] + then + PLATFORM="apollolake" + ROOT="xtensa-bxt-elf" + fi + if [ $j == "cnl" ] + then + PLATFORM="cannonlake" + ROOT="xtensa-cnl-elf" + fi + PATH=$pwd/../xtensa-root/$ROOT/bin:$PATH + ./configure --with-arch=xtensa --with-platform=$PLATFORM --with-root-dir=$pwd/../xtensa-root/$ROOT --host=$ROOT + make clean + make + make bin done
# list all the images