[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] Revised toolchain buildscript



Here's a revised version of the toolchain build script. I neglected to
mention before, but this is built on a RH8.0 P4 machine. Also, the
script assumes that it's being run from the directory that the sources
have been extraced into (e.g. tar -xzvf gnu_src.tar.gz; ./build-mbgcc).
The env vars HEADERDIR and RELDIR may be defined via export or on the
commandline with build-mbgcc and determine the location of the headers
and the install directory respectively. The headers must be taken from
your EDK installation directory under
EDK/gnu/microblaze/nt/microblaze/include/*. Be sure to get all of the
subdirectories, too. If HEADERDIR is not declared, build-mbgcc assumes
it is in mb-gcc-headers/. If RELDIR is not declared, build-mbgcc assumes
it is reldir/. 

Comments criticisms are welcome. If not using the MIME attachment, watch
for line wraps!!!

Brett

-- CUT HERE --

#!/bin/sh

# Routine to handle building GNU newlib

build_libs() {
    echo -n $"Building libs"
    cd ${EDKSRC}/newlib/microblaze
    
         # first we build libc and libm.
         # there are 4 combinations for various combos of hard and soft
         # multipliers and barrel shifters
         # Make the soft-mult, soft-shift versions
    make clean
    make EXTRA_CFLAGS="-mxl-soft-mul" MULT=_soft
    
         # Make the soft-mult, hard-shift versions
    make clean
    make EXTRA_CFLAGS="-mxl-soft-mul -mxl-barrel-shift" MULT=_soft
SHIFT=_shift
    
         # Make the hard-mult, hard-shift versions
    make clean
    make EXTRA_CFLAGS="-mno-xl-soft-mul" MULT=_hard
    
         # Make the hard-mult, hard-shift versions
    make clean
    make EXTRA_CFLAGS="-mno-xl-soft-mul -mxl-barrel-shift" MULT=_hard
SHIFT=_shift
         # copy the libc_XX.a and libm_XX.a to where they belong
    cp libc_*.a libm_*.a ${RELDIR}/microblaze/lib
    cp libc_soft.a ${RELDIR}/microblaze/lib/libc.a
    cp libm_soft.a ${RELDIR}/microblaze/lib/libm.a
    
         # copy the C runtime startup libraries
    cp libgloss/microblaze/crt*.o ${RELDIR}/microblaze/lib
}

# turn on debugging
set -x

# set up directories
# where is the source
export EDKSRC=`pwd`
# release (target) directory
if [ ! $RELDIR ] 
then
export RELDIR=${EDKSRC}/reldir
fi
# where can we copy existing header files from?
if [ ! $HEADERDIR ] 
then
export HEADERDIR=${EDKSRC}/mb-gcc-headers
fi

# make release directory
mkdir -p ${RELDIR}

# first build binutils:
cd ${EDKSRC}/binutils/microblaze
# build in a different directory than the sources 
# - easy to make clean distribution
mkdir build
cd build
../configure --target=microblaze --prefix=${RELDIR}
make all CFLAGS="-O2 -g -DMICROBLAZE -DEDK" CXXFLAGS="-O2 -g
-DMICROBLAZE -DEDK"
make install

# link microblaze-as to mb-as
ln ${RELDIR}/bin/microblaze-as ${RELDIR}/bin/mb-as 
ln ${RELDIR}/bin/microblaze-ld ${RELDIR}/bin/mb-ld 
ln ${RELDIR}/bin/microblaze-ar ${RELDIR}/bin/mb-ar 
ln ${RELDIR}/bin/microblaze-ranlib ${RELDIR}/bin/mb-ranlib 
ln ${RELDIR}/bin/microblaze-nm ${RELDIR}/bin/mb-nm

# add newly created binutils to the path
export PATH=${PATH}:${RELDIR}/bin/

# copy header files from install directory into new release directory
if [ ! -d ${RELDIR}/microblaze/include/ ]
then
    mkdir -p ${RELDIR}/microblaze/include/
fi
cp -R ${HEADERDIR}/* ${RELDIR}/microblaze/include/

# Now build gcc
cd ${EDKSRC}/gcc
# keep object files in differnt directory to avoid strange errors
mkdir build
cd build
../configure --target=microblaze --prefix=${RELDIR}
make all CFLAGS="-O2 -g -DMICROBLAZE -DEDK" CXXFLAGS="-O2 -g
-DMICROBLAZE -DEDK"
make install

ln ${RELDIR}/bin/microblaze-gcc ${RELDIR}/bin/mb-gcc 

build_libs

-- CUT HERE --

 
#!/bin/sh

# Routine to handle building GNU newlib

build_libs() {
    echo -n $"Building libs"
    cd ${EDKSRC}/newlib/microblaze
    
         # first we build libc and libm.
         # there are 4 combinations for various combos of hard and soft
         # multipliers and barrel shifters
         # Make the soft-mult, soft-shift versions
    make clean
    make EXTRA_CFLAGS="-mxl-soft-mul" MULT=_soft
    
         # Make the soft-mult, hard-shift versions
    make clean
    make EXTRA_CFLAGS="-mxl-soft-mul -mxl-barrel-shift" MULT=_soft SHIFT=_shift
    
         # Make the hard-mult, hard-shift versions
    make clean
    make EXTRA_CFLAGS="-mno-xl-soft-mul" MULT=_hard
    
         # Make the hard-mult, hard-shift versions
    make clean
    make EXTRA_CFLAGS="-mno-xl-soft-mul -mxl-barrel-shift" MULT=_hard SHIFT=_shift
         # copy the libc_XX.a and libm_XX.a to where they belong
    cp libc_*.a libm_*.a ${RELDIR}/microblaze/lib
    cp libc_soft.a ${RELDIR}/microblaze/lib/libc.a
    cp libm_soft.a ${RELDIR}/microblaze/lib/libm.a
    
         # copy the C runtime startup libraries
    cp libgloss/microblaze/crt*.o ${RELDIR}/microblaze/lib
}

# turn on debugging
set -x

# set up directories
# where is the source
export EDKSRC=`pwd`
# release (target) directory
if [ ! $RELDIR ] 
then
export RELDIR=${EDKSRC}/reldir
fi
# where can we copy existing header files from?
if [ ! $HEADERDIR ] 
then
export HEADERDIR=${EDKSRC}/mb-gcc-headers
fi

# make release directory
mkdir -p ${RELDIR}

# first build binutils:
cd ${EDKSRC}/binutils/microblaze
# build in a different directory than the sources 
# - easy to make clean distribution
mkdir build
cd build
../configure --target=microblaze --prefix=${RELDIR}
make all CFLAGS="-O2 -g -DMICROBLAZE -DEDK" CXXFLAGS="-O2 -g -DMICROBLAZE -DEDK"
make install

# link microblaze-as to mb-as
ln ${RELDIR}/bin/microblaze-as ${RELDIR}/bin/mb-as 
ln ${RELDIR}/bin/microblaze-ld ${RELDIR}/bin/mb-ld 
ln ${RELDIR}/bin/microblaze-ar ${RELDIR}/bin/mb-ar 
ln ${RELDIR}/bin/microblaze-ranlib ${RELDIR}/bin/mb-ranlib 
ln ${RELDIR}/bin/microblaze-nm ${RELDIR}/bin/mb-nm

# add newly created binutils to the path
export PATH=${PATH}:${RELDIR}/bin/

# copy header files from install directory into new release directory
if [ ! -d ${RELDIR}/microblaze/include/ ]
then
    mkdir -p ${RELDIR}/microblaze/include/
fi
cp -R ${HEADERDIR}/* ${RELDIR}/microblaze/include/

# Now build gcc
cd ${EDKSRC}/gcc
# keep object files in differnt directory to avoid strange errors
mkdir build
cd build
../configure --target=microblaze --prefix=${RELDIR}
make all CFLAGS="-O2 -g -DMICROBLAZE -DEDK" CXXFLAGS="-O2 -g -DMICROBLAZE -DEDK"
make install

ln ${RELDIR}/bin/microblaze-gcc ${RELDIR}/bin/mb-gcc 

build_libs