Created
January 18, 2016 16:40
-
-
Save Juppit/2cc0b9a340f1c8fbfd39 to your computer and use it in GitHub Desktop.
Crosstool-NG Script for ESP32 and ESP8266
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Peter Dobler (@Juppit) | |
# e-Mail: esp8266-mail@t-online.de | |
# Last edit: 18/01/2016 | |
# | |
DO_INSTALL=1 | |
DO_CONFIG=1 | |
DO_BUILD=1 | |
PROJ_ROOT=$PWD | |
PROJ=crosstool-NG | |
# used for jcmvbkbc/crosstool-NG | |
# also for pfalcon/esp-open-sdk crosstool part | |
BRANCH=lx106-g++-1.21.0 | |
TARGET=xtensa-lx106-elf | |
# for ESP32 | |
BRANCH=esp108-1.21.0 | |
TARGET=xtensa-esp108-elf | |
function pause(){ | |
read -p "Press [Enter] to $*..." KEY | |
if [ $KEY ]; then | |
echo "script exit." | |
exit 1; | |
fi | |
} | |
cd $HOME | |
if [ $DO_INSTALL -gt 0 ]; then | |
if [ ! -f /bin/apt-cyg ]; then | |
echo "installing apt-cyg..." | |
echo "=====================" | |
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg | |
install apt-cyg /bin | |
rm apt-cyg | |
fi | |
fi | |
if [ $DO_INSTALL -gt 0 ]; then | |
apt-cyg install nano wget zip unzip rsync git > /dev/null | |
apt-cyg install autoconf gperf bison flex patch make automake > /dev/null | |
apt-cyg install texinfo libtool wget gawk libncursres-devel libintl-devel > /dev/null | |
apt-cyg install cygwin32-ncurses expat libexpat-devel > /dev/null | |
apt-cyg install ncurses gcc-g++ > /dev/null | |
# needed for xtensa-1.22x | |
apt-cyg install help2man > /dev/null | |
fi | |
if ! cd $PROJ_ROOT; then | |
mkdir -p $PROJ_ROOT | |
else | |
cd $PROJ_ROOT | |
fi | |
echo | |
echo "get $PROJ_ROOT/$PROJ.git..." | |
echo "================================" | |
if cd $PROJ > /dev/null 2>&1; then | |
git pull; | |
else | |
git clone --depth 1 -b $BRANCH git://github.com/jcmvbkbc/crosstool-NG.git | |
cd $PROJ; | |
patch -p1 < ../crosstool-NG.patch | |
# undo by e.g.: git checkout branch kconfig/Makefile | |
fi | |
if [ -f $PWD/builds/$TARGET/build.log.bz2 ]; then | |
echo | |
echo "builds/$TARGET/build.log.bz2 already exist" | |
echo "===================================================" | |
fi | |
echo | |
echo "start config..." | |
echo "===============" | |
if [ $DO_CONFIG -gt 0 ]; then | |
./bootstrap && ./configure --prefix=`pwd` | |
make && make install | |
./ct-ng $TARGET | |
fi | |
if [ $DO_BUILD -gt 0 ]; then | |
echo | |
echo "start build now..." | |
echo "==================" | |
pause 'start' | |
if [ $KEY ]; then exit 1; fi | |
./ct-ng build | |
chmod -R u+w $PROJ_ROOT/builds/$TARGET | |
fi | |
echo Remember to set PATH=$PROJ_ROOT/builds/$TARGET/bin:'$PATH' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment