@@ -363,7 +363,7 @@ def convert(self, value, param, ctx):
363363 help = 'When encrypting the image using AES, select a 128 bit or '
364364 '256 bit key len.' )
365365@click .option ('--compression' , default = 'disabled' ,
366- type = click .Choice (['disabled' , 'lzma2' ]),
366+ type = click .Choice (['disabled' , 'lzma2' , 'lzma2armthumb' ]),
367367 help = 'Enable image compression using specified type. '
368368 'Will fall back without image compression automatically '
369369 'if the compression increases the image size.' )
@@ -513,7 +513,7 @@ def sign(key, public_key_format, align, version, pad_sig, header_size,
513513 custom_tlvs , compression_tlvs , int (encrypt_keylen ), clear ,
514514 baked_signature , pub_key , vector_to_sign , user_sha )
515515
516- if compression == "lzma2" :
516+ if compression in [ "lzma2" , "lzma2armthumb" ] :
517517 compressed_img = image .Image (version = decode_version (version ),
518518 header_size = header_size , pad_header = pad_header ,
519519 pad = pad , confirm = confirm , align = int (align ),
@@ -527,6 +527,8 @@ def sign(key, public_key_format, align, version, pad_sig, header_size,
527527 "dict_size" : comp_default_dictsize , "lp" : comp_default_lp ,
528528 "lc" : comp_default_lc }
529529 ]
530+ if compression == "lzma2armthumb" :
531+ compression_filters .insert (0 , {"id" :lzma .FILTER_ARMTHUMB })
530532 compressed_data = lzma .compress (img .get_infile_data (),filters = compression_filters ,
531533 format = lzma .FORMAT_RAW )
532534 uncompressed_size = len (img .get_infile_data ())
0 commit comments