sforkowany z mirror/meshtastic-firmware
update buildscript to generate universal/regionless roms
rodzic
430186ec53
commit
ad7a474a52
|
@ -9,11 +9,10 @@ COUNTRIES="US EU433 EU865 CN JP ANZ KR"
|
||||||
#COUNTRIES=CN
|
#COUNTRIES=CN
|
||||||
|
|
||||||
BOARDS_ESP32="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7"
|
BOARDS_ESP32="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7"
|
||||||
|
# BOARDS_ESP32=tbeam
|
||||||
|
|
||||||
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
|
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
|
||||||
BOARDS_NRF52="lora-relay-v1"
|
BOARDS_NRF52="lora-relay-v1"
|
||||||
BOARDS="$BOARDS_ESP32 $BOARDS_NRF52"
|
|
||||||
#BOARDS=tbeam
|
|
||||||
|
|
||||||
OUTDIR=release/latest
|
OUTDIR=release/latest
|
||||||
|
|
||||||
|
@ -22,22 +21,61 @@ ARCHIVEDIR=release/archive
|
||||||
|
|
||||||
rm -f $OUTDIR/firmware*
|
rm -f $OUTDIR/firmware*
|
||||||
|
|
||||||
mkdir -p $OUTDIR/bins $OUTDIR/elfs
|
mkdir -p $OUTDIR/bins
|
||||||
rm -f $OUTDIR/bins/*
|
rm -r $OUTDIR/bins/*
|
||||||
|
mkdir -p $OUTDIR/bins/universal $OUTDIR/elfs/universal
|
||||||
|
|
||||||
# build the named environment and copy the bins to the release directory
|
# build the named environment and copy the bins to the release directory
|
||||||
function do_build {
|
function do_build() {
|
||||||
echo "Building for $BOARD with $PLATFORMIO_BUILD_FLAGS"
|
BOARD=$1
|
||||||
|
COUNTRY=$2
|
||||||
|
isNrf=$3
|
||||||
|
|
||||||
|
echo "Building $COUNTRY for $BOARD with $PLATFORMIO_BUILD_FLAGS"
|
||||||
rm -f .pio/build/$BOARD/firmware.*
|
rm -f .pio/build/$BOARD/firmware.*
|
||||||
|
|
||||||
# The shell vars the build tool expects to find
|
# The shell vars the build tool expects to find
|
||||||
export HW_VERSION="1.0-$COUNTRY"
|
|
||||||
export APP_VERSION=$VERSION
|
export APP_VERSION=$VERSION
|
||||||
|
|
||||||
|
# Are we building a universal/regionless rom?
|
||||||
|
if [ "x$COUNTRY" != "x" ]
|
||||||
|
then
|
||||||
|
export HW_VERSION="1.0-$COUNTRY"
|
||||||
export COUNTRY
|
export COUNTRY
|
||||||
|
basename=firmware-$BOARD-$COUNTRY-$VERSION
|
||||||
|
else
|
||||||
|
export HW_VERSION="1.0"
|
||||||
|
unset COUNTRY
|
||||||
|
basename=universal/firmware-$BOARD-$VERSION
|
||||||
|
fi
|
||||||
|
|
||||||
pio run --jobs 4 --environment $BOARD # -v
|
pio run --jobs 4 --environment $BOARD # -v
|
||||||
SRCELF=.pio/build/$BOARD/firmware.elf
|
SRCELF=.pio/build/$BOARD/firmware.elf
|
||||||
cp $SRCELF $OUTDIR/elfs/firmware-$BOARD-$COUNTRY-$VERSION.elf
|
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() {
|
||||||
|
BOARDS=$1
|
||||||
|
isNrf=$2
|
||||||
|
for board in $BOARDS; do
|
||||||
|
for country in $COUNTRIES; do
|
||||||
|
do_build $board $country "$isNrf"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Build universal
|
||||||
|
do_build $board "" "$isNrf"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make sure our submodules are current
|
# Make sure our submodules are current
|
||||||
|
@ -46,26 +84,16 @@ git submodule update
|
||||||
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
|
||||||
platformio lib update
|
platformio lib update
|
||||||
|
|
||||||
for COUNTRY in $COUNTRIES; do
|
do_boards $BOARDS_ESP32 "false"
|
||||||
for BOARD in $BOARDS; do
|
do_boards $BOARDS_NRF52 "true"
|
||||||
do_build $BOARD
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Copying ESP32 bin files"
|
|
||||||
for BOARD in $BOARDS_ESP32; do
|
|
||||||
SRCBIN=.pio/build/$BOARD/firmware.bin
|
|
||||||
cp $SRCBIN $OUTDIR/bins/firmware-$BOARD-$COUNTRY-$VERSION.bin
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Generating NRF52 uf2 files"
|
|
||||||
for BOARD in $BOARDS_NRF52; do
|
|
||||||
SRCHEX=.pio/build/$BOARD/firmware.hex
|
|
||||||
bin/uf2conv.py $SRCHEX -c -o $OUTDIR/bins/firmware-$BOARD-$COUNTRY-$VERSION.uf2 -f 0xADA52840
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
# keep the bins in archive also
|
# keep the bins in archive also
|
||||||
cp $OUTDIR/bins/firmware* $OUTDIR/elfs/firmware* $ARCHIVEDIR
|
cp $OUTDIR/bins/firmware* $OUTDIR/elfs/firmware* $OUTDIR/bins/universal/firmware* $OUTDIR/elfs/universal/firmware* $ARCHIVEDIR
|
||||||
|
|
||||||
|
echo Updating android bins $OUTDIR/forandroid
|
||||||
|
rm -rf $OUTDIR/forandroid
|
||||||
|
mkdir -p $OUTDIR/forandroid
|
||||||
|
cp -a $OUTDIR/bins/universal/*.bin $OUTDIR/forandroid/
|
||||||
|
|
||||||
cat >$OUTDIR/curfirmwareversion.xml <<XML
|
cat >$OUTDIR/curfirmwareversion.xml <<XML
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
@ -79,6 +107,7 @@ Generated by bin/buildall.sh -->
|
||||||
</resources>
|
</resources>
|
||||||
XML
|
XML
|
||||||
|
|
||||||
|
echo Generating $ARCHIVEDIR/firmware-$VERSION.zip
|
||||||
rm -f $ARCHIVEDIR/firmware-$VERSION.zip
|
rm -f $ARCHIVEDIR/firmware-$VERSION.zip
|
||||||
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh
|
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue