[PATCH 0/9] imagemap: Fix boot errors and resource lifetimes

Daniel Golle daniel at makrotopia.org
Fri Nov 13 16:08:55 PST 2026


This series fixes bootm error handling and resource lifetime issues
found while testing the imagemap boot path. It applies on top of main.

Ordinary allocation failures and unsupported bootm subcommands return
-1, which is also BOOTM_ERR_RESET. Return -ENOMEM and -ENOSYS for these
failures so they return to the shell. Sandbox gains the same subcommand
behaviour, with tests for unsupported subcommands and failed ramdisk
allocation.

A failed imagemap extension can leave the original mapping pointing at
unreserved memory, which cleanup may free after another user has
allocated it. Keep the original mapping and reservation until the larger
region has been read successfully. When the region moves, copy its
cached data and read only the added range. Document region replacement
and pointer lifetime, and add regression coverage for failed extensions
and relocation.

Removing and re-probing a SPI flash leaves its old mtd_blk device bound,
so each probe adds another block device. Unbind it and free its pointer
storage when deleting the MTD master, with a test for the block count
after re-probing.

Built for sandbox and qemu_arm64. The sandbox bootm and imagemap suites
pass all nine and 16 tests respectively. On QEMU, checked that
unsupported bdt and cmdline subcommands and a ramdisk allocation failure
return to the shell.

Daniel Golle (9):
  boot: Return distinct errors for ordinary bootm failures
  sandbox: bootm: Reject unsupported subcommands
  test: boot: bootm: Check ordinary failures
  boot: imagemap: Preserve mappings when an extend fails
  test: boot: imagemap: Check a failed extend
  boot: imagemap: Clarify region replacement
  mtd: Unbind the block device when removing a master
  test: dm: sf: Check the block count after re-probing
  boot: imagemap: Copy cached data when moving a region

 arch/arc/lib/bootm.c        |   5 +-
 arch/arm/lib/bootm.c        |   3 +-
 arch/microblaze/lib/bootm.c |   3 +-
 arch/mips/lib/bootm.c       |   3 +-
 arch/riscv/lib/bootm.c      |   3 +-
 arch/sandbox/lib/bootm.c    |   5 ++
 arch/x86/lib/bootm.c        |   2 +-
 boot/image-board.c          |  13 ++--
 boot/imagemap.c             | 151 ++++++++++++++++++++++--------------
 drivers/mtd/mtdcore.c       |  48 +++++++++++-
 include/imagemap.h          |  13 +++-
 test/boot/bootm.c           |  53 +++++++++++++
 test/boot/imagemap.c        |  85 ++++++++++++++++++++
 test/dm/sf.c                |  32 ++++++++
 14 files changed, 340 insertions(+), 79 deletions(-)


base-commit: 6487c50b8a40f2668ab98a892b9300ad5c181f38
-- 
2.56.0



More information about the openwrt-devel mailing list