2022-01-07 10:29:58 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-02-20 20:49:34 +00:00
|
|
|
|
2020-02-14 22:00:08 +00:00
|
|
|
set -e
|
|
|
|
|
2021-05-09 02:56:28 +00:00
|
|
|
VERSION=`bin/buildinfo.py long`
|
|
|
|
SHORT_VERSION=`bin/buildinfo.py short`
|
2020-02-19 00:18:01 +00:00
|
|
|
|
2022-04-27 17:20:10 +00:00
|
|
|
BOARDS_ESP32="rak11200 tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1 nano-g1"
|
2021-04-16 04:46:21 +00:00
|
|
|
#BOARDS_ESP32=tbeam
|
2020-08-17 19:29:45 +00:00
|
|
|
|
|
|
|
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
|
2022-04-25 05:13:41 +00:00
|
|
|
BOARDS_NRF52="rak4631 rak4631_eink t-echo pca10059_diy_eink"
|
2021-05-26 02:21:26 +00:00
|
|
|
#BOARDS_NRF52=""
|
2020-02-20 20:49:34 +00:00
|
|
|
|
2020-02-24 17:33:41 +00:00
|
|
|
OUTDIR=release/latest
|
|
|
|
|
|
|
|
# We keep all old builds (and their map files in the archive dir)
|
|
|
|
ARCHIVEDIR=release/archive
|
|
|
|
|
|
|
|
rm -f $OUTDIR/firmware*
|
2020-02-20 20:49:34 +00:00
|
|
|
|
2021-02-14 06:14:50 +00:00
|
|
|
mkdir -p $OUTDIR/bins $ARCHIVEDIR
|
2021-04-16 04:34:07 +00:00
|
|
|
rm -r $OUTDIR/bins/* || true
|
2020-10-21 04:48:04 +00:00
|
|
|
mkdir -p $OUTDIR/bins/universal $OUTDIR/elfs/universal
|
2020-03-31 01:51:15 +00:00
|
|
|
|
2020-03-27 23:55:19 +00:00
|
|
|
# build the named environment and copy the bins to the release directory
|
2020-10-21 04:48:04 +00:00
|
|
|
function do_build() {
|
|
|
|
BOARD=$1
|
|
|
|
isNrf=$3
|
|
|
|
|
2022-02-11 02:21:36 +00:00
|
|
|
echo "Building for $BOARD ($isNrf) with $PLATFORMIO_BUILD_FLAGS"
|
2020-08-17 19:29:45 +00:00
|
|
|
rm -f .pio/build/$BOARD/firmware.*
|
2020-04-19 15:33:59 +00:00
|
|
|
|
|
|
|
# The shell vars the build tool expects to find
|
|
|
|
export APP_VERSION=$VERSION
|
2020-10-21 04:48:04 +00:00
|
|
|
|
2021-03-14 02:13:28 +00:00
|
|
|
basename=universal/firmware-$BOARD-$VERSION
|
2020-04-19 15:33:59 +00:00
|
|
|
|
2021-02-04 03:51:12 +00:00
|
|
|
pio run --environment $BOARD # -v
|
2020-08-17 19:29:45 +00:00
|
|
|
SRCELF=.pio/build/$BOARD/firmware.elf
|
2020-10-21 04:48:04 +00:00
|
|
|
cp $SRCELF $OUTDIR/elfs/$basename.elf
|
|
|
|
|
|
|
|
if [ "$isNrf" = "false" ]
|
|
|
|
then
|
|
|
|
echo "Copying ESP32 bin file"
|
|
|
|
SRCBIN=.pio/build/$BOARD/firmware.bin
|
|
|
|
cp $SRCBIN $OUTDIR/bins/$basename.bin
|
|
|
|
else
|
|
|
|
echo "Generating NRF52 uf2 file"
|
|
|
|
SRCHEX=.pio/build/$BOARD/firmware.hex
|
|
|
|
bin/uf2conv.py $SRCHEX -c -o $OUTDIR/bins/$basename.uf2 -f 0xADA52840
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function do_boards() {
|
2020-10-21 11:18:03 +00:00
|
|
|
declare boards=$1
|
|
|
|
declare isNrf=$2
|
|
|
|
for board in $boards; do
|
2020-10-21 04:48:04 +00:00
|
|
|
# Build universal
|
2022-02-11 02:21:36 +00:00
|
|
|
echo "about to build $board $isNrf"
|
2020-10-21 04:48:04 +00:00
|
|
|
do_build $board "" "$isNrf"
|
|
|
|
done
|
2020-03-27 20:20:52 +00:00
|
|
|
}
|
|
|
|
|
2020-05-16 23:09:06 +00:00
|
|
|
# Make sure our submodules are current
|
|
|
|
git submodule update
|
|
|
|
|
2020-05-01 23:34:16 +00:00
|
|
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
|
|
|
platformio lib update
|
|
|
|
|
2020-10-21 11:18:03 +00:00
|
|
|
do_boards "$BOARDS_ESP32" "false"
|
|
|
|
do_boards "$BOARDS_NRF52" "true"
|
2020-02-14 22:00:08 +00:00
|
|
|
|
2021-08-18 18:09:59 +00:00
|
|
|
pio run --environment native
|
|
|
|
cp .pio/build/native/program $OUTDIR/bins/universal/meshtasticd_linux_amd64
|
|
|
|
|
2022-02-14 17:45:29 +00:00
|
|
|
echo "Building Filesystem for ESP32 targets"
|
2020-11-16 00:20:20 +00:00
|
|
|
pio run --environment tbeam -t buildfs
|
2022-02-14 17:45:29 +00:00
|
|
|
cp .pio/build/tbeam/spiffs.bin $OUTDIR/bins/universal/littlefs-$VERSION.bin
|
2020-11-16 00:20:20 +00:00
|
|
|
|
2020-02-24 17:33:41 +00:00
|
|
|
# keep the bins in archive also
|
2022-02-14 17:45:29 +00:00
|
|
|
cp $OUTDIR/bins/universal/littlefs* $OUTDIR/bins/universal/firmware* $OUTDIR/elfs/universal/firmware* $ARCHIVEDIR
|
2020-10-21 04:48:04 +00:00
|
|
|
|
|
|
|
echo Updating android bins $OUTDIR/forandroid
|
|
|
|
rm -rf $OUTDIR/forandroid
|
|
|
|
mkdir -p $OUTDIR/forandroid
|
|
|
|
cp -a $OUTDIR/bins/universal/*.bin $OUTDIR/forandroid/
|
2020-02-24 17:33:41 +00:00
|
|
|
|
2020-02-24 17:55:02 +00:00
|
|
|
cat >$OUTDIR/curfirmwareversion.xml <<XML
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
|
|
|
|
<!-- This file is kept in source control because it reflects the last stable
|
|
|
|
release. It is used by the android app for forcing software updates. Do not edit.
|
|
|
|
Generated by bin/buildall.sh -->
|
|
|
|
|
|
|
|
<resources>
|
2021-02-21 03:36:34 +00:00
|
|
|
<string name="cur_firmware_version" translatable="false">$VERSION</string>
|
2021-05-09 02:56:28 +00:00
|
|
|
<string name="short_firmware_version" translatable="false">$SHORT_VERSION</string>
|
2020-02-24 17:55:02 +00:00
|
|
|
</resources>
|
|
|
|
XML
|
|
|
|
|
2020-10-21 04:48:04 +00:00
|
|
|
echo Generating $ARCHIVEDIR/firmware-$VERSION.zip
|
2020-02-26 22:27:00 +00:00
|
|
|
rm -f $ARCHIVEDIR/firmware-$VERSION.zip
|
2022-02-14 17:45:29 +00:00
|
|
|
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $ARCHIVEDIR/littlefs-$VERSION.bin $OUTDIR/bins/universal/firmware-*-$VERSION.* $OUTDIR/bins/universal/meshtasticd* images/system-info.bin bin/device-install.* bin/device-update.*
|
2021-05-26 02:21:26 +00:00
|
|
|
echo Generating $ARCHIVEDIR/elfs-$VERSION.zip
|
|
|
|
rm -f $ARCHIVEDIR/elfs-$VERSION.zip
|
2022-02-14 17:45:29 +00:00
|
|
|
zip --junk-paths $ARCHIVEDIR/elfs-$VERSION.zip $OUTDIR/elfs/universal/firmware-*-$VERSION.*
|
2020-02-14 22:00:08 +00:00
|
|
|
|
2022-02-19 13:30:30 +00:00
|
|
|
echo BUILT ALL
|