Attention is currently required from: Aarya.
Bill XIE has posted comments on this change by Bill XIE. ( https://review.coreboot.org/c/flashrom/+/84614?usp=email )
Change subject: erasure_layout: Erase larger block only when all sub-block need erase ......................................................................
Patch Set 1:
(1 comment)
Commit Message:
https://review.coreboot.org/c/flashrom/+/84614/comment/eccd8c79_ce0529d4?usp... : PS1, Line 15: More severely, since this logic only selects a block and delects : its sub-blocks when half of sub-blocks need erase, but this logic : does not deselect "double sub-blocks (sub-blocks of sub-block)" not : reach the limit under this block, the logic may cause duplicated : erase. Test case for this could be generate with the following shell script:
#!/bin/sh dd if=/dev/urandom bs=16M count=1 of=0.rom cp 0.rom 1.rom #! Overwrite first 130 64k blocks to exceed half dd if=/dev/urandom bs=64k count=130 conv=notrunc of=1.rom #! Overwrite last 2 4k blocks dd if=/dev/urandom bs=4k count=2 seek=4094 conv=notrunc of=1.rom
Test with:
$ /path/to/flashrom -p dummy:emulate=W25Q128FV,image=chip.rom -Vw 0.rom
$ /path/to/flashrom -p dummy:emulate=W25Q128FV,image=chip.rom -Vw 1.rom
Result:
Reading old flash chip contents... read_flash: region (00000000..0xffffff) is readable, reading range (00000000..0xffffff).
done. erase_write: region (00000000..0xffffff) is writable, erasing range (00000000..0xffffff). 0xffe000..0xffefff verify_range: Verifying region (00000000..0xffffff) read_flash: region (00000000..0xffffff) is readable, reading range (0xffe000..0xffefff). E(ffe000:ffefff)0xfff000..0xffffff verify_range: Verifying region (00000000..0xffffff) read_flash: region (00000000..0xffffff) is readable, reading range (0xfff000..0xffffff). E(fff000:ffffff)000000..0xffffff verify_range: Verifying region (00000000..0xffffff) read_flash: region (00000000..0xffffff) is readable, reading range (00000000..0xffffff). E(0:ffffff)write_flash: region (00000000..0xffffff) is writable, writing range (00000000..0xffffff). W(0:ffffff)Erase/write done from 0 to ffffff Verifying flash... read_flash: region (00000000..0xffffff) is readable, reading range (00000000..0xffffff). VERIFIED. Writing chip.rom
(ffe000:ffefff) and (fff000:ffffff) get erased twice, and (820000:ffdfff) also gets erased but should not. This commit will fix this.