[U-Boot] [PATCH 0/2] Remove MTD sub-directories from the root Makefile

Hello,
Two patches to do what we discussed with jagan a few weeks back: remove MTD sub-directories from the root Makefile. The first patch has already been sent but as I could not see it in mainline (I can't remember when I sent this one) I decided to put it back here. The second one does simple moves, proof that everything looks ok is in Travis's report [1].
[1] https://travis-ci.org/miquelraynal/u-boot/builds/456683592
Thanks, Miquèl
Miquel Raynal (2): mtd: nand: let the raw NAND devices be compiled upon selection Makefile: move MTD-related lines in coherent Makefiles
Makefile | 5 ----- drivers/Makefile | 1 + drivers/mtd/Makefile | 3 +++ drivers/mtd/nand/Makefile | 3 +++ 4 files changed, 7 insertions(+), 5 deletions(-)

Today way is to rely on CMD_NAND to be selected and from the root Makefile compile what is in drivers/mtd/nand/raw.
While this will work most of the time with decent configurations, it is better to also compile this subsystem upon simple request in the configuration. Otherwise, a user not selecting CMD_NAND but selecting NAND and any of the controller drivers will not see their build. Fix this weird situation by adding a single line in the nand/ directory Kconfig file.
Signed-off-by: Miquel Raynal miquel.raynal@bootlin.com --- drivers/mtd/nand/Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index a358bc680e..2c33447995 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -2,4 +2,5 @@
nandcore-objs := core.o bbt.o obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o +obj-$(CONFIG_NAND) += raw/ obj-$(CONFIG_MTD_SPI_NAND) += spi/

On Sun, 18 Nov 2018 21:07:31 +0100 Miquel Raynal miquel.raynal@bootlin.com wrote:
Today way is to rely on CMD_NAND to be selected and from the root Makefile compile what is in drivers/mtd/nand/raw.
While this will work most of the time with decent configurations, it is better to also compile this subsystem upon simple request in the configuration. Otherwise, a user not selecting CMD_NAND but selecting NAND and any of the controller drivers will not see their build. Fix this weird situation by adding a single line in the nand/ directory Kconfig file.
Signed-off-by: Miquel Raynal miquel.raynal@bootlin.com
drivers/mtd/nand/Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index a358bc680e..2c33447995 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -2,4 +2,5 @@
nandcore-objs := core.o bbt.o obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o +obj-$(CONFIG_NAND) += raw/
Can we rename the Kconfig option into CONFIG_MTD_RAW_NAND to make it consistent with the other ones (should be done in a separate patch).
Also, this patch breaks the build: the raw/ dir will be included twice, and the linker will complain about duplicate symbols. Note that your second patch fixes the bug introduce here, but I guess this is the reason this patch was no applied/accepted when initially submitted.
obj-$(CONFIG_MTD_SPI_NAND) += spi/

A move has been started to move Makefile definitions out of the main root file and instead move these lines in their respective directory. This change does not change any logic already in place, it just moves lines to make the reading easier.
Signed-off-by: Miquel Raynal miquel.raynal@bootlin.com --- Makefile | 5 ----- drivers/Makefile | 1 + drivers/mtd/Makefile | 3 +++ drivers/mtd/nand/Makefile | 4 +++- 4 files changed, 7 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..e407c529c4 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -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..f51ec473ea 100644 --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile @@ -20,3 +20,6 @@ obj-$(CONFIG_STM32_FLASH) += stm32_flash.o obj-$(CONFIG_RENESAS_RPC_HF) += renesas_rpc_hf.o
obj-y += nand/ +obj-y += onenand/ +obj-y += spi/ +obj-$(CONFIG_CMD_UBI) += ubi/ diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 2c33447995..99ca69ef95 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -2,5 +2,7 @@
nandcore-objs := core.o bbt.o obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o -obj-$(CONFIG_NAND) += raw/ +ifneq (,$(findstring y,$(CONFIG_CMD_NAND)$(CONFIG_CMD_MTD))) +obj-y += raw/ +endif obj-$(CONFIG_MTD_SPI_NAND) += spi/

On Sun, 18 Nov 2018 21:07:32 +0100 Miquel Raynal miquel.raynal@bootlin.com wrote:
A move has been started to move Makefile definitions out of the main root file and instead move these lines in their respective directory. This change does not change any logic already in place, it just moves lines to make the reading easier.
Signed-off-by: Miquel Raynal miquel.raynal@bootlin.com
Makefile | 5 ----- drivers/Makefile | 1 + drivers/mtd/Makefile | 3 +++ drivers/mtd/nand/Makefile | 4 +++-
As mentioned in my review of patch 1, patch 1 changes should be moved there to keep things bisectable.
4 files changed, 7 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..e407c529c4 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -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..f51ec473ea 100644 --- a/drivers/mtd/Makefile +++ b/drivers/mtd/Makefile @@ -20,3 +20,6 @@ obj-$(CONFIG_STM32_FLASH) += stm32_flash.o obj-$(CONFIG_RENESAS_RPC_HF) += renesas_rpc_hf.o
obj-y += nand/ +obj-y += onenand/ +obj-y += spi/ +obj-$(CONFIG_CMD_UBI) += ubi/ diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 2c33447995..99ca69ef95 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -2,5 +2,7 @@
nandcore-objs := core.o bbt.o obj-$(CONFIG_MTD_NAND_CORE) += nandcore.o -obj-$(CONFIG_NAND) += raw/ +ifneq (,$(findstring y,$(CONFIG_CMD_NAND)$(CONFIG_CMD_MTD))) +obj-y += raw/ +endif obj-$(CONFIG_MTD_SPI_NAND) += spi/
Let's get rid of that too by adding a 'select NAND' to the CMD_NAND entry.
Also, there's no reason to select raw NAND support when CMD_MTD is selected.
participants (2)
-
Boris Brezillon
-
Miquel Raynal