On 21 March 2014 13:58, Leif Lindholm <leif.lindholm@linaro.org> wrote:
Hi Ryan,

I like it.
But it could be simplified a bit - and I would prefer for the "don't
recognise this" to be to try with the latest version.

So, could you do something like:
---
if [ "$TOOLCHAIN" == "" ]; then
        gcc_version=$(gcc -dumpversion)
        case $gcc_version in
                4.6|4.7|4.8)
                        export TOOLCHAIN=GCC$(echo ${gcc_version} | sed s-\\.--g)
                ;;
                *)
                        echo "Unknown toolchain version '$gcc_version'" >&2
                        echo "Attempting to build using GCC48 profile." >&2
                        export TOOLCHAIN=GCC48
                ;;
        esac

        export ${TOOLCHAIN}_ARM_PREFIX=$CROSS_COMPILE
        export ${TOOLCHAIN}_AARCH64_PREFIX=$CROSS_COMPILE
fi
---
?

Looks good to me.  I'll test it and submit it.

 

For the output directory name, I agree it is annoying, but the thing
to keep in mind is that it is not changing because of compiler version
used - it is changing because of build profile used.
Hence this is a problem that would go away if we could switch to using
just a plain GCC target.

True.  I'm just impatient ;-)



Regards,

Leif

On Fri, Mar 21, 2014 at 11:08:26AM +0000, Ryan Harkin wrote:
> Hi Leif,
>
> So, speaking to Olivier yesterday, I worked out what he meant about using GCC48
> these days.  I've taken his ideas and added them to the uefi-build.sh script
> locally and tested them.  Patch below.
>
> You mentioned that you'd rather just use "GCC".  Generally, I agree with you. 
> The definitions for GCC44 through to GCC48 are currently the same anyway. 
> However, there are no definitions for plain old GCC, so tools_def.template
> would need hacking again.
>
> In the meantime, with the absence of GCC hacks, do you see any problems with my
> patch?
>
> Olivier,
>
> One big problem I see with the differing toolchains is that the output dir
> changes every time I build with a different toolchain.  I can't really see an
> advantage to having different sub-dirs for each toolchain.  I really don't
> believe we'll build the same BSP with more than one toolchain without cleaning
> the repo first.  At least, I reckon you'd be mad to to not clean first ;-)
>
> Do you see a use-case for having the toolchain naming in the output dir name? 
> If not, how on earth would we hack the codebase so it just outputs to DEBUG/
> RELEASE instead?
>
> Cheers,
> Ryan.
>
> ------------------------------------------------------------
> [PATCH] uefi-build: update TOOLCHAIN configuration
>
> Using ARMGCC vs ARMLINUXGCC causes various problems.
>
> Switching to GCC4x causes other problems, but seems cleaner than either
> of the previous two options.
>
> Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
> ---
>  uefi-build.sh | 31 ++++++++++++++++++++++++++++---
>  1 file changed, 28 insertions(+), 3 deletions(-)
>
> diff --git a/uefi-build.sh b/uefi-build.sh
> index f376496..5cf38ca 100755
> --- a/uefi-build.sh
> +++ b/uefi-build.sh
> @@ -81,15 +81,41 @@ function build_platform
>                 TARGETS=( RELEASE )
>         fi
>
> +       if [ "$TOOLCHAIN" == "" ]; then
> +               gcc_version=$(${CROSS_COMPILE}gcc -v 2>&1 | tail -1 | awk '
> {print $3}')
> +               case $gcc_version in
> +               4.6.*)
> +                       export TOOLCHAIN=GCC46
> +                       export GCC46_ARM_PREFIX=$CROSS_COMPILE
> +                       export GCC46_AARCH64_PREFIX=$CROSS_COMPILE
> +                       ;;
> +               4.7.*)
> +                       export TOOLCHAIN=GCC47
> +                       export GCC47_ARM_PREFIX=$CROSS_COMPILE
> +                       export GCC47_AARCH64_PREFIX=$CROSS_COMPILE
> +                       ;;
> +               4.[8-9].*)
> +                       export TOOLCHAIN=GCC48
> +                       export GCC48_ARM_PREFIX=$CROSS_COMPILE
> +                       export GCC48_AARCH64_PREFIX=$CROSS_COMPILE
> +                       ;;
> +               *)
> +                       echo "Unsupported toolchain"
> +                       exit 1
> +                       ;;
> +               esac
> +       fi
> +       echo "TOOLCHAIN=$TOOLCHAIN"
> +
>         for target in "${TARGETS[@]}" ; do
>                 if [ X"$PLATFORM_PREBUILD_CMDS" != X"" ]; then
>                         echo "Run pre build commands"
>                         eval ${PLATFORM_PREBUILD_CMDS}
>                 fi
>                 if [ X"$PLATFORM_BUILDCMD" == X"" ]; then
> -                       echo CROSS_COMPILE="$TEMP_CROSS_COMPILE" build -a
> "$PLATFORM_ARCH" -t ARMGCC -p "$PLATFORM_DSC" -b "$target" \
> +                       echo CROSS_COMPILE="$TEMP_CROSS_COMPILE" build -a
> "$PLATFORM_ARCH" -t ${TOOLCHAIN} -p "$PLATFORM_DSC" -b "$target" \
>                                 ${PLATFORM_BUILDFLAGS}
> -                       CROSS_COMPILE="$TEMP_CROSS_COMPILE" build -a
> "$PLATFORM_ARCH" -t ARMGCC -p "$PLATFORM_DSC" -b "$target" \
> +                       CROSS_COMPILE="$TEMP_CROSS_COMPILE" build -a
> "$PLATFORM_ARCH" -t ${TOOLCHAIN} -p "$PLATFORM_DSC" -b "$target" \
>                                 ${PLATFORM_BUILDFLAGS}
>                 else
>                         ${PLATFORM_BUILDCMD} -b "$target" $
> {PLATFORM_BUILDFLAGS}
> @@ -115,7 +141,6 @@ function uefishell
>         esac
>         export ARCH
>         echo "Setting up shell for building UEFI"
> -       export TOOLCHAIN=ARMGCC
>         export EDK_TOOLS_PATH=`pwd`/BaseTools
>         . edksetup.sh BaseTools
>         make -C $EDK_TOOLS_PATH
> --
> 1.8.3.2
>
>