[PATCH RESEND u-boot-spi 0/8] Fix `mtd erase` when used with mtdpart

Marek Behun marek.behun at nic.cz
Fri Jul 23 03:18:46 CEST 2021


Hi Jagan,

On Wed, 21 Jul 2021 21:46:56 +0530
Jagan Teki <jagan at amarulasolutions.com> wrote:

> Found the build error with CI [1], would you please check?
> 
> [1] https://source.denx.de/u-boot/custodians/u-boot-spi/-/pipelines/8345
> 
> Jagan.

OK I think I've found out what is the problem. I've pushed new version
into github CI to check if it builds correctly.

The problem seems to be that after this series the function
spi_nor_erase() calls mtd_erase_callback(), which is declared in the
header file include/linux/mtd/mtd.h, if CONFIG_MTD_PARTITIONS is
enabled, and defined as a static inline function otherwise.

The problem is that for some boards we have CONFIG_MTD_PARTITIONS
together with CONFIG_SPL_SPI_FLASH_SUPPORT. But in SPL, mtdpart.c
(where mtd_erase_callback() is defined) is not compiled at all.

Thus this leads to undefined reference to mtd_erase_callback().

This is another proof that the whole mtd subsystem has become a gross
spaghetti code where hacks upon hacks were introduced by different
people to solve different purposes, and the result makes me angry. :-D

We really need to rewrite this.

Anyway, for now I will just send v2 of this series with another patch
fixing this issue, once CI ends smoothly.

Marek


More information about the U-Boot mailing list