
Move MTD-related lines out of the root Makefile. Put them in their respective directories.
Enclose some of these new lines to skip them when building the SPL (the SPL directly points to what is needed).
CONFIG_CMD_NAND is the symbol indicating support for raw NAND devices. This logic is broken and will be fixed afterwards. To let the 'mtd' command also use the raw NAND core, we add it in the condition. This will be cleaned later.
Signed-off-by: Miquel Raynal miquel.raynal@bootlin.com --- Makefile | 5 ----- drivers/Makefile | 3 ++- drivers/mtd/Makefile | 6 ++++++ drivers/mtd/nand/Makefile | 3 +++ 4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile index 552687db53..435d0257dd 100644 --- a/Makefile +++ b/Makefile @@ -688,11 +688,6 @@ libs-y += drivers/ libs-y += drivers/dma/ libs-y += drivers/gpio/ libs-y += drivers/i2c/ -libs-y += drivers/mtd/ -libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/raw/ -libs-y += drivers/mtd/onenand/ -libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/ -libs-y += drivers/mtd/spi/ libs-y += drivers/net/ libs-y += drivers/net/phy/ libs-y += drivers/pci/ diff --git a/drivers/Makefile b/drivers/Makefile index 4453c62ad3..e7c93875bb 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -6,7 +6,7 @@ obj-$(CONFIG_$(SPL_TPL_)DRIVERS_MISC_SUPPORT) += misc/ sysreset/ firmware/ obj-$(CONFIG_$(SPL_TPL_)I2C_SUPPORT) += i2c/ obj-$(CONFIG_$(SPL_TPL_)LED) += led/ obj-$(CONFIG_$(SPL_TPL_)MMC_SUPPORT) += mmc/ -obj-$(CONFIG_$(SPL_TPL_)NAND_SUPPORT) += mtd/nand/raw/ +obj-$(CONFIG_$(SPL_TPL_)NAND_SUPPORT) += mtd/nand/ obj-$(CONFIG_$(SPL_TPL_)PHY) += phy/ obj-$(CONFIG_$(SPL_TPL_)PINCTRL) += pinctrl/ obj-$(CONFIG_$(SPL_TPL_)RAM) += ram/ @@ -99,6 +99,7 @@ obj-$(CONFIG_QE) += qe/ obj-$(CONFIG_U_QE) += qe/ obj-y += mailbox/ obj-y += memory/ +obj-y += mtd/ obj-y += pwm/ obj-y += reset/ obj-y += input/ diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile index 22ceda93c0..aca3a0b811 100644 --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile @@ -19,4 +19,10 @@ obj-$(CONFIG_ST_SMI) += st_smi.o obj-$(CONFIG_STM32_FLASH) += stm32_flash.o obj-$(CONFIG_RENESAS_RPC_HF) += renesas_rpc_hf.o
+# SPL will manually build the files it needs +ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),) obj-y += nand/ +obj-y += onenand/ +obj-y += spi/ +obj-$(CONFIG_CMD_UBI) += ubi/ +endif diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index a358bc680e..99ca69ef95 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -2,4 +2,7 @@
nandcore-objs := core.o bbt.o obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o +ifneq (,$(findstring y,$(CONFIG_CMD_NAND)$(CONFIG_CMD_MTD))) +obj-y += raw/ +endif obj-$(CONFIG_MTD_SPI_NAND) += spi/