summaryrefslogtreecommitdiff
path: root/mkconfig
diff options
context:
space:
mode:
authorAllen Martin <amartin@nvidia.com>2012-08-31 08:30:05 +0000
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-09-01 14:58:21 +0200
commit0fd37b82f64a72f5e52d11fc1895827551ff5f59 (patch)
treec63e0bb8c1a32abd543f59d2ae6f9ca1736eb203 /mkconfig
parente3e5dac412b1b4c75050705be039c5c3bef877b6 (diff)
mkconfig: remove bashisms and cleanup config.mk generation
This adds some cleanup to mkconfig related to SPL support. Bash specific script has been replaced with awk for better shell compatibility. config.mk generation is done through a subshell and single redirect to improve readability. Signed-off-by: Allen Martin <amartin@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'mkconfig')
-rwxr-xr-xmkconfig38
1 files changed, 17 insertions, 21 deletions
diff --git a/mkconfig b/mkconfig
index 9e1a7e64cc8..d3363c6df37 100755
--- a/mkconfig
+++ b/mkconfig
@@ -59,12 +59,8 @@ CONFIG_NAME="${1%_config}"
[ "${BOARD_NAME}" ] || BOARD_NAME="${1%_config}"
arch="$2"
-cpu="$3"
-tmp="${cpu#*:}"
-if [ "$tmp" != "$cpu" ] ; then
- spl_cpu=$tmp
- cpu="${cpu%:*}"
-fi
+cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $1}'`
+spl_cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $2}'`
if [ "$4" = "-" ] ; then
board=${BOARD_NAME}
else
@@ -135,21 +131,21 @@ fi
#
# Create include file for Make
#
-echo "ARCH = ${arch}" > config.mk
-if [ ! -z "$spl_cpu" ] ; then
- echo 'ifeq ($(CONFIG_SPL_BUILD),y)' >> config.mk
- echo "CPU = ${spl_cpu}" >> config.mk
- echo "else" >> config.mk
- echo "CPU = ${cpu}" >> config.mk
- echo "endif" >> config.mk
-else
- echo "CPU = ${cpu}" >> config.mk
-fi
-echo "BOARD = ${board}" >> config.mk
-
-[ "${vendor}" ] && echo "VENDOR = ${vendor}" >> config.mk
-
-[ "${soc}" ] && echo "SOC = ${soc}" >> config.mk
+( echo "ARCH = ${arch}"
+ if [ ! -z "$spl_cpu" ] ; then
+ echo 'ifeq ($(CONFIG_SPL_BUILD),y)'
+ echo "CPU = ${spl_cpu}"
+ echo "else"
+ echo "CPU = ${cpu}"
+ echo "endif"
+ else
+ echo "CPU = ${cpu}"
+ fi
+ echo "BOARD = ${board}"
+
+ [ "${vendor}" ] && echo "VENDOR = ${vendor}"
+ [ "${soc}" ] && echo "SOC = ${soc}"
+ exit 0 ) > config.mk
# Assign board directory to BOARDIR variable
if [ -z "${vendor}" ] ; then