[PATCH v3 1/2] binman: cosmetic: code formatting fixes

Simon Glass sjg at chromium.org
Mon Sep 30 20:52:24 CEST 2024


Hi Brian,

On Mon, 30 Sept 2024 at 10:10, Brian Ruley <brian.ruley at gehealthcare.com> wrote:
>
> Conform to the style guide used in the project by making the following
> changes:
> * Use single quotes for multiline strings (except docstrings)
> * Fix line width to 79 cols
> * Use f-string instead of formatting a regular string
>
> Signed-off-by: Brian Ruley <brian.ruley at gehealthcare.com>
> ---
>  tools/binman/etype/nxp_imx8mcst.py | 28 +++++++++++++++++++++-------
>  1 file changed, 21 insertions(+), 7 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

Thanks for doing this.

Some of my comments on the other patch could be applied here, if you prefer.

>
> diff --git a/tools/binman/etype/nxp_imx8mcst.py b/tools/binman/etype/nxp_imx8mcst.py
> index 8221517b0c..0c744a00d7 100644
> --- a/tools/binman/etype/nxp_imx8mcst.py
> +++ b/tools/binman/etype/nxp_imx8mcst.py
> @@ -23,7 +23,7 @@ from u_boot_pylib import tools
>  MAGIC_NXP_IMX_IVT = 0x412000d1
>  MAGIC_FITIMAGE    = 0xedfe0dd0
>
> -csf_config_template = """
> +csf_config_template = '''
>  [Header]
>    Version = 4.3
>    Hash Algorithm = sha256
> @@ -53,7 +53,7 @@ csf_config_template = """
>  [Authenticate Data]
>    Verification index = 2
>    Blocks = 0x1234 0x78 0xabcd "data.bin"
> -"""
> +'''
>
>  class Entry_nxp_imx8mcst(Entry_mkimage):
>      """NXP i.MX8M CST .cfg file generator and cst invoker
> @@ -69,9 +69,21 @@ class Entry_nxp_imx8mcst(Entry_mkimage):
>      def ReadNode(self):
>          super().ReadNode()
>          self.loader_address = fdt_util.GetInt(self._node, 'nxp,loader-address')
> -        self.srk_table = os.getenv('SRK_TABLE', fdt_util.GetString(self._node, 'nxp,srk-table', 'SRK_1_2_3_4_table.bin'))
> -        self.csf_crt = os.getenv('CSF_KEY', fdt_util.GetString(self._node, 'nxp,csf-crt', 'CSF1_1_sha256_4096_65537_v3_usr_crt.pem'))
> -        self.img_crt = os.getenv('IMG_KEY', fdt_util.GetString(self._node, 'nxp,img-crt', 'IMG1_1_sha256_4096_65537_v3_usr_crt.pem'))
> +        self.srk_table = os.getenv(
> +            'SRK_TABLE', fdt_util.GetString(
> +                            self._node, 'nxp,srk-table',
> +                            'SRK_1_2_3_4_table.bin'
> +                         ))
> +        self.csf_crt = os.getenv(
> +            'CSF_KEY', fdt_util.GetString(
> +                           self._node, 'nxp,csf-crt',
> +                           'CSF1_1_sha256_4096_65537_v3_usr_crt.pem'
> +                       ))
> +        self.img_crt = os.getenv(
> +            'IMG_KEY', fdt_util.GetString(
> +                           self._node, 'nxp,img-crt',
> +                           'IMG1_1_sha256_4096_65537_v3_usr_crt.pem'
> +                       ))
>          self.unlock = fdt_util.GetBool(self._node, 'nxp,unlock')
>          self.ReadEntries()
>
> @@ -118,7 +130,7 @@ class Entry_nxp_imx8mcst(Entry_mkimage):
>          tools.write_file(output_dname, data)
>
>          # Generate CST configuration file used to sign payload
> -        cfg_fname = tools.get_output_filename('nxp.csf-config-txt.%s' % uniq)
> +        cfg_fname = tools.get_output_filename(f'nxp.csf-config-txt.{uniq}')
>          config = configparser.ConfigParser()
>          # Do not make key names lowercase
>          config.optionxform = str
> @@ -127,7 +139,9 @@ class Entry_nxp_imx8mcst(Entry_mkimage):
>          config['Install SRK']['File'] = '"' + self.srk_table + '"'
>          config['Install CSFK']['File'] = '"' + self.csf_crt + '"'
>          config['Install Key']['File'] = '"' + self.img_crt + '"'
> -        config['Authenticate Data']['Blocks'] = hex(signbase) + ' 0 ' + hex(len(data)) + ' "' + str(output_dname) + '"'
> +        config['Authenticate Data']['Blocks'] = (hex(signbase) + ' 0 '
> +                                                 + hex(len(data)) + ' "'
> +                                                 + str(output_dname) + '"')
>          if not self.unlock:
>              config.remove_section('Unlock')
>          with open(cfg_fname, 'w') as cfgf:
> --
> 2.39.5
>

Regards,
Simon


More information about the U-Boot mailing list