[PATCH] driver: nand: skip BBT scan during SPL to reduce size and complexity
Maniyam, Dinesh
dinesh.maniyam at altera.com
Tue Nov 25 04:02:04 CET 2025
Hi
On 25/11/2025 8:00 am, Heinrich Schuchardt wrote:
> [CAUTION: This email is from outside your organization. Unless you
> trust the sender, do not click on links or open attachments as it may
> be a fraudulent email attempting to steal your information and/or
> compromise your computer.]
>
> 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.
>
> Overlooked. I will make changes to the commit message.
>
>> 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
>
> I will use the preferred.
>
> Thanks
> Dinesh
>
>> chip->scan_bbt(mtd);
>> +#endif
>> }
>>
>> if (!chip->bbt)
>
More information about the U-Boot
mailing list