2011-08-05 01:48:32 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
TARG=../release
|
|
|
|
|
|
|
|
if [ ! -d ../firmware ] ; then
|
|
|
|
echo Running from wrong directory.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd ../firmware
|
|
|
|
|
|
|
|
if [ -d $TARG ] ; then
|
|
|
|
echo Release dir already exists
|
|
|
|
echo please remove/move away
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2011-08-05 10:59:26 +00:00
|
|
|
if [ ! -f SECRETS.release ] ; then
|
|
|
|
echo Please create a SECRETS.release file
|
|
|
|
echo containing the release keys.
|
|
|
|
echo
|
|
|
|
echo 'Do not commit them!'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cp SECRETS.release SECRETS
|
|
|
|
|
2011-08-05 01:48:32 +00:00
|
|
|
mkdir $TARG
|
|
|
|
mkdir $TARG/files
|
|
|
|
|
|
|
|
echo "###"
|
|
|
|
echo "### Building final"
|
|
|
|
echo "###"
|
2011-08-05 12:48:36 +00:00
|
|
|
export FINAL=y
|
2011-08-05 01:48:32 +00:00
|
|
|
make clean
|
|
|
|
./l0dable/mktable.pl
|
|
|
|
make APP=final
|
|
|
|
cp firmware.elf $TARG/final.elf
|
|
|
|
cp firmware.bin $TARG/final.bin
|
|
|
|
|
|
|
|
echo "###"
|
|
|
|
echo "### Gathering files"
|
|
|
|
echo "###"
|
|
|
|
cp ../tools/font/binary/*.f0n $TARG/files/
|
|
|
|
cp ../tools/image/lcd/*.lcd $TARG/files/
|
2011-08-05 14:16:32 +00:00
|
|
|
cp ../tools/image/lcd/i42.lcd $TARG/files/nick.lcd
|
2011-08-05 01:48:32 +00:00
|
|
|
|
|
|
|
echo "###"
|
2011-08-05 23:20:36 +00:00
|
|
|
echo "### Gathering loadables"
|
2011-08-05 01:48:32 +00:00
|
|
|
echo "###"
|
|
|
|
(cd l0dable && make)
|
|
|
|
mv l0dable/*.c0d $TARG/files/
|
|
|
|
mv l0dable/*.int $TARG/files/
|
|
|
|
mv l0dable/*.nik $TARG/files/
|
|
|
|
|
2011-08-05 23:20:36 +00:00
|
|
|
if grep -q 'define ENCRYPT_L0DABLE' SECRETS ; then
|
|
|
|
|
2011-12-19 17:26:41 +00:00
|
|
|
echo "###"
|
|
|
|
echo "### Building crypto"
|
|
|
|
echo "###"
|
|
|
|
(cd ../tools/crypto && make)
|
|
|
|
|
2011-08-05 23:20:36 +00:00
|
|
|
echo "###"
|
|
|
|
echo "### Crypting loadables"
|
|
|
|
echo "###"
|
|
|
|
|
2011-08-05 17:55:29 +00:00
|
|
|
skey=`./getkey.pl l0dable_sign`
|
|
|
|
ekey=`./getkey.pl l0dable_crypt`
|
|
|
|
|
|
|
|
if [ -z "$ekey" ] ; then
|
|
|
|
echo E-Key fail
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$skey" ] ; then
|
|
|
|
echo S-Key fail
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
for a in $TARG/files/*.c0d $TARG/files/*.int $TARG/files/*.nik ; do
|
|
|
|
echo Crypting $a
|
2011-08-05 20:32:20 +00:00
|
|
|
../tools/crypto/xxtea -e -k $ekey $a
|
|
|
|
../tools/crypto/xxtea -s -k $skey $a
|
2011-08-05 17:55:29 +00:00
|
|
|
done
|
|
|
|
|
2011-08-05 23:20:36 +00:00
|
|
|
fi
|
2011-08-05 17:55:29 +00:00
|
|
|
|
2011-08-05 01:48:32 +00:00
|
|
|
echo "###"
|
|
|
|
echo "### Done. Yay!"
|
|
|
|
echo "###"
|
2011-08-05 10:59:26 +00:00
|
|
|
|
|
|
|
git checkout SECRETS
|