diff --git a/Makefile b/Makefile index 6af42fdb79..00dfaf6225 100644 --- a/Makefile +++ b/Makefile @@ -182,9 +182,9 @@ bloaty: ## run bloaty size profiler bloaty -d compileunits -n 0 -s file $(FIRMWARE_BUILD_DIR)/firmware.elf | less sizecheck: ## check sizes of binary files - test $(BOARDLOADER_MAXSIZE) -ge $(shell stat -c%s $(BOARDLOADER_BUILD_DIR)/boardloader.bin) - test $(BOOTLOADER_MAXSIZE) -ge $(shell stat -c%s $(BOOTLOADER_BUILD_DIR)/bootloader.bin) - test $(FIRMWARE_MAXSIZE) -ge $(shell stat -c%s $(FIRMWARE_BUILD_DIR)/firmware.bin) + test $(BOARDLOADER_MAXSIZE) -ge $(shell wc -c < $(BOARDLOADER_BUILD_DIR)/boardloader.bin) + test $(BOOTLOADER_MAXSIZE) -ge $(shell wc -c < $(BOOTLOADER_BUILD_DIR)/bootloader.bin) + test $(FIRMWARE_MAXSIZE) -ge $(shell wc -c < $(FIRMWARE_BUILD_DIR)/firmware.bin) combine: ## combine boardloader + bootloader + prodtest into one combined image ./tools/combine_firmware \ diff --git a/SConscript.firmware b/SConscript.firmware index a33b90daf7..e048627b2a 100644 --- a/SConscript.firmware +++ b/SConscript.firmware @@ -430,6 +430,6 @@ program_bin = env.Command( action=[ '$OBJCOPY -O binary -j .vendorheader -j .header -j .flash -j .data $SOURCE $TARGET', '$BINCTL $TARGET -h', - 'dd if=$TARGET of=build/firmware/header.tosign bs=1 count=1024 skip=`stat -c%s embed/firmware/vendorheader.bin`', + 'dd if=$TARGET of=build/firmware/header.tosign bs=1 count=1024 skip=`wc -c < embed/firmware/vendorheader.bin | tr -d " "`', '$BINCTL $TARGET -s 1:2 `$COMBINE_SIGN firmware build/firmware/header.tosign 4747474747474747474747474747474747474747474747474747474747474747 4848484848484848484848484848484848484848484848484848484848484848`', ], ) diff --git a/SConscript.prodtest b/SConscript.prodtest index de82418be9..456c8aae19 100644 --- a/SConscript.prodtest +++ b/SConscript.prodtest @@ -154,6 +154,6 @@ program_bin = env.Command( action=[ '$OBJCOPY -O binary -j .vendorheader -j .header -j .flash -j .data $SOURCE $TARGET', '$BINCTL $TARGET -h', - 'dd if=$TARGET of=build/prodtest/header.tosign bs=1 count=1024 skip=`stat -c%s embed/firmware/vendorheader.bin`', + 'dd if=$TARGET of=build/prodtest/header.tosign bs=1 count=1024 skip=`wc -c < embed/firmware/vendorheader.bin | tr -d " "`', '$BINCTL $TARGET -s 1:2 `$COMBINE_SIGN firmware build/prodtest/header.tosign 4747474747474747474747474747474747474747474747474747474747474747 4848484848484848484848484848484848484848484848484848484848484848`', ], )