#!/bin/bash # Catch build Error function error { echo "Docker build Failed." exit 1; } cross_compiler_path=$1 delivery_path=$2 echo "Cross Compiler Path: $cross_compiler_path" echo "Delivery Path: $delivery_path" BASE=`$cross_compiler_path/bin/*-*-gcc --version | head -n 1 | cut -d ' ' -f 1 | cut -d '.' -f 1` GCC_VERSION=`$cross_compiler_path/bin/*-*-gcc --version | head -n 1 | cut -d ' ' -f 4` VERSION=`$cross_compiler_path/bin/*-*-gcc --version | head -n 1 | cut -d ' ' -f 3 | cut -d '-' -f 1` LIBC=unknown cat configs/toolchain_defconfig | grep BR2_TOOLCHAIN_BUILDROOT_GLIBC if test $? -eq 0; then LIBC=glibc; fi cat configs/toolchain_defconfig | grep BR2_TOOLCHAIN_BUILDROOT_UCLIBC if test $? -eq 0; then LIBC=uclibc; fi cat configs/toolchain_defconfig | grep BR2_TOOLCHAIN_BUILDROOT_MUSL if test $? -eq 0; then LIBC=musl; fi echo "BASE: $BASE" echo "GCC_VERSION: $GCC_VERSION" echo "VERSION: $VERSION" echo "LIBC: $LIBC" mkdir -p $delivery_path cd $cross_compiler_path tar cvzf $delivery_path/toochain_${BASE}-${GCC_VERSION}-${LIBC}-${VERSION}.tgz .