[U-Boot] [RFC PATCH 02/17] kconfig: add basic Kconfig files

Masahiro Yamada
2014-03-17T08:52:57Z

We want to start with a basic set of CONFIG macros:

- CONFIG_SPL, CONFIG_TPL
Enable to support SPL/TPL image

- CONFIG_SPL_BUILD, CONFIG_TPL_BUILD
CONFIG_SPL_BUILD is set when building SPL/TPL.
CONFIG_TPL_BUILD is set when building TPL.
These macros are automatically set and cannot be changed.

- Architecture select, CONFIG_ARM, CONFIG_PPC, CONFIG_X86, etc.

- CPU select
Some architectures support various CPU families.
For ex. PowerPC can choose CPU family from
CONFIG_74xx_7xx, CONFIG_MPC512X, CONFIG_5xx, etc.

- Some macros to keep compatibility
CONFIG_SYS_ARCH, CONFIG_SYS_CPU, CONFIG_SYS_SOC, CONFIG_SYS_BOARD,
CONFIG_SYS_VENDOR should be moved to Kconfig from include/config.h.
They corresponds to the fields of boards.cfg.
CONFIG_SYS_CONFIG_NAME and CONFIG_SYS_EXTRA_OPTIONS correspond
to "Options" fields of boards.cfg.

Please note they can be set to different values
between the main image and SPL.
Tegra SoCs have CONFIG_SYS_CPU="armv7" for U-Boot main
whereas CONFIG_SYS_CPU="arm720t" for SPL.

- Misc
Some macros just for record. Not used during build.
CONFIG_BOARD_MAINTAINER corresponds to the last field of boards.cfg.
CONFIG_ORPHAN_BOARD corresponds to the first field, "Active/Orphan".

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

Kconfig | 47 ++++++++++++++++++++++++++++
arch/Kconfig | 81 +++++++++++++++++++++++++++++++++++++++++++++++++
arch/arc/Kconfig | 10 ++++++
arch/arm/Kconfig | 10 ++++++
arch/avr32/Kconfig | 9 ++++++
arch/blackfin/Kconfig | 9 ++++++
arch/m68k/Kconfig | 47 ++++++++++++++++++++++++++++
arch/microblaze/Kconfig | 9 ++++++
arch/mips/Kconfig | 23 ++++++++++++++
arch/nds32/Kconfig | 9 ++++++
arch/nios2/Kconfig | 9 ++++++
arch/openrisc/Kconfig | 9 ++++++
arch/powerpc/Kconfig | 59 +++++++++++++++++++++++++++++++++++
arch/sandbox/Kconfig | 9 ++++++
arch/sh/Kconfig | 27 +++++++++++++++++
arch/sparc/Kconfig | 23 ++++++++++++++
arch/x86/Kconfig | 9 ++++++
board/Kconfig | 33 ++++++++++++++++++++
18 files changed, 432 insertions(+)
create mode 100644 Kconfig
create mode 100644 arch/Kconfig
create mode 100644 arch/arc/Kconfig
create mode 100644 arch/arm/Kconfig
create mode 100644 arch/avr32/Kconfig
create mode 100644 arch/blackfin/Kconfig
create mode 100644 arch/m68k/Kconfig
create mode 100644 arch/microblaze/Kconfig
create mode 100644 arch/mips/Kconfig
create mode 100644 arch/nds32/Kconfig
create mode 100644 arch/nios2/Kconfig
create mode 100644 arch/openrisc/Kconfig
create mode 100644 arch/powerpc/Kconfig
create mode 100644 arch/sandbox/Kconfig
create mode 100644 arch/sh/Kconfig
create mode 100644 arch/sparc/Kconfig
create mode 100644 arch/x86/Kconfig
create mode 100644 board/Kconfig

