Skip to content

Instantly share code, notes, and snippets.

@Lochnair
Forked from fgrep/wheezy-mips-toolchain
Last active March 4, 2017 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Lochnair/be686740ec34e66022478597e772e192 to your computer and use it in GitHub Desktop.
Save Lochnair/be686740ec34e66022478597e772e192 to your computer and use it in GitHub Desktop.
Debian wheezy mips(el) toolchain
#!/bin/sh
# Debian 7 MIPS Toolchain
ARCH=${ARCH:-mips}
# Update
mkdir /usr/src/$ARCH-toolchain && cd /usr/src/$ARCH-toolchain
apt-get update
apt-get upgrade
# Binutils
apt-get -y build-dep --no-install-recommends binutils
apt-get source binutils
pushd binutils-2.*/
DEB_TARGET_ARCH=$ARCH TARGET=$ARCH dpkg-buildpackage -b
popd
dpkg -i binutils-$ARCH*.deb
# GCC
apt-get -y build-dep --no-install-recommends gcc-4.7
apt-get source gcc-4.7
pushd gcc-4.7-4.7.*/
DEB_TARGET_ARCH=$ARCH DEB_CROSS_NO_BIARCH=yes with_deps_on_target_arch_pkgs=yes dpkg-buildpackage -d -T control
apt-get -y install --no-install-recommends xapt binutils-multiarch
xapt -a $ARCH -m libc6-dev
DEB_TARGET_ARCH=$ARCH DEB_CROSS_NO_BIARCH=yes with_deps_on_target_arch_pkgs=yes dpkg-buildpackage -b
popd
dpkg -i *.deb
ln -s /usr/bin/$ARCH-linux-gnu-cpp-4.7 /usr/bin/$ARCH-linux-gnu-cpp
ln -s /usr/bin/$ARCH-linux-gnu-gcc-ar-4.7 /usr/bin/$ARCH-linux-gnu-gcc-ar
ln -s /usr/bin/$ARCH-linux-gnu-gcc-ranlib-4.7 /usr/bin/$ARCH-linux-gnu-gcc-ranlib
ln -s /usr/bin/$ARCH-linux-gnu-g++-4.7 /usr/bin/$ARCH-linux-gnu-g++
ln -s /usr/bin/$ARCH-linux-gnu-gccgo-4.7 /usr/bin/$ARCH-linux-gnu-gccgo
ln -s /usr/bin/$ARCH-linux-gnu-gcov-4.7 /usr/bin/$ARCH-linux-gnu-gcov
ln -s /usr/bin/$ARCH-linux-gnu-gcc-4.7 /usr/bin/$ARCH-linux-gnu-gcc
ln -s /usr/bin/$ARCH-linux-gnu-gcc-nm-4.7 /usr/bin/$ARCH-linux-gnu-gcc-nm
ln -s /usr/bin/$ARCH-linux-gnu-gfortran-4.7 /usr/bin/$ARCH-linux-gnu-gfortran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment