[PATCH v2 2/2] mips: generic: allow not building DTB in

From: Alexandre Belloni
Date: Tue Jun 26 2018 - 07:57:29 EST


Allow not building any DTB in the generic kernel so it gets smaller. This
is necessary for ocelot because it can be built as a legacy platform that
needs a built-in DTB and it can also handle a separate DTB once it is
updated with a more modern bootloader. In the latter case, it is preferable
to not include any DTB in the kernel image so it is smaller.

Signed-off-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
---
Changes in v2:
- rebased on v4.18-rc1

arch/mips/Kconfig | 1 -
arch/mips/Makefile | 2 +-
arch/mips/generic/Kconfig | 1 +
arch/mips/generic/vmlinux.its.S | 2 ++
4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 3f9deec70b92..2cc43f51fa6f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -85,7 +85,6 @@ choice
config MIPS_GENERIC
bool "Generic board-agnostic MIPS kernel"
select BOOT_RAW
- select BUILTIN_DTB
select CEVT_R4K
select CLKSRC_MIPS_GIC
select COMMON_CLK
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index e2122cca4ae2..5c5d491d736e 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -401,7 +401,7 @@ endif
CLEAN_FILES += vmlinux.32 vmlinux.64

# device-trees
-core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/
+core-y += arch/mips/boot/dts/

%.dtb %.dtb.S %.dtb.o: | scripts
$(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@
diff --git a/arch/mips/generic/Kconfig b/arch/mips/generic/Kconfig
index 08e33c6b2539..13692b84928e 100644
--- a/arch/mips/generic/Kconfig
+++ b/arch/mips/generic/Kconfig
@@ -3,6 +3,7 @@ if MIPS_GENERIC

config LEGACY_BOARDS
bool
+ select BUILTIN_DTB
help
Select this from your board if the board must use a legacy, non-UHI,
boot protocol. This will cause the kernel to scan through the list of
diff --git a/arch/mips/generic/vmlinux.its.S b/arch/mips/generic/vmlinux.its.S
index 1a08438fd893..9c954f2ae561 100644
--- a/arch/mips/generic/vmlinux.its.S
+++ b/arch/mips/generic/vmlinux.its.S
@@ -21,6 +21,7 @@
};
};

+#if IS_ENABLED(CONFIG_BUILTIN_DTB)
configurations {
default = "conf@default";

@@ -29,4 +30,5 @@
kernel = "kernel@0";
};
};
+#endif
};
--
2.18.0