From patchwork Fri Aug 31 18:30:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allen Martin X-Patchwork-Id: 181045 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 513062C038B for ; Sat, 1 Sep 2012 04:34:46 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 338FE28122; Fri, 31 Aug 2012 20:33:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lDYu57Q+mO-m; Fri, 31 Aug 2012 20:33:04 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AF0CB28158; Fri, 31 Aug 2012 20:30:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C2B3528105 for ; Fri, 31 Aug 2012 20:30:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xNofK6F+U0z3 for ; Fri, 31 Aug 2012 20:30:43 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from hqemgate04.nvidia.com (hqemgate04.nvidia.com [216.228.121.35]) by theia.denx.de (Postfix) with ESMTPS id 449A3280FD for ; Fri, 31 Aug 2012 20:30:27 +0200 (CEST) Received: from hqnvupgp06.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Fri, 31 Aug 2012 11:29:46 -0700 Received: from hqemhub03.nvidia.com ([172.17.108.22]) by hqnvupgp06.nvidia.com (PGP Universal service); Fri, 31 Aug 2012 11:30:23 -0700 X-PGP-Universal: processed; by hqnvupgp06.nvidia.com on Fri, 31 Aug 2012 11:30:23 -0700 Received: from badger.nvidia.com (172.20.144.16) by hqemhub03.nvidia.com (172.20.150.15) with Microsoft SMTP Server id 8.3.264.0; Fri, 31 Aug 2012 11:30:23 -0700 From: Allen Martin To: , , , , , Date: Fri, 31 Aug 2012 11:30:05 -0700 Message-ID: <1346437815-3186-7-git-send-email-amartin@nvidia.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1346437815-3186-1-git-send-email-amartin@nvidia.com> References: <1346437815-3186-1-git-send-email-amartin@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v11 06/16] mkconfig: remove bashisms and cleanup config.mk generation X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 Signed-off-by: Tom Warren --- mkconfig | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/mkconfig b/mkconfig index 9e1a7e6..d3363c6 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