Skip to content

Instantly share code, notes, and snippets.



Last active Nov 20, 2017
What would you like to do?
Automatically clone and build repositories related to the esp8266 sdk
# Build the esp 8266 open-sdk and related tools in current directory.
# Tested on Ubuntu 16.04.1 and 14.04.4/5.
# It takes up to an hour to build and several GB of space, so be prepared!
# Use it with:
# wget -O && chmod +x && ./
# ToDo: Ask the user when install installing examples or checking for Ubuntu, make a -y option to proceed automatically
lsb_release -d | grep -q Ubuntu || \
{ >&2 echo -e "Error: You need to be on Ubuntu to use this script.\n\nOn compatible systems, you might want to try commenting this check!"; exit 1; }
# On some systems, above line might cause more problems than it solves
# Add sources
test -r "$aptsl" -a -f "$aptsl" && \
sudo cp -b "$aptsl" "$aptsl.backup$(date +%y%m%d)" # backup
sudo apt-add-repository universe
sudo apt-add-repository multiverse
#sudo apt-add-repository "deb $(lsb_release -cs) main restricted"
# Install packages
sudo apt-get update && \
sudo apt-get install -y make unrar autoconf automake libtool gcc g++ gperf flex bison texinfo-doc-nonfree install-info info texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial sed git unzip bash help2man wget bzip2 \
|| exit 1
sudo apt-get install -y libtool-bin # not needed in some Ubuntu versions
# Build esptool-ck
git clone --recursive || exit 1
cd esptool-ck
cd ..
# Build sdk
git clone --recursive || exit 1
cd esp-open-sdk
sed -i 's/^\(\s*VENDOR_SDK\s*=\s*\).*$/\1 1.5.2/' Makefile # Old version of sdk (v1.5.2) before espressif filled the iram
#git checkout e32ff685 # Old version of sdk (v1.5.2) before espressif filled the iram
|| { >&2 echo "pfalcon's Makefile seems to have a problem.\nTry executing make with shells of varying cleanness, i.e. 'env -i bash --norc --noprofile -c ...'\n. Also check shell variables for gcc's library and include paths"; exit 1; }
find . -name "c_types.h" -exec cp "{}" "{}.patched" \;
# Line below fixes a bug, when e32ff685 or other old versions are used
#find -type f -name 'c_types.h.orig' -print0 | while read -d $'\0' f; do cp "$f" "${f%.orig}"; done
cd ..
# Download a few software examples
if echo "$1" | grep -qi "examples"; then
echo "Downloading example projects to '$exdir'..."
mkdir "$exdir"
cd "$exdir"
git clone --recursive
git clone --recursive
git clone --recursive
git clone --recursive
ln -s colorchord/embedded8266 8266colorcord
cd ..
echo "Path to the sdk: $(readlink -f $(pwd))/esp-open-sdk"
echo "We're done!"

This comment has been minimized.

Copy link

@cnlohr cnlohr commented Aug 17, 2016

Should this be posted places like the READMEs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment