Skip to content

Fix bugs in esp32 mkimage.erl script#2093

Open
UncleGrumpy wants to merge 2 commits intoatomvm:release-0.7from
UncleGrumpy:mkimage-fix
Open

Fix bugs in esp32 mkimage.erl script#2093
UncleGrumpy wants to merge 2 commits intoatomvm:release-0.7from
UncleGrumpy:mkimage-fix

Conversation

@UncleGrumpy
Copy link
Copy Markdown
Collaborator

@UncleGrumpy UncleGrumpy commented Feb 10, 2026

Fixes an FD leak, the image file was never closed properly after writing. Fixes a misleading error message when a binary overflows its partition. Catches errors in file:write/2 operations, rather than blindly continuing.

Closes #2084
Closes #2094

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

@UncleGrumpy UncleGrumpy force-pushed the mkimage-fix branch 2 times, most recently from dc96177 to ff8e506 Compare February 10, 2026 01:50
@UncleGrumpy UncleGrumpy marked this pull request as draft February 10, 2026 01:59
@UncleGrumpy UncleGrumpy marked this pull request as ready for review February 10, 2026 02:24
@UncleGrumpy UncleGrumpy requested a review from pguyot February 10, 2026 02:25
@UncleGrumpy UncleGrumpy force-pushed the mkimage-fix branch 2 times, most recently from 729ef65 to 89313e8 Compare February 10, 2026 15:54
@UncleGrumpy UncleGrumpy force-pushed the mkimage-fix branch 4 times, most recently from 9faef56 to 6913849 Compare February 10, 2026 22:57
@UncleGrumpy UncleGrumpy changed the base branch from main to release-0.7 April 10, 2026 06:39
CHANGELOG.md Outdated
- Stop using deprecated `term_from_int32` on ESP32 platform
- Fixed bug in ESP32 mkimage.sh leading to non-fatal "unary operator expected" error
- Fixed `fd` leak in ESP32 mkimage.erl
- Fixed mmkimage.erl unaligned end of data problems that can prevent
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

s/mmkimage/mkimage/

Fix the non-fatal `./build/mkimage.sh: line 38: [: =: unary operator
expected` error that can occur when no options are passed.

Signed-off-by: Winford <winford@object.stream>
* Fix an FD leak, by properly closing the image file after writing.
* Fix a misleading error message when a binary overflows its partition.
* Fix an unaligned end of data problem that can prevent flashing with a
web-flasher tool.
* Catch errors in file:write/2 operations, rather than blindly continue
when an error is returned.

Closes atomvm#2084
Closes atomvm#2094

Signed-off-by: Winford <winford@object.stream>
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.

mkimage should 4-byte align/pad last segment mkimage script error message is misleading

3 participants