-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
image_info: add -x option to extract segments to disk (ESPTOOL-947) #1023
Conversation
👋 Hello sven337, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. Click to see more instructions ...
Review and merge process you can expect ...
|
Hi @sven337, Although this feature is useful for your specific use case, it is not demanded enough to be included in esptool. Since esptool is open source, it is very easy to hack into it and bend it to do other things. If esptool contained all these hacks, maintaining and using it would be a nightmare. We appreciate every PR, but I have to close this. |
This is disappointing, as the feature is pretty small, and I don't see what justifies calling it a hack or introducing bloat given the size of the patch. Can you please describe how you evaluate "demand" for the feature? Seems like a chicken and egg problem to me: the feature isn't there at present, so people have to write their custom scripts to implement it when they need it, and you're not told about it. I can file feature requests but I assume you would close them as not in scope for esptool (and that seems strictly inferior to contributing patches). Who defines the scope and how? Perhaps I can make a case. The problem with having my own fork is that it reduces discoverability : unless I make a big effort to market my use case of firmware binary hacking, and the fork that supports it, other people with the same interest will have trouble identifying the prior art and will end up re-doing things from scratch. I am sympathetic to questions of maintainability, but I thought esptool was meant to be a swiss-army knife for ESP firmwares, and it seems like a disservice to the ESP hobbyist community to claim that modifying an existing binary firmware isn't a legitimate endeavor worth exposing features for. For that particular purpose, esptool has some missing things (make_image for ESP32, see my other PR ; this very PR ; updating checksums in an existing firmware). |
image_info prints information. One can capture it and redirect to files with or without modification. But if the segments need to be written out than it doesn't have anything to do with the command about showing general info about them. Therefore, it is out scope for image_info. You don't have to maintain a fork of esptool. You can create your scripts which can import esptool and do all kinds of special operations you need. Or you can just use pyelftools without esptool. Or use some ELF file reader applications. You hardcoded |
I considered to implement "image_extract" instead of doing this as part of "image_info", but that would have been more code, so I thought it would be neater in image_info. If you disagree, I can definitely move this to "image_extract", and take care of "all the rest", if that will let you consider the PR. On the other hand, if an extra commandline argument is considered bloat no matter what, and you're going to say no no matter what I improve, then I have nothing to say other than take note of your hostile stance towards use cases that probably shouldn't deserve your scorn. To elaborate on the use case: |
Please don't. I'm sorry if we made you think we want esptool to go in this direction. |
This adds ability to extract the segments from an image to disk. This can be useful for later analysis or modification, and was easy enough to add.
Pass -x to image_info. Destination directory is /tmp, file naming contains some metadata to make life easier.
I have tested this change with the following hardware & software combinations:
ESP32 firmware
I have run the esptool.py automated integration tests with this change and the above hardware:
None yet