Skip to content

Using ifdtool breaks calculations #21

@miczyg1

Description

@miczyg1

When using ifdtool (by passing microarch parameter), the non-BIOS regions are not accounted for properly and increase overall size of calculated components compare to binary size.

./openness_score/openness_score.py ~/msi_ms7d25_v1.1.3_ddr4.rom --microarch adl
'/home/miczyg/msi_ms7d25_v1.1.3_ddr4.rom' detected as Dasharo image

'/home/miczyg/msi_ms7d25_v1.1.3_ddr4.rom' Dasharo image statistics:
...
WARNING: Something went wrong.
The component sizes do not sum up to the image size. 46137344 != 33554432
Dasharo image /home/miczyg/msi_ms7d25_v1.1.3_ddr4.rom:
	Image size: 33554432
	Number of regions: 37
	Number of CBFSes: 4
	Total open-source code size: 6948571
	Total closed-source code size: 8534148
	Total data size: 1472711
	Total empty size: 29181914

When not using microarch parameter (no ifdtool), there is no warning:

./openness_score/openness_score.py ~/msi_ms7d25_v1.1.3_ddr4.rom
'/home/miczyg/msi_ms7d25_v1.1.3_ddr4.rom' detected as Dasharo image

'/home/miczyg/msi_ms7d25_v1.1.3_ddr4.rom' Dasharo image statistics:
...
Dasharo image /home/miczyg/msi_ms7d25_v1.1.3_ddr4.rom:
	Image size: 33554432
	Number of regions: 37
	Number of CBFSes: 4
	Total open-source code size: 6948571
	Total closed-source code size: 8693892
	Total data size: 1472711
	Total empty size: 16439258

The non-BIOS regions detected by ifdtool should be properly incorporated in calculations, i.e. the flashmap parser should avoid classifying regions which are outside of BIOS region. Here the UNUSED region overlaps with DevExp2 IFD region for example:

| UNUSED | 0x400000 | 0xc00000 | empty |

In case of msi_ms7d25_v1.1.3_ddr4.rom binary (and possibly others too).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions