mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-09 17:56:53 +08:00
8a656da584
The command " $STATS && ( LANG=C arm-none-eabi-size armsrc/obj/[hl]f_*.o |grep -v "filename" >> standalones_stats.txt )" is always false when $STATS is false (by default). So the exit code of the script is "1" and the build in Kali fails.
75 lines
3.6 KiB
Bash
Executable file
75 lines
3.6 KiB
Bash
Executable file
#!/bin/bash
|
|
# (Need bash because of Bash Arrays)
|
|
|
|
# These vars can be overriden by env variables
|
|
echo "Makefile flags: ${MKFLAGS:=-j8}"
|
|
echo "Destination: ${DEST:=firmwares}"
|
|
echo "Produce stats?: ${STATS:=false}"
|
|
|
|
# Which parts to skip for the 256kb version?
|
|
SKIPS256="SKIP_HITAG=1"
|
|
|
|
make $MKFLAGS bootrom || exit 1
|
|
chmod 644 bootrom/obj/bootrom.elf
|
|
mkdir -p "$DEST"
|
|
mv bootrom/obj/bootrom.elf "$DEST/PM3BOOTROM.elf"
|
|
|
|
# cf armsrc/Standalone/Makefile.hal
|
|
STANDALONE_MODES=(LF_SKELETON LF_EM4100EMUL LF_EM4100RSWB LF_EM4100RWC LF_HIDBRUTE LF_HIDFCBRUTE LF_ICEHID LF_PROXBRUTE LF_SAMYRUN LF_THAREXDE LF_NEXID)
|
|
STANDALONE_MODES+=(HF_14ASNIFF HF_AVEFUL HF_BOG HF_COLIN HF_CRAFTBYTE HF_ICECLASS HF_LEGIC HF_MATTYRUN HF_MFCSIM HF_MSDSAL HF_TCPRST HF_TMUDFORD HF_YOUNG HF_REBLAY)
|
|
STANDALONE_MODES_REQ_BT=(HF_REBLAY)
|
|
STANDALONE_MODES_REQ_SMARTCARD=()
|
|
STANDALONE_MODES_REQ_FLASH=(LF_HIDFCBRUTE LF_ICEHID LF_NEXID LF_THAREXDE HF_14ASNIFF HF_BOG HF_COLIN HF_ICECLASS HF_MFCSIM)
|
|
|
|
# PM3GENERIC 256kb, no flash, need to skip some parts to reduce size
|
|
|
|
# Need to use the "recovery" target to test the size
|
|
make $MKFLAGS PLATFORM=PM3GENERIC PLATFORM_SIZE=256 PLATFORM_EXTRAS= STANDALONE= $SKIPS256 recovery || exit 1
|
|
chmod 644 armsrc/obj/fullimage.elf
|
|
mv armsrc/obj/fullimage.elf "$DEST/PM3GENERIC_256.elf"
|
|
|
|
# PM3GENERIC, no flash
|
|
|
|
make $MKFLAGS PLATFORM=PM3GENERIC PLATFORM_EXTRAS= STANDALONE= fullimage || exit 1
|
|
chmod 644 armsrc/obj/fullimage.elf
|
|
mv armsrc/obj/fullimage.elf "$DEST/PM3GENERIC.elf"
|
|
$STATS && ( echo "PM3GENERIC:" > standalones_stats.txt )
|
|
$STATS && ( echo " text data bss dec hex filename" >> standalones_stats.txt )
|
|
for mode in "${STANDALONE_MODES[@]}"; do
|
|
[[ " ${STANDALONE_MODES_REQ_BT[*]} " =~ " $mode " ]] && continue
|
|
[[ " ${STANDALONE_MODES_REQ_SMARTCARD[*]} " =~ " $mode " ]] && continue
|
|
[[ " ${STANDALONE_MODES_REQ_FLASH[*]} " =~ " $mode " ]] && continue
|
|
make $MKFLAGS PLATFORM=PM3GENERIC PLATFORM_EXTRAS= STANDALONE=$mode fullimage || exit 1
|
|
chmod 644 armsrc/obj/fullimage.elf
|
|
mv armsrc/obj/fullimage.elf "$DEST/PM3GENERIC_${mode/_/}.elf"
|
|
! $STATS || ( LANG=C arm-none-eabi-size armsrc/obj/[hl]f_*.o |grep -v "filename" >> standalones_stats.txt )
|
|
done
|
|
|
|
# PM3RDV4
|
|
|
|
make $MKFLAGS PLATFORM=PM3RDV4 PLATFORM_EXTRAS= STANDALONE= fullimage || exit 1
|
|
chmod 644 armsrc/obj/fullimage.elf
|
|
mv armsrc/obj/fullimage.elf "$DEST/PM3RDV4.elf"
|
|
$STATS && ( echo "PM3RDV4:" >> standalones_stats.txt )
|
|
$STATS && ( echo " text data bss dec hex filename" >> standalones_stats.txt )
|
|
for mode in "${STANDALONE_MODES[@]}"; do
|
|
[[ " ${STANDALONE_MODES_REQ_BT[*]} " =~ " $mode " ]] && continue
|
|
make $MKFLAGS PLATFORM=PM3RDV4 PLATFORM_EXTRAS= STANDALONE=$mode fullimage || exit 1
|
|
chmod 644 armsrc/obj/fullimage.elf
|
|
mv armsrc/obj/fullimage.elf "$DEST/PM3RDV4_${mode/_/}.elf"
|
|
! $STATS || ( LANG=C arm-none-eabi-size armsrc/obj/[hl]f_*.o |grep -v "filename" >> standalones_stats.txt )
|
|
done
|
|
|
|
# PM4RDV4 + BTADDON
|
|
|
|
make $MKFLAGS PLATFORM=PM3RDV4 PLATFORM_EXTRAS=BTADDON STANDALONE= fullimage || exit 1
|
|
chmod 644 armsrc/obj/fullimage.elf
|
|
mv armsrc/obj/fullimage.elf "$DEST/PM3RDV4_BTADDON.elf"
|
|
$STATS && ( echo "PM3RDV4 + BTADDON:" >> standalones_stats.txt )
|
|
$STATS && ( echo " text data bss dec hex filename" >> standalones_stats.txt )
|
|
for mode in "${STANDALONE_MODES[@]}"; do
|
|
make $MKFLAGS PLATFORM=PM3RDV4 PLATFORM_EXTRAS=BTADDON STANDALONE=$mode fullimage || exit 1
|
|
chmod 644 armsrc/obj/fullimage.elf
|
|
mv armsrc/obj/fullimage.elf "$DEST/PM3RDV4_BTADDON_${mode/_/}.elf"
|
|
! $STATS || ( LANG=C arm-none-eabi-size armsrc/obj/[hl]f_*.o |grep -v "filename" >> standalones_stats.txt )
|
|
done
|