[Sound-open-firmware] [PATCH V2 2/3] scripts: refine build all script

Xiuli Pan xiuli.pan at linux.intel.com
Sun Jun 10 09:32:25 CEST 2018


From: Pan Xiuli <xiuli.pan at 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 at linux.intel.com>
---
V2: fix mismatch or variable name in for loop and add check for no args
---
 scripts/xtensa-build-all.sh | 137 ++++++++++++++++++++++++++------------------
 1 file changed, 82 insertions(+), 55 deletions(-)

diff --git a/scripts/xtensa-build-all.sh b/scripts/xtensa-build-all.sh
index 99db2b0..198ab8d 100755
--- a/scripts/xtensa-build-all.sh
+++ b/scripts/xtensa-build-all.sh
@@ -1,5 +1,39 @@
 #!/bin/bash
 
+SUPPORTED_PLATFORMS=(byt cht bdw hsw apl cnl)
+if [ "$#" -eq 0 ]
+then
+	PLATFORMS=${SUPPORTED_PLATFORMS[@]}
+else
+	# 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 i in ${SUPPORTED_PLATFORMS[@]}
+			do
+				if [ $i == $args ]
+				then
+					PLATFORMS+=$i" "
+				fi
+			done
+		fi
+	done
+fi
+
+
+# now build the firmware (depends on rimage)
+rm -fr src/arch/xtensa/*.ri
+
 # fail on any errors
 set -e
 
@@ -8,67 +42,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 local folder!"
+	rm -rf $pwd/local/
+	./configure --enable-rimage --prefix=$pwd/local
+	make
+	make install
+	PATH=$pwd/local/bin:$PATH
 fi
 
-for i in ${PLATFORMS[@]}
+# build platform
+for j 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
-- 
2.7.4



More information about the Sound-open-firmware mailing list