diff --git a/Kconfig b/Kconfig
new file mode 100644
index 0000000..4e383d2
--- /dev/null
+++ b/Kconfig
@@ -0,0 +1,47 @@
+#
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/kconfig-language.txt.
+#
+mainmenu "U-Boot $UBOOTVERSION $BUILD_MODE Configuration"
+
+config UBOOTVERSION
+ string
+ option env="UBOOTVERSION"
+
+config KCONFIG_OBJDIR
+ string
+ option env="KCONFIG_OBJDIR"
+
+config BUILD_MODE
+ string
+ default "SPL" if $KCONFIG_OBJDIR="spl/"
+ default "TPL" if $KCONFIG_OBJDIR="tpl/"
+ default "Main"
+
+menu "General setup"
+
+config SPL_BUILD
+ bool
+ depends on BUILD_MODE="SPL" || BUILD_MODE="TPL"
+ default y
+
+config TPL_BUILD
+ bool
+ depends on BUILD_MODE="TPL"
+ default y
+
+config SPL
+ bool
+ prompt "Build SPL image" if !SPL_BUILD
+ default y if SPL_BUILD
+
+config TPL
+ bool
+ depends on SPL
+ prompt "Build TPL image" if !SPL_BUILD
+ default y if TPL_BUILD
+
+endmenu # General setup
+
+source "arch/Kconfig"
+source "board/Kconfig"
diff --git a/arch/Kconfig b/arch/Kconfig
new file mode 100644
index 0000000..88d99cf
--- /dev/null
+++ b/arch/Kconfig
@@ -0,0 +1,81 @@
+choice
+ prompt "Architecture select"
+ default SANDBOX
+
+config ARC
+ bool "ARC architecture"
+
+config ARM
+ bool "ARM architecture"
+
+config AVR32
+ bool "AVR32 architecture"
+
+config BLACKFIN
+ bool "Blackfin architecture"
+
+config M68K
+ bool "M68000 architecture"
+
+config MICROBLAZE
+ bool "MicroBlaze architecture"
+
+config MIPS
+ bool "MIPS architecture"
+
+config NDS32
+ bool "NDS32 architecture"
+
+config NIOS2
+ bool "Nios II architecture"
+
+config OPENRISC
+ bool "OpenRISC architecture"
+
+config PPC
+ bool "PowerPC architecture"
+
+config SANDBOX
+ bool "Sandbox"
+
+config SH
+ bool "SuperH architecture"
+
+config SPARC
+ bool "SPARC architecture"
+
+config X86
+ bool "x86 architecture"
+
+endchoice
+
+# Defined temporarily for backward compatibility.
+config SYS_ARCH
+ string
+
+config SYS_CPU
+ string
+
+source "arch/arc/Kconfig"
+source "arch/arm/Kconfig"
+source "arch/avr32/Kconfig"
+source "arch/blackfin/Kconfig"
+source "arch/m68k/Kconfig"
+source "arch/microblaze/Kconfig"
+source "arch/mips/Kconfig"
+source "arch/nds32/Kconfig"
+source "arch/nios2/Kconfig"
+source "arch/openrisc/Kconfig"
+source "arch/powerpc/Kconfig"
+source "arch/sandbox/Kconfig"
+source "arch/sh/Kconfig"
+source "arch/sparc/Kconfig"
+source "arch/x86/Kconfig"
+
+config SOC_DIR
+ bool "Specify SoC Directory"
+
+config SYS_SOC
+ depends on SOC_DIR
+ string "SoC Name"
+ default ""
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
new file mode 100644
index 0000000..9884254
--- /dev/null
+++ b/arch/arc/Kconfig
@@ -0,0 +1,10 @@
+menu "ARC architecture"
+ depends on ARC
+
+config SYS_ARCH
+ default "arc"
+
+config SYS_CPU
+ default "arc700"
+
+endmenu
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
new file mode 100644
index 0000000..14f6cc6
--- /dev/null
+++ b/arch/arm/Kconfig
@@ -0,0 +1,10 @@
+menu "ARM architecture"
+ depends on ARM
+
+config SYS_ARCH
+ default "arm"
+
+config SYS_CPU
+ prompt "CPU type"
+
+endmenu
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
new file mode 100644
index 0000000..a516883
--- /dev/null
+++ b/arch/avr32/Kconfig
@@ -0,0 +1,9 @@
+if AVR32
+
+config SYS_ARCH
+ default "avr32"
+
+config SYS_CPU
+ default "at32ap"
+
+endif
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
new file mode 100644
index 0000000..7dc376c
--- /dev/null
+++ b/arch/blackfin/Kconfig
@@ -0,0 +1,9 @@
+if BLACKFIN
+
+config SYS_ARCH
+ default "blackfin"
+
+config SYS_CPU
+ default "blackfin"
+
+endif
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
new file mode 100644
index 0000000..adbd59f
--- /dev/null
+++ b/arch/m68k/Kconfig
@@ -0,0 +1,47 @@
+if M68K
+
+config SYS_ARCH
+ default "m68k"
+
+config SYS_CPU
+ default "mcf5227x" if MCF5227x
+ default "mcf523x" if MCF523x
+ default "mcf52x2" if MCF52x2 || MCF520x
+ default "mcf532x" if MCF532x || MCF5301x
+ default "mcf5445x" if MCF5441x || MCF5445x
+ default "mcf547x_8x" if MCF547x_8x
+
+choice
+ prompt "M68000 CPU type"
+ default MCF5227x
+
+config MCF5227x
+ bool "Support MCF5227x processor family"
+
+config MCF523x
+ bool "Support MCF523x processor family"
+
+config MCF52x2
+ bool "Support MCF52x2 processor family"
+
+config MCF520x
+ bool "Support MCF520x processor family"
+
+config MCF532x
+ bool "Support MCF532x processor family"
+
+config MCF5301x
+ bool "Support MCF5301x processor family"
+
+config MCF5441x
+ bool "Support MCF5441x processor family"
+
+config MCF5445x
+ bool "Support MCF5445x processor family"
+
+config MCF547x_8x
+ bool "Support MCF547x_8x processor family"
+
+endchoice
+
+endif
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
new file mode 100644
index 0000000..785cb4a
--- /dev/null
+++ b/arch/microblaze/Kconfig
@@ -0,0 +1,9 @@
+if MICROBLAZE
+
+config SYS_ARCH
+ default "microblaze"
+
+config SYS_CPU
+ default "microblaze"
+
+endif
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
new file mode 100644
index 0000000..931f03a
--- /dev/null
+++ b/arch/mips/Kconfig
@@ -0,0 +1,23 @@
+menu "MIPS architecture"
+ depends on MIPS
+
+config SYS_ARCH
+ default "mips"
+
+config SYS_CPU
+ default "mips32" if MIPS32
+ default "mips64" if MIPS64
+
+choice
+ prompt "MIPS CPU type"
+ default MIPS32
+
+config MIPS32
+ bool "MIPS 32bit"
+
+config MIPS64
+ bool "MIPS 64bit"
+
+endchoice
+
+endmenu
diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
new file mode 100644
index 0000000..0aa9d69
--- /dev/null
+++ b/arch/nds32/Kconfig
@@ -0,0 +1,9 @@
+if NDS32
+
+config SYS_ARCH
+ default "nds32"
+
+config SYS_CPU
+ default "n1213"
+
+endif
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
new file mode 100644
index 0000000..122d953
--- /dev/null
+++ b/arch/nios2/Kconfig
@@ -0,0 +1,9 @@
+if NIOS2
+
+config SYS_ARCH
+ default "nios2"
+
+config SYS_CPU
+ default "nios2"
+
+endif
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
new file mode 100644
index 0000000..4fc8856
--- /dev/null
+++ b/arch/openrisc/Kconfig
@@ -0,0 +1,9 @@
+if OPENRISC
+
+config SYS_ARCH
+ default "openrisc"
+
+config SYS_CPU
+ default "or1200"
+
+endif
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
new file mode 100644
index 0000000..8017c2a
--- /dev/null
+++ b/arch/powerpc/Kconfig
@@ -0,0 +1,59 @@
+menu "PowerPC architecture"
+ depends on PPC
+
+config SYS_ARCH
+ default "powerpc"
+
+config SYS_CPU
+ default "74xx_7xx" if 74xx_7xx
+ default "mpc512x" if MPC512X
+ default "mpc5xx" if 5xx
+ default "mpc5xxx" if MPC5xxx
+ default "mpc824x" if MPC824X
+ default "mpc8260" if MPC8260
+ default "mpc83xx" if MPC83xx
+ default "mpc85xx" if MPC85xx
+ default "mpc86xx" if MPC86xx
+ default "mpc8xx" if 8xx
+ default "ppc4xx" if 4xx
+
+choice
+ prompt "PowerPC CPU type"
+ default 8xx
+
+config 74xx_7xx
+ bool "Support 74xx processor"
+
+config MPC512X
+ bool "Support MPC512X family"
+
+config 5xx
+ bool "Support MPC5xx family"
+
+config MPC5xxx
+ bool "Support MPC5xxx family"
+
+config MPC824X
+ bool "Support MPC824X family"
+
+config MPC8260
+ bool "Support MPC8260 family"
+
+config MPC83xx
+ bool "Support MPC83xx family"
+
+config MPC85xx
+ bool "Support MPC85xx family"
+
+config MPC86xx
+ bool "Support MPC86xx family"
+
+config 8xx
+ bool "Support MPC8xx family"
+
+config 4xx
+ bool "Support PPC4xx family"
+
+endchoice
+
+endmenu
diff --git a/arch/sandbox/Kconfig b/arch/sandbox/Kconfig
new file mode 100644
index 0000000..ea1cb6a
--- /dev/null
+++ b/arch/sandbox/Kconfig
@@ -0,0 +1,9 @@
+if SANDBOX
+
+config SYS_ARCH
+ default "sandbox"
+
+config SYS_CPU
+ default "sandbox"
+
+endif
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
new file mode 100644
index 0000000..06a32cf
--- /dev/null
+++ b/arch/sh/Kconfig
@@ -0,0 +1,27 @@
+menu "SuperH architecture"
+ depends on SH
+
+config SYS_ARCH
+ default "sh"
+
+config SYS_CPU
+ default "sh2" if SH2
+ default "sh3" if SH3
+ default "sh4" if SH4
+
+choice
+ prompt "SuperH CPU type"
+ default SH2
+
+config SH2
+ bool "Support SH2 processor"
+
+config SH3
+ bool "Support SH3 processor"
+
+config SH4
+ bool "Support SH4 processor"
+
+endchoice
+
+endmenu
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
new file mode 100644
index 0000000..155298c
--- /dev/null
+++ b/arch/sparc/Kconfig
@@ -0,0 +1,23 @@
+menu "SPARC architecture"
+ depends on SPARC
+
+config SYS_ARCH
+ default "sparc"
+
+config SYS_CPU
+ default "leon2" if LEON2
+ default "leon3" if LEON3
+
+choice
+ prompt "SPARC CPU type"
+ default LEON2
+
+config LEON2
+ bool "Support LEON2 processor"
+
+config LEON3
+ bool "Support LEON3 processor"
+
+endchoice
+
+endmenu
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
new file mode 100644
index 0000000..f77325c
--- /dev/null
+++ b/arch/x86/Kconfig
@@ -0,0 +1,9 @@
+if X86
+
+config SYS_ARCH
+ default "x86"
+
+config SYS_CPU
+ default "x86"
+
+endif
diff --git a/board/Kconfig b/board/Kconfig
new file mode 100644
index 0000000..4f8ef20
--- /dev/null
+++ b/board/Kconfig
@@ -0,0 +1,33 @@
+menu "Board settings"
+
+config SYS_BOARD
+ string "Board Name"
+
+config VENDOR_DIR
+ bool "Specify Vendor Directory"
+
+config SYS_VENDOR
+ depends on VENDOR_DIR
+ string "Vendor Name"
+ default ""
+
+config SYS_CONFIG_NAME
+ string "U-Boot config file"
+ help
+ The config file under include/configs/.
+ Delete this CONFIG after completely switching to Kbuild.
+
+config SYS_EXTRA_OPTIONS
+ string "Extra Options"
+ depends on !SPL_BUILD
+ default ""
+
+config BOARD_MAINTAINER
+ string "Board Maintainer"
+ depends on !SPL_BUILD
+
+config ORPHAN_BOARD
+ bool "Orphan Board"
+ depends on !SPL_BUILD
+
+endmenu
--
1.8.3.2