Author Topic: Observation about SP Flash Tool scatter files  (Read 1664 times)

TauPan

  • Newbie
  • *
  • Posts: 43
    • View Profile
    • http://
Observation about SP Flash Tool scatter files
« on: September 16, 2020, 08:50:20 am »
I don't know if it's plain obvious but I just noticed today that scatter files can be simply parsed as yaml (e.g. from python).
Code: [Select]
>>> import yaml
>>> with open('Cosmo_MT6771_Android_full_stock_edited_scatter.txt') as f:
...   obj = yaml.load(f)
...
>>> type(obj)
<class 'list'>
>>> obj[0]
{'general': 'MTK_PLATFORM_CFG', 'info': [{'block_size': 131072, 'platform': 'MT6771', 'project': 'k71v1_64_bsp', 'storage': 'EMMC', 'config_version': 'V1.1.2', 'boot_channel': 'MSDC_0'}]}                                           
>>> obj[1]                                                                                                                                                                                                                             
{'type': 'SV5_BL_BIN', 'boundary_check': True, 'partition_index': 'SYS0', 'storage': 'HW_STORAGE_EMMC', 'is_upgradable': True, 'physical_start_addr': 0, 'linear_start_addr': 0, 'reserve': 0, 'region': 'EMMC_BOOT_1', 'partition_size': 1048576, 'partition_name': 'preloader', 'is_download': True, 'operation_type': 'BOOTLOADERS', 'empty_boot_needed': False, 'is_reserved': False, 'file_name': 'preloader_k71v1_64_bsp.bin'}

As you can see, the return value is a list and the order is identical to the order in the file. I don't know if the general section is always first and followed by the partitions.

I've been meaning to write a small python script that can rename the readback dumps automatically (by matching the `partition_index` to the last part of the `ROM_<nn>` filename). Maybe I'll get around to that at some point.

This is probably valid for all MTK devices, not just from Planet Computers.