[PATCH] driver: nand: skip BBT scan during SPL to reduce size and complexity
Heinrich Schuchardt
xypron.glpk at gmx.de
Tue Nov 25 01:00:15 CET 2025
On 11/13/25 04:03, dinesh.maniyam at altera.com wrote:
> From: Dinesh Maniyam <dinesh.maniyam at altera.com>
>
> Guard the Bad Block Table (BBT) scanning with `#ifndef CONFIG_SPL_BUILD`
Thank you for looking into this issue.
In the patch you use CONFIG_XPL_BUILD not CONFIG_SPL_BUILD.
> to prevent running `chip->scan_bbt()` in SPL builds.
>
> The SPL only requires basic NAND read functionality to load the next
> stage and does not need full BBT management. Running the BBT scan in
> SPL unnecessarily increases code size, memory usage, and boot time.
>
> This change ensures the BBT is scanned only in U-Boot proper, where the
> full NAND subsystem and dynamic memory are available.
>
> Signed-off-by: Dinesh Maniyam <dinesh.maniyam at altera.com>
> ---
> drivers/mtd/nand/raw/nand_base.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index 48e3685d995..4dc2a19b8f6 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -532,7 +532,9 @@ static int nand_block_checkbad(struct mtd_info *mtd, loff_t ofs, int allowbbt)
> if (!(chip->options & NAND_SKIP_BBTSCAN) &&
> !(chip->options & NAND_BBT_SCANNED)) {
> chip->options |= NAND_BBT_SCANNED;
> +#ifndef CONFIG_XPL_BUILD
Running scripts/checkpatch.pl creates a warning because you use #ifdef
instead of preferred
if (IS_ENABLED(CONFIG_XPL_BUILD))
Best regards
Heinrich
> chip->scan_bbt(mtd);
> +#endif
> }
>
> if (!chip->bbt)
More information about the U-Boot
mailing list