Build script and Environment setup script.
Readme to explain how to run build script

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Meenakshi Aggarwal <meenakshi.aggar...@nxp.com>
---
 Platform/NXP/Env.cshrc |  77 ++++++++++++++++++++++++++++++++++++
 Platform/NXP/Readme.md |  15 +++++++
 Platform/NXP/build.sh  | 103 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 195 insertions(+)
 create mode 100755 Platform/NXP/Env.cshrc
 create mode 100644 Platform/NXP/Readme.md
 create mode 100755 Platform/NXP/build.sh

diff --git a/Platform/NXP/Env.cshrc b/Platform/NXP/Env.cshrc
new file mode 100755
index 0000000..31abb04
--- /dev/null
+++ b/Platform/NXP/Env.cshrc
@@ -0,0 +1,77 @@
+#  @file.
+#
+#  Copyright 2017 NXP
+#
+#  This program and the accompanying materials are licensed and made available 
under
+#  the terms and conditions of the BSD License which accompanies this 
distribution.
+#  The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+#
+#
+
+unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion
+
+if [ X"$CROSS_COMPILE_64" != X"" ]; then
+  ARM64_PREFIX="$CROSS_COMPILE_64"
+elif [ X"$CROSS_COMPILE" != X"" ]; then
+  ARM64_PREFIX="$CROSS_COMPILE"
+else
+  ARM64_PREFIX="aarch64-linux-gnu-"
+fi
+
+GCC_UTILITY="${ARM64_PREFIX}gcc"
+CheckGcc=`which $GCC_UTILITY >/dev/null 2>&1`
+if [ "$?" -eq 0 ];then
+  GCC_VERSION=`$GCC_UTILITY -v 2>&1 | tail -n 1 | awk '{print $3}'`
+  MajorVersion=`echo $GCC_VERSION | cut -d . -f 1`
+  MinorVersion=`echo $GCC_VERSION | cut -d . -f 2`
+  GCC_ARCH_PREFIX=
+  NOTSUPPORTED=0
+
+  case $MajorVersion in
+    4)
+      case $MinorVersion in
+        9)
+          GCC_ARCH_PREFIX="GCC49_AARCH64_PREFIX"
+        ;;
+        *)
+          NOTSUPPORTED=1
+        ;;
+      esac
+    ;;
+    5)
+      case $MinorVersion in
+      4)
+        GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
+      ;;
+      *)
+        GCC_ARCH_PREFIX="GCC5_AARCH64_PREFIX"
+        echo "Warning: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion) 
has not been tested, please use at own risk."
+      ;;
+      esac
+    ;;
+    *)
+      NOTSUPPORTED=1
+    ;;
+  esac
+
+  [ "$NOTSUPPORTED" -eq 1 ] && {
+      echo "Error: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion) not 
supported ."
+      unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion
+  }
+
+  [ -n "$GCC_ARCH_PREFIX" ] && {
+    export GCC_ARCH_PREFIX="$GCC_ARCH_PREFIX"
+    export "$GCC_ARCH_PREFIX=$ARM64_PREFIX"
+  }
+
+  unset ARCH
+else
+    echo "Error: ${GCC_UTILITY} not found. Please check PATH variable."
+    unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion
+fi
+
+export PACKAGES_PATH=$PWD/../../../edk2-platforms
diff --git a/Platform/NXP/Readme.md b/Platform/NXP/Readme.md
new file mode 100644
index 0000000..2c36f43
--- /dev/null
+++ b/Platform/NXP/Readme.md
@@ -0,0 +1,15 @@
+Support for all NXP boards is available in this directory.
+
+# How to build
+
+build script source environment file Env.cshrc
+
+user need to run only build command.
+
+1. Build desired board
+   ./build.sh <board-name> <build-candidate> <clean> (optional)
+
+   board-name      : LS1043 / LS1046 / LS2088
+   build-candidate : DEBUG / RELEASE
+
+Currently, support for LS1043 is provided.
diff --git a/Platform/NXP/build.sh b/Platform/NXP/build.sh
new file mode 100755
index 0000000..e465ebf
--- /dev/null
+++ b/Platform/NXP/build.sh
@@ -0,0 +1,103 @@
+#!/bin/bash
+
+# UEFI build script for NXP LS SoCs
+#
+# Copyright 2017 NXP
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD 
License
+# which accompanies this distribution.  The full text of the license may be 
found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+# source environment file
+source Env.cshrc
+
+# Global Defaults
+ARCH=AARCH64
+TARGET_TOOLS=`echo $GCC_ARCH_PREFIX | cut -d _ -f 1`
+BASE_DIR=../../..
+
+[ -z "$TARGET_TOOLS" ] && {
+  echo "TARGET_TOOLS not found. Please run \"source Env.cshrc\" ."
+  exit 1
+}
+
+print_usage_banner()
+{
+    echo ""
+    echo "This shell script expects:"
+    echo "    Arg 1 (mandatory): Board Type (can be LS1043 / LS1046 / LS2088)."
+    echo "    Arg 2 (mandatory): Build candidate (can be RELEASE or DEBUG). By
+              default we build the RELEASE candidate."
+    echo "    Arg 3 (optional): clean - To do a 'make clean' operation."
+}
+
+# Check for total num of input arguments
+if [[ "$#" -gt 3 ]]; then
+  echo "Illegal number of parameters"
+  print_usage_banner
+  exit
+fi
+
+# Check for third parameter to be clean only
+if [[ "$3" && $3 != "clean" ]]; then
+  echo "Error ! Either clean or emplty"
+  print_usage_banner
+  exit
+fi
+
+# Check for input arguments
+if [[ $1 == "" || $2 == "" ]]; then
+  echo "Error !"
+  print_usage_banner
+  exit
+fi
+
+# Check for input arguments
+if [[ $1 != "LS1043" && $1 != "LS1046" && $1 != "LS2088" ]]; then
+  echo "Error ! Incorrect Board Type specified."
+  print_usage_banner
+  exit
+fi
+
+# Check for input arguments
+if [[ $2 != "RELEASE" ]]; then
+  if [[ $2 != "DEBUG" ]]; then
+    echo "Error ! Incorrect build target specified."
+    print_usage_banner
+    exit
+  fi
+fi
+
+PKG="aRdbPkg"
+
+echo ".........................................."
+echo "Welcome to $1$PKG UEFI Build environment"
+echo ".........................................."
+
+if [[ $3 == "clean" ]]; then
+  echo "Cleaning up the build directory '$BASE_DIR/Build/$1$PKG/'.."
+  rm -rf $BASE_DIR/Build/$1$PKG/*
+  exit
+fi
+
+# Clean-up
+set -e
+shopt -s nocasematch
+
+#
+# Setup workspace now
+#
+echo Initializing workspace
+cd $BASE_DIR
+
+# Use the BaseTools in edk2
+export EDK_TOOLS_PATH=`pwd`/BaseTools
+source edksetup.sh BaseTools
+
+
+build -p "$WORKSPACE/edk2-platforms/Platform/NXP/$1$PKG/$1$PKG.dsc" -a $ARCH 
-t $TARGET_TOOLS -b $2
-- 
1.9.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to