From c549478ca58dbcbde1c1f8b5c3c6dcaafcafadae Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 5 Nov 2020 02:32:41 +0100 Subject: [PATCH] Allow to specify 256k platforms --- common_arm/Makefile.hal | 6 ++++++ recovery/Makefile | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/common_arm/Makefile.hal b/common_arm/Makefile.hal index 5b327a951..3855360b4 100644 --- a/common_arm/Makefile.hal +++ b/common_arm/Makefile.hal @@ -133,6 +133,10 @@ ifeq (,$(PLATFORM_DEFS_INFO_STANDALONE)) PLATFORM_DEFS_INFO_STANDALONE = No standalone mode selected endif +ifeq ($(PLATFORM_SIZE),) + PLATFORM_SIZE=512 +endif + PLATFORM_CHANGED=false ifneq ($(PLATFORM), $(CACHED_PLATFORM)) PLATFORM_CHANGED=true @@ -145,6 +149,7 @@ endif export PLATFORM export PLATFORM_EXTRAS export PLATFORM_EXTRAS_INFO +export PLATFORM_SIZE export PLTNAME export PLATFORM_DEFS export PLATFORM_DEFS_INFO @@ -154,6 +159,7 @@ export PLATFORM_CHANGED $(info ===================================================================) $(info Platform name: $(PLTNAME)) $(info PLATFORM: $(PLATFORM)) +$(info PLATFORM_SIZE: $(PLATFORM_SIZE)) $(info Platform extras: $(PLATFORM_EXTRAS_INFO)) $(info Included options: $(PLATFORM_DEFS_INFO)) $(info Standalone mode: $(PLATFORM_DEFS_INFO_STANDALONE)) diff --git a/recovery/Makefile b/recovery/Makefile index 2bfd1475f..1ef142eda 100644 --- a/recovery/Makefile +++ b/recovery/Makefile @@ -6,10 +6,18 @@ ifneq (,$(FWTAG)) else INSTALLFWTAG = $(notdir $(INSTALLFW)) endif +FWMAXSIZE = $(shell echo $$(($(PLATFORM_SIZE)*1024))) BINS = bootrom.bin fullimage.bin $(INSTALLFW) all: $(BINS) + @FWSIZE=$$(stat -c "%s" $(INSTALLFW));\ + if [ $$FWSIZE -gt $(FWMAXSIZE) ]; then \ + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \ + echo "ERROR: Firmware image too large for your platform! $$FWSIZE > $(FWMAXSIZE)"; \ + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \ + exit 1; \ + fi bootrom.bin: ../bootrom/obj/bootrom.elf $(info [=] GEN $@)