Merge pull request #2593 from Akury83/master
[RRG-proxmark3.git] / recovery / Makefile
blob5d561c45b1d6211e7a5d5ca56871ca70fcc413c3
1 include ../common_arm/Makefile.common
3 INSTALLFW = proxmark3_recovery.bin
4 ifneq (,$(FWTAG))
5 INSTALLFWTAG = $(notdir $(INSTALLFW:%.bin=%-$(FWTAG).bin))
6 else
7 INSTALLFWTAG = $(notdir $(INSTALLFW))
8 endif
9 FWMAXSIZE = $(shell echo $$(($(PLATFORM_SIZE)*1024)))
11 BINS = bootrom.bin fullimage.bin $(INSTALLFW)
13 all: $(BINS)
14 @FWSIZE=$$(wc -c < $(INSTALLFW));\
15 if [ $$FWSIZE -gt $(FWMAXSIZE) ]; then \
16 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
17 echo "ERROR: Firmware image too large for your platform! $$FWSIZE > $(FWMAXSIZE)"; \
18 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
19 exit 1; \
22 bootrom.bin: ../bootrom/obj/bootrom.elf
23 $(info [=] GEN $@)
24 $(Q)$(CROSS_OBJCOPY) --gap-fill=0xff --pad-to 0x00102000 -O binary $^ $@
26 fullimage.bin: ../armsrc/obj/fullimage.elf
27 $(info [=] GEN $@)
28 $(Q)$(CROSS_OBJCOPY) --gap-fill=0xff -O binary $^ $@
30 proxmark3_recovery.bin: bootrom.bin fullimage.bin
31 $(info [=] GEN $@)
32 $(Q)cat bootrom.bin fullimage.bin > $@
34 clean:
35 $(Q)$(RM) $(BINS)
37 install: all
38 $(info [@] Installing recovery to $(DESTDIR)$(PREFIX)...)
39 $(Q)$(INSTALLSUDO) $(MKDIR) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)
40 $(Q)$(INSTALLSUDO) $(CP) $(INSTALLFW) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)$(PATHSEP)$(INSTALLFWTAG)
42 uninstall:
43 $(info [@] Uninstalling recovery from $(DESTDIR)$(PREFIX)...)
44 $(Q)$(INSTALLSUDO) $(RM) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)$(PATHSEP)$(INSTALLFWTAG)
46 .PHONY: all clean install uninstall