Repository navigation
mtd: the report's flash size is as far as the partitions reach - #309
Conversation
On the GM8126 and GM8128 no partition holds the 4 KiB boot header at 0, and on the camera of #305 not the block at 0x66000 either, so the bytes the partitions cover came to 16 MiB less 8 KiB and the report said 15M. Where the kernel gives offsets, the chip is at least as big as the last partition reaches. Backups keep counting covered bytes: that is what they hold.
PR Summary by Qodomtd: report flash size as far as partitions reach, not covered bytes
AI Description
Merge Risk
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can move or hide resolved findings to focus on what still needs action |
For #305: the GM8128's 16 MiB NOR shows as
rom: size: 15M.The report's size was what the partitions cover, each byte once (
mtd_covered_size()), rounded down to MiB. On that camera, no partition holds the 4 KiB boot header at0x0or the 4 KiB block at0x66000, as its kernel's own partition lines show (comment). That leaves 16 MiB − 8 KiB, which rounds down to 15M. The GM8126 vendor dump in qemu-bench is the same with the header alone: 16 MiB − 4 KiB, also 15M.New
mtd_chip_size(): where the kernel gives offsets (sysfs,mtdparts=, or the boot log's partition lines), the chip is at least as big as the furthest any partition reaches. Without offsets, it is what the partitions cover, as before. Only the report'ssize:line uses it.mtd_flash_size()is unchanged:backupandrestorestill use the covered size, because that is what a backup holds.On a layout with no gaps and no unpartitioned head, the two numbers are equal and nothing changes.
Tested
mtd_alias_testgains the reporter's partition table:0xffe000covered, chip0x1000000. It also covers an existing gapped layout, the no-offsets case, and no partitions at all.gm8126machine on the GM8126 vendor image, whose kernel logs the partition offsets:masterreportssize: 15M, this branchsize: 16M.ipcinfois byte-identical (153852 bytes on arm32).