[U-Boot-Users] [PATCH] Make scripts and Makefiles POSIX compliant

Wolfgang Denk wd at denx.de
Wed Jan 2 15:56:46 CET 2008


The bash builtin versions of the "test" (resp. "[") command allow
using "==" for string comparisons, but POSIX compatible implemen-
tations (like /usr/bin/test) insist on using "=" only. On such systems
you will see:

	$ /usr/bin/test a == a && echo OK
	/usr/bin/test: ==: binary operator expected

This patch fixes Makefiles and scripts to use POSIX style.

Signed-off-by: Wolfgang Denk <wd at denx.de>
---
This problem shows up on some [k]ubuntu systems. Thanks to Stefan
Roese for reporting the issue.

 Makefile                               |    6 +++---
 board/integratorap/split_by_variant.sh |    4 ++--
 board/integratorcp/split_by_variant.sh |    4 ++--
 board/versatile/split_by_variant.sh    |    2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 34e9f9d..189e1de 100644
--- a/Makefile
+++ b/Makefile
@@ -1682,14 +1682,14 @@ TQM8265_AA_config:  unconfig
 	fi; \
 	echo "#define CONFIG_$${CFREQ}MHz"	>>$(obj)include/config.h ; \
 	echo "... with $${CFREQ}MHz system clock" ; \
-	if [ "$${CACHE}" == "yes" ] ; then \
+	if [ "$${CACHE}" = "yes" ] ; then \
 		echo "#define CONFIG_L2_CACHE"	>>$(obj)include/config.h ; \
 		echo "... with L2 Cache support" ; \
 	else \
 		echo "#undef CONFIG_L2_CACHE"	>>$(obj)include/config.h ; \
 		echo "... without L2 Cache support" ; \
 	fi; \
-	if [ "$${BMODE}" == "60x" ] ; then \
+	if [ "$${BMODE}" = "60x" ] ; then \
 		echo "#define CONFIG_BUSMODE_60x" >>$(obj)include/config.h ; \
 		echo "... with 60x Bus Mode" ; \
 	else \
@@ -1803,7 +1803,7 @@ M54455EVB_i66_config :	unconfig
 	M54455EVB_i66_config)		FLASH=INTEL; FREQ=66666666;; \
 	esac; \
 	>include/config.h ; \
-	if [ "$${FLASH}" == "INTEL" ] ; then \
+	if [ "$${FLASH}" = "INTEL" ] ; then \
 		echo "#undef CFG_ATMEL_BOOT" >> $(obj)include/config.h ; \
 		echo "TEXT_BASE = 0x00000000" > $(obj)board/freescale/m54455evb/config.tmp ; \
 		cp $(obj)board/freescale/m54455evb/u-boot.int $(obj)board/freescale/m54455evb/u-boot.lds ; \
diff --git a/board/integratorap/split_by_variant.sh b/board/integratorap/split_by_variant.sh
index 53b0d1e..4b94d8f 100755
--- a/board/integratorap/split_by_variant.sh
+++ b/board/integratorap/split_by_variant.sh
@@ -14,7 +14,7 @@ echo	" 1 /* Integrator/AP	 */"		>> tmp.fil
 cpu="arm_intcm"
 variant="unknown core module"
 
-if [ "$1" == "" ]
+if [ "$1" = "" ]
 then
 	echo "$0:: No parameters - using arm_intcm"
 else
@@ -84,7 +84,7 @@ else
 	esac
 fi
 
-if [ "$cpu" == "arm_intcm" ]
+if [ "$cpu" = "arm_intcm" ]
 then
 	echo "/* Core module undefined/not ported */"	>> tmp.fil
 	echo "#define CONFIG_ARM_INTCM 1"		>> tmp.fil
diff --git a/board/integratorcp/split_by_variant.sh b/board/integratorcp/split_by_variant.sh
index 37ae517..79a6a9d 100755
--- a/board/integratorcp/split_by_variant.sh
+++ b/board/integratorcp/split_by_variant.sh
@@ -12,7 +12,7 @@ echo     " 1 /* Integrator/CP   */"  		>> tmp.fil
 cpu="arm_intcm"
 variant="unknown core module"
 
-if [ "$1" == "" ]
+if [ "$1" = "" ]
 then
 	echo "$0:: No parameters - using arm_intcm"
 else
@@ -79,7 +79,7 @@ else
 
 fi
 
-if [ "$cpu" == "arm_intcm" ]
+if [ "$cpu" = "arm_intcm" ]
 then
 	echo "/* Core module undefined/not ported */"	>> tmp.fil
 	echo "#define CONFIG_ARM_INTCM 1"  		>> tmp.fil
diff --git a/board/versatile/split_by_variant.sh b/board/versatile/split_by_variant.sh
index 25461c2..ccded7e 100755
--- a/board/versatile/split_by_variant.sh
+++ b/board/versatile/split_by_variant.sh
@@ -8,7 +8,7 @@
 
 mkdir -p ${obj}include
 variant=PB926EJ-S
-if [ "$1" == "" ]
+if [ "$1" = "" ]
 then
 	echo "$0:: No parameters - using versatilepb_config"
 	echo "#define CONFIG_ARCH_VERSATILE_PB" > ${obj}include/config.h
-- 
1.5.2.2


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Hiring experienced unix people is  like  a  built-in  filter  against
idiots. Hiring experienced NT people provides no such guarantee.
            -- Miguel Cruz in WgL96.349$CC.122704 at typhoon2.ba-dsg.net




More information about the U-Boot mailing list