We need to have a tree where we can build all of the platforms in a
predictable manner, so I am not inclined to take any platform-specific
build helper scripts.

(If a platform that needs some special scripts to post-process the
built image before writing it to a target, that is a different thing.)

What would be really useful here would be a Readme.md listing the
platforms supported, with a brief description, and the location of
their .dsc files (and any option that can be specified on the command
line at build time).

I would be more than happy to add some entries for these platforms to
(the entirely unofficial) uefi-tools set of helper scripts available
from https://git.linaro.org/uefi/uefi-tools.git.

(edk2-build.sh in there supports the same sort of 'figure out which
toolchain profile to use' as these scripts implement)

Also, feel free to add a link to your Readme.md from
https://github.com/tianocore/edk2-platforms#supported-platforms

/
    Leif

On Fri, Feb 16, 2018 at 02:20:05PM +0530, Meenakshi wrote:
> From: Meenakshi Aggarwal <[email protected]>
> 
> 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 <[email protected]>
> Signed-off-by: Wasim Khan <[email protected]>
> ---
>  Platform/NXP/Env.cshrc |  78 +++++++++++++++++++++++++++++++++
>  Platform/NXP/Readme.md |  17 +++++++
>  Platform/NXP/build.sh  | 117 
> +++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 212 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..eb51018
> --- /dev/null
> +++ b/Platform/NXP/Env.cshrc
> @@ -0,0 +1,78 @@
> +#  @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 the edk2-platforms path
> +export PACKAGES_PATH=`dirname \`dirname "$PWD"\``
> diff --git a/Platform/NXP/Readme.md b/Platform/NXP/Readme.md
> new file mode 100644
> index 0000000..94174a7
> --- /dev/null
> +++ b/Platform/NXP/Readme.md
> @@ -0,0 +1,17 @@
> +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. source Env.cshrc
> +
> +2. Build desired board
> +   ./build.sh <SoC-name> <board-type> <build-candidate> <clean> (optional)
> +
> +   Soc-name        : LS1043 / LS1046 / LS2088
> +   board-type      : RDB / QDS
> +   build-candidate : DEBUG / RELEASE
> +
> diff --git a/Platform/NXP/build.sh b/Platform/NXP/build.sh
> new file mode 100755
> index 0000000..eea83ee
> --- /dev/null
> +++ b/Platform/NXP/build.sh
> @@ -0,0 +1,117 @@
> +#!/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): SoC Type (can be LS1043 / LS1046 / LS2088)."
> +    echo "    Arg 2 (mandatory): Board Type (can be RDB / QDS)."
> +    echo "    Arg 3 (mandatory): Build candidate (can be RELEASE or DEBUG). 
> By
> +              default we build the RELEASE candidate."
> +    echo "    Arg 4 (optional): clean - To do a 'make clean' operation."
> +}
> +
> +# Check for total num of input arguments
> +if [[ "$#" -gt 4 ]]; then
> +  echo "Illegal number of parameters"
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for third parameter to be clean only
> +if [[ "$4" && $4 != "clean" ]]; then
> +  echo "Error ! Either clean or emplty"
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for input arguments
> +if [[ $1 == "" || $2 == "" || $3 == "" ]]; then
> +  echo "Error !"
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for input arguments
> +if [[ $1 != "LS1043" && $1 != "LS1046" && $1 != "LS2088" ]]; then
> +  echo "Error ! Incorrect Soc Type specified."
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for input arguments
> +if [[ $2 != "RDB" && $2 != "QDS" ]]; then
> +  echo "Error ! Incorrect Board Type specified."
> +  print_usage_banner
> +  exit
> +fi
> +
> +# Check for input arguments
> +if [[ $3 != "RELEASE" ]]; then
> +  if [[ $3 != "DEBUG" ]]; then
> +    echo "Error ! Incorrect build target specified."
> +    print_usage_banner
> +    exit
> +  fi
> +fi
> +
> +# Set Package drirectory
> +if [[ $2 == "RDB" ]]; then
> +  PKG="aRdbPkg"
> +  if [[ $2 == "QDS" ]]; then
> +    PKG="aQdsPkg"
> +  fi
> +fi
> +
> +echo ".........................................."
> +echo "Welcome to $1$PKG UEFI Build environment"
> +echo ".........................................."
> +
> +if [[ $4 == "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 "$PACKAGES_PATH/Platform/NXP/$1$PKG/$1$PKG.dsc" -a $ARCH -t 
> $TARGET_TOOLS -b $3
> -- 
> 1.9.1
> 
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to