Merge pull request #2709 from ry4000/master
[RRG-proxmark3.git] / recovery / Makefile
blobe18e66c06c9c17d594ff2b6bff049eb5b6d7744e
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; \
20 fi; \
21 echo "==================================================================="; \
22 echo "Firmware size: $$FWSIZE bytes ($$((FWSIZE/1024))kb) = $$((FWSIZE*100/$(FWMAXSIZE)))% of $$(($(FWMAXSIZE)/1024))kb"; \
23 echo "==================================================================="
25 bootrom.bin: ../bootrom/obj/bootrom.elf
26 $(info [=] GEN $@)
27 $(Q)$(CROSS_OBJCOPY) --gap-fill=0xff --pad-to 0x00102000 -O binary $^ $@
29 fullimage.bin: ../armsrc/obj/fullimage.elf
30 $(info [=] GEN $@)
31 $(Q)$(CROSS_OBJCOPY) --gap-fill=0xff -O binary $^ $@
33 proxmark3_recovery.bin: bootrom.bin fullimage.bin
34 $(info [=] GEN $@)
35 $(Q)cat bootrom.bin fullimage.bin > $@
37 clean:
38 $(Q)$(RM) $(BINS)
40 install: all
41 $(info [@] Installing recovery to $(DESTDIR)$(PREFIX)...)
42 $(Q)$(INSTALLSUDO) $(MKDIR) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)
43 $(Q)$(INSTALLSUDO) $(CP) $(INSTALLFW) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)$(PATHSEP)$(INSTALLFWTAG)
45 uninstall:
46 $(info [@] Uninstalling recovery from $(DESTDIR)$(PREFIX)...)
47 $(Q)$(INSTALLSUDO) $(RM) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)$(PATHSEP)$(INSTALLFWTAG)
49 .PHONY: all clean install uninstall