From: Dinesh Maniyam <[email protected]> Guard the Bad Block Table (BBT) scanning with `#ifndef 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 <[email protected]> --- 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 chip->scan_bbt(mtd); +#endif } if (!chip->bbt) -- 2.43.7

