summaryrefslogtreecommitdiff
path: root/builddefs
diff options
context:
space:
mode:
authorDasky <32983009+daskygit@users.noreply.github.com>2023-09-12 02:55:05 +0100
committerGitHub <noreply@github.com>2023-09-12 02:55:05 +0100
commit62105b5c07971387026e676815a8358c9833149e (patch)
tree7c04b41f897aa441c1c21d8f2148783c310bd37a /builddefs
parent3561c3a1f93d107057f76b8fba8bd4547da2d542 (diff)
Remove oversize binaries (#21976)
This stops a situation where a user could end up flashing oversize firmware soft bricking hardware.
Diffstat (limited to 'builddefs')
-rw-r--r--builddefs/common_rules.mk2
1 files changed, 2 insertions, 0 deletions
diff --git a/builddefs/common_rules.mk b/builddefs/common_rules.mk
index 5d635307ed..d20e9ad74d 100644
--- a/builddefs/common_rules.mk
+++ b/builddefs/common_rules.mk
@@ -392,6 +392,8 @@ check-size:
if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
$(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then \
+ $(REMOVE) $(TARGET).$(FIRMWARE_FORMAT); \
+ $(REMOVE) $(BUILD_DIR)/$(TARGET).{hex,bin,uf2}; \
printf "\n * $(MSG_FILE_TOO_BIG)"; $(PRINT_ERROR_PLAIN); \
else \
if [ $(FREE_SIZE) -lt $(SIZE_MARGIN) ]; then \