X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-redboot.git;a=blobdiff_plain;f=build.sh;h=eca1640393ba18c56fe33e9c06aaf3569834b148;hp=e258acc4f290e5163057ff5a93ca4ccfee230e66;hb=5273591ca49be7a94eea6f7fc3d9eef279433ed2;hpb=7a4ea0a4d67744fd3f6b5f207d857005fc707b46 diff --git a/build.sh b/build.sh index e258acc4..eca16403 100644 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ -#!/bin/sh -options="cnqrR" +#!/bin/bash +options="cnqrRp:" release=false tools_dir="$PWD/tools/bin" ecosconfig="$tools_dir/tools/configtool/standalone/common/ecosconfig" @@ -9,18 +9,19 @@ clean=false rebuild=false doit=true make_opts= - -cmd_prefix=${CROSS_COMPILE-arm-926ejs-linux-gnu-} +pattern="*" error() { + rc=$? if [ -n "${target}" ];then echo "${target} build aborted" fi + return $rc } build_host_tools() { echo "Building host tools in $tools_dir" - + # Debian packages tcl-dev and tk-dev are required for this build local wd="$PWD" local tcldirs="/usr/lib/tcl /usr/local/lib/tcl" local config_opts="" @@ -32,6 +33,7 @@ build_host_tools() { done if [ -z "$config_opts" ];then for d in /usr/lib/tcl*;do + [ -d "$d" ] || continue config_opts="$config_opts --with-tcl-version=${d##*tcl}" done fi @@ -40,6 +42,7 @@ build_host_tools() { exit 1 fi + export TCL_INC_DIR="$(. /usr/lib/tclConfig.sh; echo $TCL_INCLUDE_SPEC | sed 's/^-I//')" mkdir -p "$tools_dir" cd "$tools_dir" sh ../src/configure $config_opts @@ -47,10 +50,6 @@ build_host_tools() { cd "$wd" } -if [ `uname -s` = Linux ];then - PATH="/usr/local/arm/cross-gcc-4.2.0/i686-pc-linux-gnu/bin:$PATH" -fi - while getopts "$options" opt;do case $opt in c) @@ -60,6 +59,9 @@ while getopts "$options" opt;do doit=false make_opts="${make_opts} -n" ;; + p) + pattern="$OPTARG" + ;; q) quiet=true ;; @@ -82,7 +84,7 @@ shift $(($OPTIND - 1)) if [ $# -gt 0 ];then targets="$@" else - targets=$(cd config; ls *.ecc) + targets=$(cd config;ls $pattern.ecc) fi set -e @@ -146,20 +148,18 @@ for target in ${targets};do if $clean;then $quiet || echo "Cleaning up build tree for ${target}" - make ${make_opts} COMMAND_PREFIX=${cmd_prefix} clean + make ${make_opts} clean fi $quiet || echo "Compiling ${target}" [ -d "${build_dir}" ] - make -C "${build_dir}" COMMAND_PREFIX=${cmd_prefix} ${make_opts} + make -C "${build_dir}" ${make_opts} cd $wd if $doit && [ -s "${inst_dir}/bin/redboot.elf" ];then bootstrap_addr="$(${cmd_prefix}nm "${inst_dir}/bin/redboot.elf" \ | sed '/Now_in_SDRAM/!d;s/ .*$//')" - if ! echo "$bootstrap_addr" | grep -i '^[0-9a-f]\{4\}0[0-7]';then -# if ! ${cmd_prefix}nm "${inst_dir}/bin/redboot.elf" \ -# | grep 'Now_in_SDRAM' | grep -i '^[0-9a-f]\{4\}0[0-7]';then + if [ -n "$bootstrap_addr" ] && ! echo "$bootstrap_addr" | grep -i '^[0-9a-f]\{4\}0[0-7]';then echo "ERROR: Bootstrap does not fit into first NAND page!" echo $bootstrap_addr exit 1