Hi Daniel,
On 2026-08-23T19:12:43, Daniel Golle <[email protected]> wrote:
> configs: sandbox: enable imagemap and its storage backends
>
> Enable CONFIG_IMAGEMAP and, so the end-to-end unit tests can exercise
> the real block paths, the storage that feeds them: CONFIG_MTD_BLOCK
> and CONFIG_SPI_FLASH_MTD (a bare non-NAND MTD reached via mtd_blk) and
> CONFIG_CMD_UBI / CONFIG_UBI_BLOCK (a UBI volume reached via ubi_blk).
>
> Give the sandbox SPI-NOR two device-tree partitions for the mtd_blk
> test and add a clean sandbox NAND chip (nand@2, no injected errors) so
> UBI can format on it for the ubiblock test.
>
> Signed-off-by: Daniel Golle <[email protected]>
>
> arch/sandbox/dts/test.dts | 29 +++++++++++++++++++++++++++++
> configs/sandbox_defconfig | 6 ++++++
> 2 files changed, 35 insertions(+)
> diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
> index 5c97418783f..9e7d734a0b8 100644
> --- a/configs/sandbox_defconfig
> +++ b/configs/sandbox_defconfig
> @@ -400,3 +401,8 @@ CONFIG_UTHREAD=y
> CONFIG_UNIT_TEST=y
> CONFIG_UT_TIME=y
> CONFIG_UT_DM=y
> +CONFIG_MTD_BLOCK=y
> +CONFIG_SPI_FLASH_MTD=y
> +CONFIG_CMD_UBI=y
> +CONFIG_MTD_UBI=y
> +CONFIG_UBI_BLOCK=y
Tom does this anyway from time to time, but you could run make
savedefconfig to get these in the right order - also CONFIG_MTD_UBI is
implied by CONFIG_UBI_BLOCK
> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> @@ -1633,6 +1633,22 @@
> compatible = "spansion,m25p16", "jedec,spi-nor";
> spi-max-frequency = <40000000>;
> sandbox,filename = "spi.bin";
> +
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + partition@0 {
> + label = "nor-fit";
> + reg = <0x0 0x100000>;
> + };
> +
> + partition@100000 {
> + label = "nor-spare";
> + reg = <0x100000 0x100000>;
> + };
> + };
Adding fixed-partitions to spi.bin@0 combined with patch 1 (auto-bind
mtd_blk on non-NAND masters) means every sandbox test now grows two
extra block-device partitions on this flash. Please check the SPI
bootdev tests (bootdev_test_next_prio in test/boot/bootdev.c expects
only [email protected] / [email protected]) and dm_test_spi_flash in
test/dm/sf.c still pass; if not, the partition table would be better
hung off spi.bin@1 (which no existing test walks), or off a dedicated
third flash chip.
> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> @@ -2242,6 +2258,19 @@
> + /* Clean chip (no injected errors) for UBI/ubiblock tests */
> + nand@2 {
> + reg = <2>;
> + nand-ecc-mode = "soft";
> + sandbox,id = [00 e3];
> + sandbox,erasesize = <(8 * 1024)>;
> + sandbox,oobsize = <16>;
> + sandbox,pagesize = <512>;
> + sandbox,pages = <0x2000>;
> + sandbox,err-count = <0>;
> + sandbox,err-step-size = <512>;
> + };
Just to check - sandbox,err-count = <0> is the default, so this and
sandbox,err-step-size can be omitted. The comment can go too; the
property values already say it.
Regards,
Simon