From: Ferass El Hafidi <funderscore@postmarketos.org>
To: Massimo Pegorer <massimo.pegorer+oss@gmail.com>
Cc: u-boot@lists.u-boot-project.org, "Tom Rini" <trini@konsulko.com>,
"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
"Alexey Charkov" <alchark@flipper.net>,
"Casey Connolly" <casey.connolly@linaro.org>,
"Julien Masson" <jmasson@baylibre.com>,
"Carlo Caione" <ccaione@baylibre.com>,
"Jörg Sommer" <joerg@jo-so.de>,
"Johan Jonker" <jbx6244@gmail.com>,
"Denis Mukhin" <dmukhin@ford.com>
Subject: Re: [PATCH] block: add legacy block support for TPL
Date: Fri, 27 Nov 2026 14:51:12 +0000 [thread overview]
Message-ID: <tp61ew.2jah7hm6wep6j@postmarketos.org> (raw)
In-Reply-To: <CAC928HZLjxgkuoyMaZa8jFimiVPTGX+hkuN6dppCJeFja9axYA@mail.gmail.com>
Hi Massimo, sorry for the delay ^^
On Mon, 09 Nov 2026 19:51, Massimo Pegorer <massimo.pegorer+oss@gmail.com> wrote:
>Hi,
>
>Il giorno lun 9 nov 2026 alle ore 09:01 Ferass El Hafidi ha scritto:
>>
>> Legacy block support is only selectable for SPL. However it is
>> useful in TPL too, where the full block driver (with DM and whatnot)
>> will not fit.
>> Add a TPL_LEGACY_BLOCK kconfig option to enable legacy block support in
>> TPL. Note that it is hidden in menuconfig (just like the SPL variant).
>>
>> Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
>> ---
>> As I've been working on some TPL support for Amlogic I noticed that I
>> could not choose the legacy block driver (while I could choose it for SPL).
>> Given we only have 44K available, DM is a tight fit there so I'd rather not
>> enable it where possible to save space.
>>
>> Adding the ability to select the legacy block driver in TPL seemed like
>> a good option for the same reasons it is already available for SPL
>> builds. And indeed it works just fine there too.
>> ---
>> disk/Makefile | 4 ++--
>> drivers/Makefile | 7 ++++++-
>> drivers/block/Kconfig | 12 +++++++++++-
>> drivers/block/Makefile | 2 +-
>> 4 files changed, 20 insertions(+), 5 deletions(-)
>>
>> diff --git a/disk/Makefile b/disk/Makefile
>> index c16876e2073..18b839f6ecd 100644
>> --- a/disk/Makefile
>> +++ b/disk/Makefile
>> @@ -10,8 +10,8 @@ ifdef CONFIG_$(PHASE_)BLK
>> obj-$(CONFIG_$(PHASE_)PARTITIONS) += disk-uclass.o
>> endif
>>
>> -# Must have BLK or SPL_LEGACY_BLOCK to support partitions
>> -ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_SPL_LEGACY_BLOCK),)
>> +# Must have BLK or LEGACY_BLOCK to support partitions
>> +ifneq ($(CONFIG_$(PHASE_)BLK),$(CONFIG_$(PHASE_)LEGACY_BLOCK),)
>> obj-$(CONFIG_$(PHASE_)DOS_PARTITION) += part_dos.o
>> obj-$(CONFIG_$(PHASE_)ISO_PARTITION) += part_iso.o
>> obj-$(CONFIG_$(PHASE_)EFI_PARTITION) += part_efi.o
>> diff --git a/drivers/Makefile b/drivers/Makefile
>> index 5403206159c..989be07cd02 100644
>> --- a/drivers/Makefile
>> +++ b/drivers/Makefile
>> @@ -74,7 +74,6 @@ obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
>> obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
>> obj-$(CONFIG_SPL_USB_HOST) += usb/host/
>> obj-$(CONFIG_SPL_SATA) += ata/ scsi/
>> -obj-$(CONFIG_SPL_LEGACY_BLOCK) += block/
>> obj-$(CONFIG_SPL_THERMAL) += thermal/
>> obj-$(CONFIG_SPL_UFS_SUPPORT) += scsi/ ufs/
>>
>> @@ -82,6 +81,12 @@ endif
>> endif
>> endif
>>
>> +ifdef CONFIG_XPL_BUILD
>> +
>> +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += block/
>> +
>> +endif
>
>What's the purpose of the ifdeffery? I would expect it to work with or without
>ifdeffery exactly in the same way. If CONFIG_XPL_BUILD is not defined,
>CONFIG_$(PHASE_)LEGACY_BLOCK becomes CONFIG_LEGACY_BLOCK which does not exists.
>
Yes, CONFIG_LEGACY_BLOCK does not exist. I believe there was a reason as
to why the legacy block driver could not be chosen for U-Boot proper so
I didn't question it. That's why there's this `ifdef`.
Is it something you'd like me to change in the next revision?
>> +
>> ifdef CONFIG_TPL_BUILD
>>
>> obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR) += ddr/fsl/
>> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
>> index d44cf4bcb6b..e6f1d82267b 100644
>> --- a/drivers/block/Kconfig
>> +++ b/drivers/block/Kconfig
>> @@ -15,7 +15,17 @@ config SPL_LEGACY_BLOCK
>> default y if SPL_AHCI_PCI
>> help
>> Some devices require block support whether or not DM is enabled. This
>> - is only supported in SPL. With this, the blk uclass is not used, but
>> + is only supported in SPL and TPL. With this, the blk uclass is not used, but
>> + instead a legacy implementation of block devices is used, with all
>> + devices consisting of 'struct blk_desc' records.
>> +
>> +config TPL_LEGACY_BLOCK
>> + bool # "Enable Legacy Block Device in TPL"
>> + depends on TPL
>> + default y if TPL_MMC || SCSI || NVME || IDE
>> + help
>> + Some devices require block support whether or not DM is enabled. This
>> + is only supported in SPL and TPL. With this, the blk uclass is not used, but
>> instead a legacy implementation of block devices is used, with all
>> devices consisting of 'struct blk_desc' records.
>>
>> diff --git a/drivers/block/Makefile b/drivers/block/Makefile
>> index c827fa81a2d..e88914db283 100644
>> --- a/drivers/block/Makefile
>> +++ b/drivers/block/Makefile
>> @@ -6,7 +6,7 @@
>> obj-$(CONFIG_$(PHASE_)BLK) += blk-uclass.o
>>
>> ifndef CONFIG_$(PHASE_)BLK
>> -obj-$(CONFIG_SPL_LEGACY_BLOCK) += blk_legacy.o
>> +obj-$(CONFIG_$(PHASE_)LEGACY_BLOCK) += blk_legacy.o
>
>Should we have VPL_LEGACY_BLOCK too?
>Right now, this breaks sandbox_vpl_defconfig build.
Yes, I overlooked it but yes we definitely should. I'll add it to the
next revision. Thanks for pointing it out!
Best regards,
Ferass
next prev parent reply other threads:[~2026-11-27 14:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 8:01 [PATCH] block: add legacy block support for TPL Ferass El Hafidi
2026-11-09 15:10 ` Tom Rini
2026-11-09 19:51 ` Massimo Pegorer
2026-11-09 19:56 ` Tom Rini
2026-11-27 14:51 ` Ferass El Hafidi [this message]
2026-11-27 15:34 ` Ferass El Hafidi
2026-11-28 9:54 ` Massimo Pegorer
2026-11-28 20:55 ` Ferass El Hafidi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tp61ew.2jah7hm6wep6j@postmarketos.org \
--to=funderscore@postmarketos.org \
--cc=alchark@flipper.net \
--cc=casey.connolly@linaro.org \
--cc=ccaione@baylibre.com \
--cc=dmukhin@ford.com \
--cc=jbx6244@gmail.com \
--cc=jmasson@baylibre.com \
--cc=joerg@jo-so.de \
--cc=massimo.pegorer+oss@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.org \
--cc=xypron.glpk@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.