<p>Vadim Yanitskiy has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/14008">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">target/toolchain: initial import of the build script<br><br>Change-Id: Ia3544bb9eb9276762e17e3780272610d5dba15c4<br>---<br>A src/target/toolchain/gnu-arm-build.3.sh<br>1 file changed, 169 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/08/14008/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/target/toolchain/gnu-arm-build.3.sh b/src/target/toolchain/gnu-arm-build.3.sh</span><br><span>new file mode 100755</span><br><span>index 0000000..39bdc85</span><br><span>--- /dev/null</span><br><span>+++ b/src/target/toolchain/gnu-arm-build.3.sh</span><br><span>@@ -0,0 +1,169 @@</span><br><span style="color: hsl(120, 100%, 40%);">+#!/bin/sh</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ROOT=`pwd`</span><br><span style="color: hsl(120, 100%, 40%);">+SRCDIR=$ROOT/src</span><br><span style="color: hsl(120, 100%, 40%);">+BUILDDIR=$ROOT/build</span><br><span style="color: hsl(120, 100%, 40%);">+PREFIX=$ROOT/install</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+GCC_SRC=gcc-4.8.2.tar.bz2</span><br><span style="color: hsl(120, 100%, 40%);">+GCC_VERSION=4.8.2</span><br><span style="color: hsl(120, 100%, 40%);">+GCC_DIR=gcc-$GCC_VERSION</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+BINUTILS_SRC=binutils-2.21.1a.tar.bz2</span><br><span style="color: hsl(120, 100%, 40%);">+BINUTILS_VERSION=2.21.1</span><br><span style="color: hsl(120, 100%, 40%);">+BINUTILS_DIR=binutils-$BINUTILS_VERSION</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+NEWLIB_SRC=newlib-1.19.0.tar.gz</span><br><span style="color: hsl(120, 100%, 40%);">+NEWLIB_VERSION=1.19.0</span><br><span style="color: hsl(120, 100%, 40%);">+NEWLIB_DIR=newlib-$NEWLIB_VERSION</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+TARGET_TRIPLET=arm-none-eabi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#INSIGHT_SRC=insight-6.8-1.tar.bz2</span><br><span style="color: hsl(120, 100%, 40%);">+#INSIGHT_VERSION=6.8-1</span><br><span style="color: hsl(120, 100%, 40%);">+#INSIGHT_DIR=insight-$INSIGHT_VERSION</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+echo "I will build an $TARGET_TRIPLET cross-compiler:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  Prefix: $PREFIX</span><br><span style="color: hsl(120, 100%, 40%);">+  Sources: $SRCDIR</span><br><span style="color: hsl(120, 100%, 40%);">+  Build files: $BUILDDIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Press ^C now if you do NOT want to do this."</span><br><span style="color: hsl(120, 100%, 40%);">+read IGNORE</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Helper functions.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+unpack_source()</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+(</span><br><span style="color: hsl(120, 100%, 40%);">+    cd $SRCDIR</span><br><span style="color: hsl(120, 100%, 40%);">+    ARCHIVE_SUFFIX=${1##*.}</span><br><span style="color: hsl(120, 100%, 40%);">+    if [ "$ARCHIVE_SUFFIX" = "gz" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+      tar zxvf $1</span><br><span style="color: hsl(120, 100%, 40%);">+    elif [ "$ARCHIVE_SUFFIX" = "bz2" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+      tar jxvf $1</span><br><span style="color: hsl(120, 100%, 40%);">+    else</span><br><span style="color: hsl(120, 100%, 40%);">+      echo "Unknown archive format for $1"</span><br><span style="color: hsl(120, 100%, 40%);">+      exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+    fi</span><br><span style="color: hsl(120, 100%, 40%);">+)</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Create all the directories we need.</span><br><span style="color: hsl(120, 100%, 40%);">+#mkdir -p $SRCDIR $BUILDDIR $PREFIX</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+(</span><br><span style="color: hsl(120, 100%, 40%);">+cd $SRCDIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Unpack the sources.</span><br><span style="color: hsl(120, 100%, 40%);">+unpack_source $(basename $GCC_SRC)</span><br><span style="color: hsl(120, 100%, 40%);">+unpack_source $(basename $BINUTILS_SRC)</span><br><span style="color: hsl(120, 100%, 40%);">+unpack_source $(basename $NEWLIB_SRC)</span><br><span style="color: hsl(120, 100%, 40%);">+#unpack_source $(basename $INSIGHT_SRC)</span><br><span style="color: hsl(120, 100%, 40%);">+)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Set the PATH to include the binaries we're going to build.</span><br><span style="color: hsl(120, 100%, 40%);">+OLD_PATH=$PATH</span><br><span style="color: hsl(120, 100%, 40%);">+export PATH=$PREFIX/bin:$PATH</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Stage 1: Build binutils</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+(</span><br><span style="color: hsl(120, 100%, 40%);">+(</span><br><span style="color: hsl(120, 100%, 40%);">+# autoconf check.</span><br><span style="color: hsl(120, 100%, 40%);">+cd $SRCDIR/$BINUTILS_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+) || exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Now, build it.</span><br><span style="color: hsl(120, 100%, 40%);">+mkdir -p $BUILDDIR/$BINUTILS_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+cd $BUILDDIR/$BINUTILS_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+$SRCDIR/$BINUTILS_DIR/configure --target=$TARGET_TRIPLET --prefix=$PREFIX \</span><br><span style="color: hsl(120, 100%, 40%);">+    --enable-interwork --enable-threads=posix --enable-multilib --with-float=soft --disable-werror \</span><br><span style="color: hsl(120, 100%, 40%);">+    && make all install</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+) || exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Stage 2: Patch the GCC multilib rules, then build the gcc compiler only</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+(</span><br><span style="color: hsl(120, 100%, 40%);">+MULTILIB_CONFIG=$SRCDIR/$GCC_DIR/gcc/config/arm/t-$TARGET_TRIPLET</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+echo "</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork</span><br><span style="color: hsl(120, 100%, 40%);">+MULTILIB_DIRNAMES += normal interwork</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+" >> $MULTILIB_CONFIG</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+mkdir -p $BUILDDIR/$GCC_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+cd $BUILDDIR/$GCC_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+$SRCDIR/$GCC_DIR/configure --target=$TARGET_TRIPLET --prefix=$PREFIX \</span><br><span style="color: hsl(120, 100%, 40%);">+    --enable-interwork --enable-multilib --with-float=soft --disable-werror \</span><br><span style="color: hsl(120, 100%, 40%);">+    --enable-languages="c,c++" --with-newlib \</span><br><span style="color: hsl(120, 100%, 40%);">+    --with-headers=$SRCDIR/$NEWLIB_DIR/newlib/libc/include \</span><br><span style="color: hsl(120, 100%, 40%);">+    --with-system-zlib --disable-shared \</span><br><span style="color: hsl(120, 100%, 40%);">+    && make all-gcc install-gcc</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+) || exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Stage 3: Build and install newlib</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+(</span><br><span style="color: hsl(120, 100%, 40%);">+(</span><br><span style="color: hsl(120, 100%, 40%);">+# Same issue, we have to patch to support makeinfo >= 4.11.</span><br><span style="color: hsl(120, 100%, 40%);">+cd $SRCDIR/$NEWLIB_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+) || exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# And now we can build it.</span><br><span style="color: hsl(120, 100%, 40%);">+mkdir -p $BUILDDIR/$NEWLIB_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+cd $BUILDDIR/$NEWLIB_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+$SRCDIR/$NEWLIB_DIR/configure --target=$TARGET_TRIPLET --prefix=$PREFIX \</span><br><span style="color: hsl(120, 100%, 40%);">+    --enable-interwork --enable-multilib --with-float=soft --disable-werror \</span><br><span style="color: hsl(120, 100%, 40%);">+    && make all install</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+) || exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Stage 4: Build and install the rest of GCC.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+(</span><br><span style="color: hsl(120, 100%, 40%);">+cd $BUILDDIR/$GCC_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+make all install</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+) || exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Stage 5: Build and install INSIGHT.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# edit: we currently don't need that for OsmocomBB</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#(</span><br><span style="color: hsl(120, 100%, 40%);">+# Now, build it.</span><br><span style="color: hsl(120, 100%, 40%);">+#mkdir -p $BUILDDIR/$INSIGHT_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#cd $BUILDDIR/$INSIGHT_DIR</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#$SRCDIR/$INSIGHT_DIR/configure --target=$TARGET_TRIPLET --prefix=$PREFIX \</span><br><span style="color: hsl(120, 100%, 40%);">+#    --enable-interwork --enable-multilib --with-float=soft --disable-werror \</span><br><span style="color: hsl(120, 100%, 40%);">+#    && make all install</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#) || exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+export PATH=$OLD_PATH</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+echo "</span><br><span style="color: hsl(120, 100%, 40%);">+Build complete! Add $PREFIX/bin to your PATH to make $TARGET_TRIPLET-gcc and friends</span><br><span style="color: hsl(120, 100%, 40%);">+accessible directly.</span><br><span style="color: hsl(120, 100%, 40%);">+"</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/14008">change 14008</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/14008"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia3544bb9eb9276762e17e3780272610d5dba15c4 </div>
<div style="display:none"> Gerrit-Change-Number: 14008 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>