Skip to content

mkimage script error message is misleading #2084

@pguyot

Description

@pguyot

https://github.com/pguyot/la_machine/actions/runs/21701856567/job/62584180263?pr=28

Run escript build/mkimage.erl --root_dir . --config mkimage.config --out la_machine.img
Writing output to la_machine.img
boot file is ./build/libs/esp32boot/esp32boot.avm
=============================================
Wrote bootloader (19680 bytes) at offset 0x0 (0)
Padding 13088 bytes
Wrote partition-table (3072 bytes) at offset 0x8000 (32768)
Padding 29696 bytes
Wrote AtomVM Virtual Machine (1154144 bytes) at offset 0x10000 (65536)
Padding 25504 bytes
Wrote La Machine (266124 bytes) at offset 0x130000 (1245184)
Stacktrace: [{mkimage,'-mkimage/4-fun-2-',5,
                      [{file,"build/mkimage.erl"},{line,153}]},
             {lists,foldl_1,3,[{file,"lists.erl"},{line,2471}]},
             {mkimage,do_main,1,[{file,"build/mkimage.erl"},{line,46}]},
             {mkimage,main,1,[{file,"build/mkimage.erl"},{line,25}]},
             {escript,run,2,[{file,"escript.erl"},{line,906}]},
             {escript,start,1,[{file,"escript.erl"},{line,420}]},
             {init,start_it,1,[]},
             {init,start_em,1,[]}]
%%
%% Error: insufficient space for segment "La Machine sounds".  Over by: 3980 bytes

%%
Syntax:
    escript mkimage.erl <options>

The following options are supported:
    * --root_dir <path>    Path to the root directory of the AtomVM git checkout
    * --boot <path>        Path to a esp32boot.avm file
    * --build_dir <path>   Path to the AtomVM build directory (defaults to root_dir/build, if unspecifeid)
    * --out <path>         Output path for AtomVM image file
    * --config <path>      Path to mkimage configuration file
    * --help               Print this help

The config is:

#{
    segments => [
        #{
            name => "bootloader",
            offset => "0x0",
            path => [
                "build/bootloader/bootloader.bin",
                "../../AtomVM/src/platforms/esp32/build/bootloader/bootloader.bin"
            ]
        },
        #{
            name => "partition-table",
            offset => "0x8000",
            path => ["partitions.bin"]
        },
        #{
            name => "AtomVM Virtual Machine",
            offset => "0x10000",
            path => [
                "build/atomvm-esp32.bin", "../../AtomVM/src/platforms/esp32/build/atomvm-esp32.bin"
            ]
        },
        #{
            name => "La Machine",
            offset => "0x130000",
            path => ["la_machine.avm"]
        },
        #{
            name => "La Machine sounds",
            offset => "0x170000",
            path => ["sounds.bin"]
        }
    ]
}.

The partition that is too big is not "La Machine sounds" but "La Machine".

Metadata

Metadata

Assignees

No one assigned

    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