diff --git a/Makefile b/Makefile index cf327d95f..a474fadd3 100644 --- a/Makefile +++ b/Makefile @@ -35,9 +35,10 @@ endif include common/Makefile.hal $(info ===================================================================) -$(info PLATFORM: $(PLATFORM)) -$(info $(PLTNAME)) -$(info Included supports: $(PLATFORM_DEFS)) +$(info PLATFORM: $(PLATFORM)) +$(info Platform name: $(PLTNAME)) +$(info Included options: $(PLATFORM_DEFS_INFO)) +$(info Standalone mode: $(PLATFORM_DEFS_INFO_STANDALONE)) $(info ===================================================================) all clean: %: client/% bootrom/% armsrc/% recovery/% mfkey/% nonce2key/% diff --git a/armsrc/Makefile b/armsrc/Makefile index ed129c950..eb8158dd7 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -18,9 +18,10 @@ ifeq ($(PLTNAME),) endif include ../common/Makefile.hal $(info ===================================================================) - $(info PLATFORM: $(PLATFORM)) - $(info $(PLTNAME)) - $(info Included supports: $(PLATFORM_DEFS)) + $(info PLATFORM: $(PLATFORM)) + $(info Platform name: $(PLTNAME)) + $(info Included options: $(PLATFORM_DEFS_INFO)) + $(info Standalone mode: $(PLATFORM_DEFS_INFO_STANDALONE)) $(info ===================================================================) endif @@ -29,34 +30,8 @@ endif # NO space,TABs after the "\" sign. APP_CFLAGS = $(PLATFORM_DEFS) \ -DON_DEVICE \ - -DWITH_LF \ - -DWITH_HITAG \ - -DWITH_ISO15693 \ - -DWITH_LEGICRF \ - -DWITH_ISO14443b \ - -DWITH_ISO14443a \ - -DWITH_ICLASS \ - -DWITH_FELICA \ - -DWITH_HFSNIFF \ - -DWITH_LF_SAMYRUN \ -fno-strict-aliasing -ffunction-sections -fdata-sections -### IMPORTANT - move the commented variable below this line -# -DWITH_FPC \ -# -DWITH_LCD \ -# -DWITH_EMV \ -# -# Standalone Mods -#------------------------------------------------------- -# -DWITH_LF_ICERUN -# -DWITH_LF_SAMYRUN -# -DWITH_LF_PROXBRUTE -# -DWITH_LF_HIDBRUTE -# -DWITH_HF_YOUNG -# -DWITH_HF_MATTYRUN -# -DWITH_HF_COLIN -# -DWITH_HF_BOG - SRC_LF = lfops.c lfsampling.c pcf7931.c lfdemod.c SRC_ISO15693 = iso15693.c iso15693tools.c SRC_ISO14443a = iso14443a.c mifareutil.c mifarecmd.c epa.c mifaresim.c @@ -101,36 +76,36 @@ endif # Generic standalone Mode injection of source code SRC_STANDALONE = -# WITH_LF_ICERUN -ifneq (,$(findstring WITH_LF_ICERUN,$(APP_CFLAGS))) +# WITH_STANDALONE_LF_ICERUN +ifneq (,$(findstring WITH_STANDALONE_LF_ICERUN,$(APP_CFLAGS))) SRC_STANDALONE = endif -# WITH_LF_SAMYRUN -ifneq (,$(findstring WITH_LF_SAMYRUN,$(APP_CFLAGS))) +# WITH_STANDALONE_LF_SAMYRUN +ifneq (,$(findstring WITH_STANDALONE_LF_SAMYRUN,$(APP_CFLAGS))) SRC_STANDALONE = lf_samyrun.c endif -# WITH_LF_PROXBRUTE -ifneq (,$(findstring WITH_LF_PROXBRUTE,$(APP_CFLAGS))) +# WITH_STANDALONE_LF_PROXBRUTE +ifneq (,$(findstring WITH_STANDALONE_LF_PROXBRUTE,$(APP_CFLAGS))) SRC_STANDALONE = lf_proxbrute.c endif -# WITH_LF_HIDBRUTE -ifneq (,$(findstring WITH_LF_HIDBRUTE,$(APP_CFLAGS))) +# WITH_STANDALONE_LF_HIDBRUTE +ifneq (,$(findstring WITH_STANDALONE_LF_HIDBRUTE,$(APP_CFLAGS))) SRC_STANDALONE = lf_hidbrute.c endif -# WITH_HF_YOUNG -ifneq (,$(findstring WITH_HF_YOUNG,$(APP_CFLAGS))) +# WITH_STANDALONE_HF_YOUNG +ifneq (,$(findstring WITH_STANDALONE_HF_YOUNG,$(APP_CFLAGS))) SRC_STANDALONE = hf_young.c endif -# WITH_HF_MATTYRUN -ifneq (,$(findstring WITH_HF_MATTYRUN,$(APP_CFLAGS))) +# WITH_STANDALONE_HF_MATTYRUN +ifneq (,$(findstring WITH_STANDALONE_HF_MATTYRUN,$(APP_CFLAGS))) SRC_STANDALONE = hf_mattyrun.c endif -# WITH_HF_COLIN -ifneq (,$(findstring WITH_HF_COLIN,$(APP_CFLAGS))) +# WITH_STANDALONE_HF_COLIN +ifneq (,$(findstring WITH_STANDALONE_HF_COLIN,$(APP_CFLAGS))) SRC_STANDALONE = vtsend.c hf_colin.c endif -# WITH_HF_BOG -ifneq (,$(findstring WITH_HF_BOG,$(APP_CFLAGS))) +# WITH_STANDALONE_HF_BOG +ifneq (,$(findstring WITH_STANDALONE_HF_BOG,$(APP_CFLAGS))) SRC_STANDALONE = hf_bog.c endif diff --git a/armsrc/Standalone/readme.md b/armsrc/Standalone/readme.md index 21eadc45f..3d0005def 100644 --- a/armsrc/Standalone/readme.md +++ b/armsrc/Standalone/readme.md @@ -32,21 +32,23 @@ As it is now, you can only have one standalone mode installed at the time. Use HF/LF to denote which frequence your mod is targeting. Use you own github name/similar for perpetual honour to denote your mod -Samples of directive flag used in the `armsrc\makefile`: +Samples of directive flag used in the `common/Makefile.hal`: ``` -### -DWITH_LF_ICERUN -### -DWITH_LF_SAMYRUN -### -DWITH_LF_PROXBRUTE -### -DWITH_LF_HIDBRUTE -### -DWITH_HF_COLIN -### -DWITH_HF_YOUNG -### -DWITH_HF_MATTYRUN +#PLATFORM_DEFS += -DWITH_STANDALONE_LF_SAMYRUN +#PLATFORM_DEFS += -DWITH_STANDALONE_LF_ICERUN +#PLATFORM_DEFS += -DWITH_STANDALONE_LF_SAMYRUN +#PLATFORM_DEFS += -DWITH_STANDALONE_LF_PROXBRUTE +#PLATFORM_DEFS += -DWITH_STANDALONE_LF_HIDBRUTE +#PLATFORM_DEFS += -DWITH_STANDALONE_HF_YOUNG +#PLATFORM_DEFS += -DWITH_STANDALONE_HF_MATTYRUN +#PLATFORM_DEFS += -DWITH_STANDALONE_HF_COLIN +#PLATFORM_DEFS += -DWITH_STANDALONE_HF_BOG ``` Add your source code file like the following sample in the `armsrc\makefile` ``` -# WITH_HF_COLIN -ifneq (,$(findstring WITH_HF_COLIN,$(APP_CFLAGS))) +# WITH_STANDALONE_HF_COLIN +ifneq (,$(findstring WITH_STANDALONE_HF_COLIN,$(APP_CFLAGS))) SRC_STANDALONE = hf_colin.c vtsend.c else SRC_STANDALONE = @@ -57,45 +59,13 @@ endif Do please add a identification string in the function `printStandAloneModes` inside `armsrc\appmain.c` This will enable an easy way to detect on client side which standalone mods has been installed on the device. ``` -#if defined(WITH_HF_COLIN) +#if defined(WITH_STANDALONE_HF_COLIN) DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)"); #endif ```` -Once all this is done, you and others can now easily compile different standalone modes by just swapping the -D directive in `armsrc\makefile` +Once all this is done, you and others can now easily compile different standalone modes by just selecting one of the standalone modes in `common/Makefile.hal`, e.g.: ```` -#remove one of the following defines and comment out the relevant line -#in the next section to remove that particular feature from compilation. -# NO space,TABs after the "\" sign. -APP_CFLAGS = -DON_DEVICE \ - -DWITH_LF \ - -DWITH_HITAG \ - -DWITH_ISO15693 \ - -DWITH_LEGICRF \ - -DWITH_ISO14443b \ - -DWITH_ISO14443a \ - -DWITH_ICLASS \ - -DWITH_FELICA \ - -DWITH_FLASH \ - -DWITH_SMARTCARD \ - -DWITH_HFSNOOP \ - -DWITH_HF_COLIN \ - -DWITH_FPC \ - -fno-strict-aliasing -ffunction-sections -fdata-sections - -### IMPORTANT - move the commented variable below this line -# -DWITH_LCD \ -# -DWITH_EMV \ -# -DWITH_FPC \ -# -# Standalone Mods -#------------------------------------------------------- -# -DWITH_LF_ICERUN -# -DWITH_LF_SAMYRUN -# -DWITH_LF_PROXBRUTE -# -DWITH_LF_HIDBRUTE -# -DWITH_HF_YOUNG -# -DWITH_HF_MATTYRUN -# -DWITH_HF_COLIN +PLATFORM_DEFS += -DWITH_STANDALONE_HF_COLIN ```` diff --git a/armsrc/appmain.c b/armsrc/appmain.c index e7887b9af..3a2f14d04 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -433,28 +433,28 @@ void printStandAloneModes(void) { DbpString("Installed StandAlone Mode"); -#if defined(WITH_LF_ICERUN) +#if defined(WITH_STANDALONE_LF_ICERUN) DbpString(" LF sniff/clone/simulation - aka IceRun (iceman)"); #endif -#if defined(WITH_HF_YOUNG) +#if defined(WITH_STANDALONE_HF_YOUNG) DbpString(" HF Mifare sniff/simulation - (Craig Young)"); #endif -#if defined(WITH_LF_SAMYRUN) +#if defined(WITH_STANDALONE_LF_SAMYRUN) DbpString(" LF HID26 standalone - aka SamyRun (Samy Kamkar)"); #endif -#if defined(WITH_LF_PROXBRUTE) +#if defined(WITH_STANDALONE_LF_PROXBRUTE) DbpString(" LF HID ProxII bruteforce - aka Proxbrute (Brad Antoniewicz)"); #endif -#if defined(WITH_LF_HIDBRUTE) +#if defined(WITH_STANDALONE_LF_HIDBRUTE) DbpString(" LF HID corporate 1000 bruteforce - aka Corporatebrute (Federico dotta & Maurizio Agazzini)"); #endif -#if defined(WITH_HF_MATTYRUN) +#if defined(WITH_STANDALONE_HF_MATTYRUN) DbpString(" HF Mifare sniff/clone - aka MattyRun (Matías A. Ré Medina)"); #endif -#if defined(WITH_HF_COLIN) +#if defined(WITH_STANDALONE_HF_COLIN) DbpString(" HF Mifare ultra fast sniff/sim/clone - aka VIGIKPWN (Colin Brigato)"); #endif -#if defined(WITH_HF_BOG) +#if defined(WITH_STANDALONE_HF_BOG) DbpString(" HF 14a sniff standalone with ULC/ULEV1/NTAG auth storing in flashmem - aka BogitoRun (Bogito)"); #endif @@ -1585,11 +1585,11 @@ void __attribute__((noreturn)) AppMain(void) { * All standalone mod "main loop" should be the RunMod() function. * Since the standalone is either LF or HF, the somewhat bisarr defines below exists. */ -#if defined (WITH_LF) && ( defined (WITH_LF_SAMYRUN) || defined (WITH_LF_HIDBRUTE) || defined (WITH_LF_PROXBRUTE) ) +#if defined (WITH_LF) && ( defined (WITH_STANDALONE_LF_SAMYRUN) || defined (WITH_STANDALONE_LF_HIDBRUTE) || defined (WITH_STANDALONE_LF_PROXBRUTE) ) RunMod(); #endif -#if defined (WITH_ISO14443a) && ( defined (WITH_HF_YOUNG) || defined(WITH_HF_COLIN) || defined(WITH_HF_MATTYRUN) || defined(WITH_HF_BOG) ) +#if defined (WITH_ISO14443a) && ( defined (WITH_STANDALONE_HF_YOUNG) || defined(WITH_STANDALONE_HF_COLIN) || defined(WITH_STANDALONE_HF_MATTYRUN) || defined(WITH_STANDALONE_HF_BOG) ) RunMod(); #endif diff --git a/client/Makefile b/client/Makefile index 5efd89696..012d02425 100644 --- a/client/Makefile +++ b/client/Makefile @@ -14,9 +14,10 @@ ifeq ($(PLTNAME),) endif include ../common/Makefile.hal $(info ===================================================================) - $(info PLATFORM: $(PLATFORM)) - $(info $(PLTNAME)) - $(info Included supports: $(PLATFORM_DEFS)) + $(info PLATFORM: $(PLATFORM)) + $(info Platform name: $(PLTNAME)) + $(info Included options: $(PLATFORM_DEFS_INFO)) + $(info Standalone mode: $(PLATFORM_DEFS_INFO_STANDALONE)) $(info ===================================================================) endif diff --git a/common/Makefile.hal b/common/Makefile.hal index 717d59110..d6f87a2e6 100644 --- a/common/Makefile.hal +++ b/common/Makefile.hal @@ -56,12 +56,62 @@ else $(error Invalid or empty PLATFORM: $(PLATFORM). Known platforms: $(KNOWN_PLATFORMS)) endif -# Add flags dependencies +# common LF support +PLATFORM_DEFS += \ + -DWITH_LF \ + -DWITH_HITAG + +# common HF support +PLATFORM_DEFS += \ + -DWITH_ISO15693 \ + -DWITH_LEGICRF \ + -DWITH_ISO14443b \ + -DWITH_ISO14443a \ + -DWITH_ICLASS \ + -DWITH_FELICA \ + -DWITH_HFSNIFF + +# Standalone mode +# !! Choose only one !! +PLATFORM_DEFS += -DWITH_STANDALONE_LF_SAMYRUN +#PLATFORM_DEFS += -DWITH_STANDALONE_LF_ICERUN +#PLATFORM_DEFS += -DWITH_STANDALONE_LF_SAMYRUN +#PLATFORM_DEFS += -DWITH_STANDALONE_LF_PROXBRUTE +#PLATFORM_DEFS += -DWITH_STANDALONE_LF_HIDBRUTE +#PLATFORM_DEFS += -DWITH_STANDALONE_HF_YOUNG +#PLATFORM_DEFS += -DWITH_STANDALONE_HF_MATTYRUN +#PLATFORM_DEFS += -DWITH_STANDALONE_HF_COLIN +#PLATFORM_DEFS += -DWITH_STANDALONE_HF_BOG + +$(info $(findstring WITH_STANDALONE_*,$(PLATFORM_DEFS))) + +# Misc +#PLATFORM_DEFS += -DWITH_LCD + + +# Add flags dependencies : + +# WITH_FPC_* needs WITH_FPC : ifneq (,$(findstring WITH_FPC_,$(PLATFORM_DEFS))) PLATFORM_DEFS += -DWITH_FPC endif +# WITH_EMV possible if WITH_ISO14443a : +ifneq (,$(findstring WITH_ISO14443a,$(PLATFORM_DEFS))) + PLATFORM_DEFS += -DWITH_EMV +endif + +PLATFORM_DEFS_INFO = $(strip $(filter-out STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS)))) +PLATFORM_DEFS_INFO_STANDALONE = $(strip $(subst STANDALONE_,, $(filter STANDALONE%, $(subst -DWITH_,,$(PLATFORM_DEFS))))) + +# Check that only one Standalone mode has been chosen +ifneq (,$(word 2, $(PLATFORM_DEFS_INFO_STANDALONE))) + $(error You must choose only one Standalone mode!: $(PLATFORM_DEFS_INFO_STANDALONE)) +endif + export PLATFORM export PLTNAME export MCU export PLATFORM_DEFS +export PLATFORM_DEFS_INFO +export PLATFORM_DEFS_INFO_STANDALONE