@@ -363,7 +363,7 @@ def convert(self, value, param, ctx):
363
363
help = 'When encrypting the image using AES, select a 128 bit or '
364
364
'256 bit key len.' )
365
365
@click .option ('--compression' , default = 'disabled' ,
366
- type = click .Choice (['disabled' , 'lzma2' ]),
366
+ type = click .Choice (['disabled' , 'lzma2' , 'lzma2armthumb' ]),
367
367
help = 'Enable image compression using specified type. '
368
368
'Will fall back without image compression automatically '
369
369
'if the compression increases the image size.' )
@@ -513,7 +513,7 @@ def sign(key, public_key_format, align, version, pad_sig, header_size,
513
513
custom_tlvs , compression_tlvs , int (encrypt_keylen ), clear ,
514
514
baked_signature , pub_key , vector_to_sign , user_sha )
515
515
516
- if compression == "lzma2" :
516
+ if compression in [ "lzma2" , "lzma2armthumb" ] :
517
517
compressed_img = image .Image (version = decode_version (version ),
518
518
header_size = header_size , pad_header = pad_header ,
519
519
pad = pad , confirm = confirm , align = int (align ),
@@ -527,6 +527,8 @@ def sign(key, public_key_format, align, version, pad_sig, header_size,
527
527
"dict_size" : comp_default_dictsize , "lp" : comp_default_lp ,
528
528
"lc" : comp_default_lc }
529
529
]
530
+ if compression == "lzma2armthumb" :
531
+ compression_filters .insert (0 , {"id" :lzma .FILTER_ARMTHUMB })
530
532
compressed_data = lzma .compress (img .get_infile_data (),filters = compression_filters ,
531
533
format = lzma .FORMAT_RAW )
532
534
uncompressed_size = len (img .get_infile_data ())
0 commit comments