Skip to content

imagemap: structural and cosmetic review follow-ups

Daniel Golle u-boot 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest11 patches 1 replyIn review
  2. v211 patches 5 repliesSuperseded
  3. v111 patches 12 repliesSuperseded

Changes in v3 from the cover letter

- Patch 11: the region pointer is declared const, which fixes the build failure Tom reported on v2 (20261030175906.GA3333978@bill-the-cat), and the three buffer sizes become macros so the guard array has a constant size.
- Patches 1 to 10: no changes.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11test: cmd_ut: keep the suite list alphabeticaltest/cmd_ut.c+2 -20 replies
2/11boot: bootm: derive the header probe sizeboot/bootm.c+2 -10 replies
3/11boot: imagemap: correct the lookup guard rationaleboot/imagemap.c+5 -40 replies
4/11test: boot: imagemap: declare locals at the toptest/boot/imagemap.c+12 -140 replies
5/11doc: imagemap: describe the API and phase gatingdoc/develop/imagemap.rst+22 -80 replies
6/11doc: develop: sort the imagemap index entrydoc/develop/index.rst+1 -10 replies
7/11boot: imagemap: name the device after its partitionboot/imagemap.c+25 -30 replies
8/11boot: bootm: set the imagemap from bootm_start()boot/bootm.c+4 -100 replies
9/11boot: fit: share the external-data offset calculationboot/image-fit.c+91 -750 replies
10/11boot: build the imagemap pointers only when enabledboot/bootm.c boot/image-fit.c include/bootm.h +1 more+97 -220 replies
11/11test: boot: imagemap: caller-owned region not resizedtest/boot/imagemap.c+97 -00 replies

Reviews trailers per patch

All 11 patches have a Reviewed-by or Acked-by.

PatchSimon Glass
1/11R-b
2/11R-b
3/11R-b
4/11R-b
5/11R-b
6/11R-b
7/11R-b
8/11R-b
9/11R-b
10/11R-b
11/11R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/11] imagemap: structural and cosmetic review follow-ups

The clean-up half of the v1 review of the imagemap series ([email protected]). It applies on top of "imagemap: fixes from the v1 review", which carries the correctness changes and which several of these patches touch the same lines as.

Patches 1 to 4 are self-contained tidy-ups without any functional
changes: the suite list put back in alphabetical order, a derived size for the header probe in place of a bare 64, a corrected rationale on the imagemap_lookup() guard, and test locals hoisted out of an anonymous block and a mid-block declaration.

Patches 5 and 6 correct the documentation: the imagemap_create() signature, which callers a reader can actually reach, bootmeth_openwrt described as a future consumer, the index entry sorted, and the section on phase gating that the commit adding the file claimed was there.

Patches 7 to 10 are the structural ones which do introduce functional
changes: imagemap devices are named after the partition they cover and hold a name driver model owns, so two mappings on one block device stay distinct. bootm_start() sets the imagemap itself, keeping the invariant in one function. The data-position and totalsize-alignment sequence is shared between fit_image_get_data() and the storage path, which also gives the latter the range check it lacked and settles the two spellings of the alignment. Finally the two imagemap pointers compile only when CONFIG_IMAGEMAP is on, reached through accessors that fold away when it is off.

Patch 11 adds a new unit test Simon had asked for in his review.

The sandbox defconfig symbol ordering and the FIT_VERITY_NODENAME rename that the v1 review also asked for are already in the tree, so they are not separate patches in this posting.

One review point is not addressed here. Moving the imagemap out of the global images struct and into an explicit parameter of fit_image_get_data() means changing that function and fit_image_verify(), both public, and their callers under arch/arm, arch/x86, arch/arm/mach-k3, cmd/, common/ and tools/. It is also a design question rather than a
cleanup: the transparency of the verification path is exactly what lets imagemap hook in without touching the FIT code. I would rather agree the shape first than guess at it, so it is left out and proposed separately.

Tested on sandbox as for the first series: every commit builds, "ut imagemap" passes 14/14 under "ut -r3", host tools build, the documentation builds with no warnings, and a full test.py run matches unmodified next. Built with CONFIG_IMAGEMAP=n as well, which patch 10 exists to keep working.

---
v3:
- Patch 11: the region pointer is declared const, which fixes the build failure Tom reported on v2 (20261030175906.GA3333978@bill-the-cat), and the three buffer sizes become macros so the guard array has a constant size.
- Patches 1 to 10: no changes.
v2:
- Note that the series applies on top of "imagemap: fixes from the v1 review", which carries the correctness changes.
- The sandbox defconfig symbol ordering and the FIT_VERITY_NODENAME rename that the v1 review also asked for are already in the tree, so the cover no longer counts them as patches in this series; they were not dropped between postings.
- Patch 3: the guard rationale now says "same width" instead of "same rank"; on ILP32 loff_t outranks ulong and the subtraction stays signed, and it is the LP64 unsigned conversion that makes the guard essential.
- Patch 7: the named path duplicates the caller's name directly instead of copying it through a fixed-size buffer that truncated it.
- Patch 9: the helper is renamed fit_image_get_ext_data_offset() to match its siblings, fit_image_get_data() folds the embedded case into an early return, and the message explains the dropped signed-value guard.
- Patch 10: adds bootm_info_set_imagemap(), keeps the bootm_info_* guards in step with bootm_imagemap(), keeps the device in a local in the storage path, and shares the release between the OS-GO and error paths in a helper.
- Patch 11: the scenario comment no longer names the reviewer, the bare 64 and 256 become named constants, and the pointer comparison drops its casts.
- Patches 1, 2, 4, 5, 6 and 8: no changes.

Daniel Golle (11):
test: cmd_ut: keep the suite list alphabetical
boot: bootm: derive the header probe size
boot: imagemap: correct the lookup guard rationale
test: boot: imagemap: declare locals at the top
doc: imagemap: describe the API and phase gating
doc: develop: sort the imagemap index entry
boot: imagemap: name the device after its partition
boot: bootm: set the imagemap from bootm_start()
boot: fit: share the external-data offset calculation
boot: build the imagemap pointers only when enabled
test: boot: imagemap: caller-owned region not resized

 boot/bootm.c             |  55 ++++++------
 boot/image-fit.c         | 175 +++++++++++++++++++++------------------
 boot/imagemap.c          |  37 +++++++--
 doc/develop/imagemap.rst |  30 +++++--
 doc/develop/index.rst    |   2 +-
 include/bootm.h          |  31 +++++++
 include/image.h          |  31 +++++++
 test/boot/imagemap.c     | 123 +++++++++++++++++++++++----
 test/cmd_ut.c            |   4 +-
 9 files changed, 353 insertions(+), 135 deletions(-)

base-commit: e36b675ebc4c41f1f4187c46d363d581c371d538

Signature · 1 line
2.56.0