File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 22# SPDX-License-Identifier: MIT
33
44import argparse
5+ import sys
56
67# Expected layout of the firmware image:
78#
2122FIRMWARE_ROUND_SIZE = 256 * 1024
2223
2324
24- def make_firmware (uboot_blob , uimage_blob ) :
25+ def make_firmware (uboot_blob : bytes , uimage_blob : bytes ) -> bytes :
2526
2627 if len (uboot_blob ) > UBOOT_MAX_SIZE :
27- print ("u-boot file is bigger than expected. Using only the first 256KiB." )
28- uboot_blob = uboot_blob [:UBOOT_MAX_SIZE ]
28+ print (
29+ f"u-boot file is bigger than 256KiB ({ len (uboot_blob )} bytes), it is not safe to use." ,
30+ file = sys .stderr ,
31+ )
32+ exit (1 )
2933
3034 if len (uimage_blob ) > UIMAGE_MAX_SIZE :
31- raise ValueError ("uImage file is too big." )
35+ print (f"uImage file is too big ({ len (uimage_blob )} > { UIMAGE_MAX_SIZE } )." , file = sys .stderr )
36+ exit (1 )
3237
3338 # Gets combined size, rounded to nearest expected size.
3439 combined_size = UIMAGE_OFFSET + len (uimage_blob )
You can’t perform that action at this time.
0 commit comments