Skip to contentSkip to conversation

Remove MTD sub-directories from the root Makefile

PATCH New Miquel Raynal 2 participants 5 messages Nov 18, 2018

Subsystems (3)
lore
Share & tools
lore

Miquel Raynal

author maintainer
#0 lore raw

cover 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(-)
Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH 1/2 mtd: nand: let the raw NAND devices be compiled upon selection

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.

---
 drivers/mtd/nand/Makefile | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/nand/Makefile +1 -0
index a358bc680e..2c33447995 100644
@@ -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/
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/2 mtd: nand: let the raw NAND devices be compiled upon selection

Quoted 20 lines · On Sun, 18 Nov 2018 21:07:31 +0100 Miquel Raynal <[email protected]>…

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.

---
 drivers/mtd/nand/Makefile | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/nand/Makefile +0 -0
index a358bc680e..2c33447995 100644

drivers/mtd/nand/Makefile line 5

Quoted 4 lines
drivers/mtd/nand/Makefile +1 -0
@@ -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.

Quoted 1 line
drivers/mtd/nand/Makefile +0 -0
 obj-$(CONFIG_MTD_SPI_NAND) += spi/
author maintainer
#3 lore raw

PATCH 2/2 Makefile: move MTD-related lines in coherent Makefiles

In reply to Miquel Raynal

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.

---
 Makefile                  | 5 -----
 drivers/Makefile          | 1 +
 drivers/mtd/Makefile      | 3 +++
 drivers/mtd/nand/Makefile | 4 +++-
 4 files changed, 7 insertions(+), 6 deletions(-)
Makefile +0 -5
index 552687db53..435d0257dd 100644
@@ -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/
drivers/Makefile +1 -0
index 4453c62ad3..e407c529c4 100644
@@ -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/
drivers/mtd/Makefile +3 -0
index 22ceda93c0..f51ec473ea 100644
@@ -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/
drivers/mtd/nand/Makefile +3 -1
index 2c33447995..99ca69ef95 100644
@@ -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/
Signature · 1 line
2.17.1
#4 lore raw

PATCH 2/2 Makefile: move MTD-related lines in coherent Makefiles

Quoted 11 lines · On Sun, 18 Nov 2018 21:07:32 +0100 Miquel Raynal <[email protected]>…

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.

---
 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.

Quoted 46 lines
 4 files changed, 7 insertions(+), 6 deletions(-)
Makefile +0 -5
index 552687db53..435d0257dd 100644
@@ -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/
drivers/Makefile +1 -0
index 4453c62ad3..e407c529c4 100644
@@ -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/
drivers/mtd/Makefile +3 -0
index 22ceda93c0..f51ec473ea 100644
@@ -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/
drivers/mtd/nand/Makefile +0 -0
index 2c33447995..99ca69ef95 100644

drivers/mtd/nand/Makefile line 8

Quoted 8 lines
drivers/mtd/nand/Makefile +3 -1
@@ -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.