Hi Dinesh On Thu, Nov 13, 2025 at 4:04 AM <[email protected]> wrote: > > 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 > } >
Look at the file there are other points where this ifdef is used for exactly the same reason and please check this commit commit fa87360b3ae28639f72e1c665b0631436693f60f Author: Roger Quadros <[email protected]> Date: Tue Dec 20 12:21:57 2022 +0200 mtd: rawnand: nand_base: Allow base driver to be used in SPL without nand_bbt nand_bbt.c is not being built with the nand_base driver during SPL build. This results in build failures if we try to access any nand_bbt related functions. Don't use any nand_bbt functions for SPL build. Signed-off-by: Roger Quadros <[email protected]> Signed-off-by: Michael Trimarchi <[email protected]> Signed-off-by: Dario Binacchi <[email protected]> Link: https://lore.kernel.org/all/[email protected] Michael > if (!chip->bbt) > -- > 2.43.7 > -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com

