]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_lamp/commitdiff
mkspiffs.sh: generalize for multiple configurations
authorNathaniel Wesley Filardo <nwfilardo@gmail.com>
Sun, 31 May 2020 21:51:31 +0000 (22:51 +0100)
committerNathaniel Wesley Filardo <nwfilardo@gmail.com>
Sun, 31 May 2020 21:51:31 +0000 (22:51 +0100)
mkspiffs.sh

index b4108debdfc5e701ff5611c022e676dbdfb9ca9e..3cea19c9b42dabd43ca5c76ff76670afdfe15360 100755 (executable)
@@ -2,23 +2,27 @@
 
 set -e -u -x
 
-FWSZ=$(stat --printf="%s" ./core/firm/bin/nodemcu_integer_lamp.bin)
-FWSZ=$((FWSZ + 131072)) # Pad for LFS
+: ${BOARDNAME:=test}
+
+if [ -z "${FWSZ-}" ]; then
+  FWSZ=${FWSZ:$(stat --printf="%s" ./core/firm/bin/nodemcu_integer_expect-tests.bin)}
+  FWSZ=$((FWSZ + 131072)) # Pad for LFS
+fi
 
 (
        # Init is the only core Lua that does not live in LFS.
        echo import core/init.lua init.lua
 
        # Configuration
-       echo import conf/test/nwfnet.conf nwfnet.conf
-       echo import conf/test/nwfmqtt.conf nwfmqtt.conf
-       echo import conf/test/nwfmqtt.subs nwfmqtt.subs
+       echo import conf/${BOARDNAME}/nwfnet.conf nwfnet.conf
+       echo import conf/${BOARDNAME}/nwfmqtt.conf nwfmqtt.conf
+       echo import conf/${BOARDNAME}/nwfmqtt.subs nwfmqtt.subs
 
        # And the LFS image with the rest of everything
        #  We could, and used to, but we now go via the nodemcu partition tool
        # echo import _lfs_build/luac.out luac.out
 ) | ./core/firm/tools/spiffsimg/spiffsimg \
-     -f spiffs.img \
+     -f spiffs-${BOARDNAME}.img \
      -S 4MB -U ${FWSZ} \
      -r /dev/fd/0