-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
tools/mpremote/commands.py: Validate romfs image. #17037
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
dpgeorge
merged 1 commit into
micropython:master
from
iabdalkader:fix_mpremote_romfs_path
Apr 7, 2025
Merged
tools/mpremote/commands.py: Validate romfs image. #17037
dpgeorge
merged 1 commit into
micropython:master
from
iabdalkader:fix_mpremote_romfs_path
Apr 7, 2025
+7
−2
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #17037 +/- ##
=======================================
Coverage 98.54% 98.54%
=======================================
Files 169 169
Lines 21890 21890
=======================================
Hits 21571 21571
Misses 319 319 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Code size report: |
dpgeorge
reviewed
Apr 1, 2025
99246a5 to
8db75a8
Compare
dpgeorge
reviewed
Apr 7, 2025
dpgeorge
reviewed
Apr 7, 2025
8db75a8 to
807229f
Compare
dpgeorge
approved these changes
Apr 7, 2025
Currently the tool allows writing an invalid ROMFS image, with a bad header or images smaller than minimum size, and only checks the image extension. This commit allows deploying a ROMFS with either a ".img" or ".romfs" extension (in the future support may be added for other extensions that have different semantics, eg a manifest), and validates the image header before writing. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
807229f to
9e9be83
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Currently the tool allows writing invalid romfs image, with a bad header or images smaller than minimum size, and only checks the image extension.
This patch allows deploying romfs with any extension, and validates the image header and minimum size before writing.
Testing
Before this patch, I tested deploying 1 byte images, or all zero images, and in both cases the tool deploys them as long as they have the correct extension. Deeper validation could be performed in both the tool and runtime, as I've encountered a runtime issue with a corrupted image (during development) at least once.