mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
136 lines
3.3 KiB
Bash
Executable File
136 lines
3.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
VERSION=$(git describe)
|
|
TMP_DIST=`mktemp -d`
|
|
CURPATH=`pwd`
|
|
|
|
# PIO 3.x :
|
|
# BINARY_PATH=".pioenvs"
|
|
|
|
# PIO 4.0 and newer:
|
|
BINARY_PATH=".pio/build"
|
|
|
|
while getopts d: option
|
|
do
|
|
case "${option}"
|
|
in
|
|
d) VERSION=${OPTARG};;
|
|
esac
|
|
done
|
|
|
|
|
|
if [ ! -d ${TMP_DIST} ]; then
|
|
# Could not create temp dir, so exit
|
|
exit 1
|
|
fi
|
|
|
|
#Naming convention:
|
|
# ESP_Easy_[github version]_[plugin set]_[chip type]_[flash memory].bin
|
|
|
|
mkdir -p ${TMP_DIST}
|
|
cp -r dist/* ${TMP_DIST}/
|
|
|
|
if [ -d "docs/build" ]; then
|
|
# Docs have been created
|
|
mkdir -p ${TMP_DIST}/docs
|
|
cp -r docs/build/* ${TMP_DIST}/docs/
|
|
fi
|
|
|
|
mkdir -p ${TMP_DIST}/memstats
|
|
|
|
for ENV in \
|
|
custom_ESP8266_4M1M\
|
|
dev_ESP8266_4M1M\
|
|
esp-wrover-kit_test_1M8_partition\
|
|
esp32test_1M8_partition\
|
|
hard_SONOFF_POW_4M1M\
|
|
hard_Ventus_W266\
|
|
hard_core_252_SONOFF_POW_4M1M\
|
|
hard_core_252_Shelly_1_2M256\
|
|
hard_core_252_other_POW_ESP8285_1M\
|
|
hard_other_POW_ESP8285_1M\
|
|
minimal_IRext_ESP8266_1M\
|
|
minimal_IRext_ESP8266_4M1M\
|
|
minimal_IRext_ESP8266_4M2M\
|
|
normal_IRext_no_rx_ESP8266_4M2M\
|
|
minimal_core_242_ESP8266_1M_OTA\
|
|
minimal_core_242_ESP8285_1M_OTA\
|
|
minimal_core_252_ESP8266_1M_OTA\
|
|
minimal_core_252_ESP8285_1M_OTA\
|
|
normal_ESP8266_1M\
|
|
normal_ESP8266_1M_VCC\
|
|
normal_ESP8266_4M1M\
|
|
normal_ESP8285_1M\
|
|
normal_WROOM02_2M\
|
|
normal_core_241_ESP8266_1M\
|
|
normal_core_241_ESP8266_4M1M\
|
|
normal_core_242_ESP8266_1M\
|
|
normal_core_252_ESP8266_16M\
|
|
normal_core_252_ESP8266_1M\
|
|
normal_core_252_ESP8266_4M1M\
|
|
normal_core_252_WROOM02_2M256\
|
|
normal_core_260_sdk222_alpha_ESP8266_16M\
|
|
normal_core_260_sdk222_alpha_ESP8266_4M1M\
|
|
test_ESP8266_4M_VCC\
|
|
test_core_242_ESP8266_4M1M\
|
|
test_core_252_ESP8266_16M\
|
|
test_core_252_ESP8266_4M1M\
|
|
test_core_260_sdk222_alpha_ESP8266_16M\
|
|
test_core_260_sdk222_alpha_ESP8266_4M1M\
|
|
test_core_260_sdk3_alpha_ESP8266_16M\
|
|
test_core_260_sdk3_alpha_ESP8266_4M1M;\
|
|
do
|
|
MAX_FILESIZE=1044464
|
|
if [[ ${ENV} == *"1M"* ]]; then
|
|
# max 871 kiB
|
|
MAX_FILESIZE=892912
|
|
fi
|
|
if [[ ${ENV} == *"1M_OTA"* ]]; then
|
|
# max 602 kiB
|
|
MAX_FILESIZE=616448
|
|
fi
|
|
if [[ ${ENV} == *"esp32"* ]]; then
|
|
MAX_FILESIZE=1310720
|
|
fi
|
|
if [[ ${ENV} == *"1M8_partition"* ]]; then
|
|
MAX_FILESIZE=1900544
|
|
fi
|
|
|
|
FILESIZE=$(stat -c%s ${BINARY_PATH}/${ENV}/firmware.bin )
|
|
if (( FILESIZE < MAX_FILESIZE )); then
|
|
echo
|
|
echo "### Deploying environment $ENV for version $VERSION"
|
|
BIN=${BINARY_PATH}/${ENV}/ESP_Easy_${VERSION}_${ENV}.bin
|
|
cp ${BINARY_PATH}/${ENV}/firmware.bin $BIN
|
|
python2 crc2.py $BIN
|
|
mv $BIN "${TMP_DIST}/bin/ESP_Easy_${VERSION}_${ENV}.bin"
|
|
else
|
|
echo "Build too large for $ENV $FILESIZE > $MAX_FILESIZE "
|
|
fi
|
|
|
|
ELFFILE=`echo "${BINARY_PATH}/${ENV}/firmware.elf"`
|
|
if [ -f $ELFFILE ]; then
|
|
SYMBOLS_STATS=`echo "${TMP_DIST}/memstats/symbols_${ENV}.txt"`
|
|
STRINGS_STATS=`echo "${TMP_DIST}/memstats/strings_${ENV}.txt"`
|
|
readelf -a ${ELFFILE} |grep 3ff |sort -n -k 3 > ${SYMBOLS_STATS}
|
|
objdump -s -j .rodata ${ELFFILE} > ${STRINGS_STATS}
|
|
fi
|
|
done
|
|
|
|
#create a source structure that is the same as the original ESPEasy project (and works with the howto on the wiki)
|
|
#rm -rf dist/Source 2>/dev/null
|
|
|
|
mkdir -p ${TMP_DIST}/source
|
|
cp -r lib ${TMP_DIST}/source/
|
|
cp -r src ${TMP_DIST}/source/
|
|
cp platformio.ini ${TMP_DIST}/source/
|
|
|
|
cd ${TMP_DIST}
|
|
|
|
echo
|
|
echo "### Creating zip archive"
|
|
zip ${CURPATH}/ESPEasy_$VERSION.zip -r .
|
|
|
|
rm -Rf ${TMP_DIST}/* 2>/dev/null
|
|
rmdir ${TMP_DIST}
|