Skip to content

openness_score/coreboot.py: Handle FMAP layout problems #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

miczyg1
Copy link
Contributor

@miczyg1 miczyg1 commented Sep 4, 2024

It is possible for the FMAP layout to be non-contiguous. Catch such cases and count the non-described space as closed source.

Add SI_BIOS to the list of container regions, to avoid warnings.

Catch regions that may have numbers in the name.

Do not print a warning when a coreboot config is not found in a CBFS region not expected to have a config file.

It is possible for the FMAP layout to be non-contiguous. Catch such
cases and count the non-described space as closed source.

Add SI_BIOS to the list of container regions, to avoid warnings.

Catch regions that may have numbers in the name.

Do not print a warning when a coreboot config is not found in a CBFS
region not expected to have a config file.

Signed-off-by: Michał Żygowski <[email protected]>
@miczyg1
Copy link
Contributor Author

miczyg1 commented Sep 4, 2024

Example output:

./openness_score/openness_score.py protectli_vp66xx_v0.9.0.rom 
'protectli_vp66xx_v0.9.0.rom' detected as Dasharo image


'protectli_vp66xx_v0.9.0.rom' Dasharo image statistics:
CBFS region BOOTSPLASH:
	CBFS size: 524288
	Number of files: 1
	Open-source files size: 0
	Closed-source files size: 0
	Data size: 28
	Empty size: 524260
CBFS region FW_MAIN_A:
	CBFS size: 4587264
	Number of files: 13
	Open-source files size: 2370499
	Closed-source files size: 1675795
	Data size: 8622
	Empty size: 532348
CBFS region COREBOOT:
	CBFS size: 5210112
	Number of files: 17
	Open-source files size: 2460355
	Closed-source files size: 1675795
	Data size: 9058
	Empty size: 1064904
WARNING: FMAP layout is not contiguous.
The space between region RW_MRC_CACHE and RW_VPD is not described in the FMAP layout and will be classified as closed-source.

Dasharo image protectli_vp66xx_v0.9.0.rom:
	Image size: 16777216
	Number of regions: 25
	Number of CBFSes: 3
	Total open-source code size: 4830854
	Total closed-source code size: 8365094
	Total data size: 677420
	Total empty size: 2903848

Before it printed following warnings:

WARNING: Could not extract coreboot config
WARNING: Failed to extract LAN driver. It will not be counted as closed-source
WARNING: Failed to extract LAN driver. It will not be counted as closed-source
WARNING: Skipped SI_BIOS region, suspected to be a container
WARNING: Something went wrong.

Copy link

@philipanda philipanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the same results as you. The open/closed/data/empty sizes now sum up to the total file size. I can't say anything about the new regions added to region lists, but other than that the changes look good to me.

@miczyg1
Copy link
Contributor Author

miczyg1 commented Sep 5, 2024

I get the same results as you. The open/closed/data/empty sizes now sum up to the total file size. I can't say anything about the new regions added to region lists, but other than that the changes look good to me.

They were not added. Simply the regexp parsing the output of CBFSTOOL command didn't catch all regions. Now all regions are caught, that's the difference

@miczyg1 miczyg1 merged commit 3824bbb into main Sep 5, 2024
@miczyg1 miczyg1 deleted the fmap_layout_parsing_fixes branch September 5, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants