OpenSprinkler Forums OpenSprinkler Unified Firmware Error building firmware from source Reply To: Error building firmware from source

#69362

Water_my_lawn
Participant

I wrote a script that does the download and necessary fixups.
Make a build directory and run this script from there.
Here it is:

—————————————————–

#!/bin/bash

# This script downloads all of the source code necessary to build
# the OpenSprinkler binary for the 3.0 hardware.
# The script fixes a few places in the source downloads that are
# needed before it will compile cleanly.
# Finally it runs the make command.
# This can be run in any directory and will set a local $HOME
# This runs in Linux.

# Remove any previous installation. You may or may not want to do this!
rm -rf Arduino esp8266_2.5.2 OpenSprinkler-Firmware

# Create a local $HOME foe installation and build.
export HOME=pwd

# Get the OpenSprinkler code.
# Puts it in ~/OpenSprinkler-Firmware
git clone https://github.com/OpenSprinkler/OpenSprinkler-Firmware.git

# Get the Arduino code.
# Puts it in ~/esp8266_2.5.2
git clone https://github.com/esp8266/Arduino.git esp8266_2.5.2

# Go into esp8266_2.5.2 and checkout the correct version.
cd ~/esp8266_2.5.2
git checkout tags/2.5.2

# If necessary, install Python.
# sudo apt install python

# This Perl script installs the xtensa compiler and tools.
cd ~/esp8266_2.5.2/tools
python get.py

# Go back up the base level.
#cd

# Install necessary libraries, including SSD1306, RCSwitch, and UIPEthernet.
# Download and unzip or git clone these into Arduino/libraries folder.
mkdir -p ~/Arduino/libraries
cd ~/Arduino/libraries

# Get the library for the OLED display.
git clone https://github.com/ThingPulse/esp8266-oled-ssd1306.git

# The latest version of the OLED code is not compatable, backup to 4.1.0
cd ~/Arduino/libraries/esp8266-oled-ssd1306
git checkout tags/4.1.0

cd ~/Arduino/libraries

# Get some of the necessary pieces.
git clone https://github.com/sui77/rc-switch.git
git clone https://github.com/UIPEthernet/UIPEthernet.git
git clone https://github.com/knolleary/pubsubclient.git

# Remove tests directory as it will not compile but is unnecessary.
rm -rf ~/Arduino/libraries/pubsubclient/tests

# Go into the actual build location
cd ~/OpenSprinkler-Firmware

# There is an fixup needed in make.lin32:
# This changes the OLED library to the correct one.
sed -i s+Arduino/libraries/SSD1306+Arduino/libraries/esp8266-oled-ssd1306+ make.lin32

# And finally build the final OpenSprinkler binary.
make -f make.lin32

echo “**********************************************************”
echo ‘To build in a directory other than your normal $HOME directory’
echo ‘run this command to set a local $HOME directory to your current directory:’
echo ‘ export HOME=pwd
echo “Next go into the build directory.”
echo ” cd ~/OpenSprinkler-Firmware”
echo “Then run this command to build the binary:”
echo ” make -f make.lin32″
echo “**********************************************************”