Remove oversize binaries (#21976)

This stops a situation where a user could end up flashing oversize firmware soft bricking hardware.
master
Dasky 2023-09-12 02:55:05 +01:00 committed by GitHub
parent 3561c3a1f9
commit 62105b5c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -392,6 +392,8 @@ check-size:
if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \ if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
$(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \ $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then \ 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); \ printf "\n * $(MSG_FILE_TOO_BIG)"; $(PRINT_ERROR_PLAIN); \
else \ else \
if [ $(FREE_SIZE) -lt $(SIZE_MARGIN) ]; then \ if [ $(FREE_SIZE) -lt $(SIZE_MARGIN) ]; then \