All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Goldstein <cardoe@cardoe.com>
To: xen-devel@lists.xen.org
Cc: Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Doug Goldstein <cardoe@cardoe.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v8 03/28] build: build Kconfig and config rules
Date: Tue, 15 Dec 2015 07:13:01 -0600	[thread overview]
Message-ID: <1450185206-14259-4-git-send-email-cardoe@cardoe.com> (raw)
In-Reply-To: <1450185206-14259-1-git-send-email-cardoe@cardoe.com>

Wire in the Kconfig build and makefile rules to be able to generate
valid configuration files to be used by the build process but don't
actually use the output for affecting the Xen build. To avoid dragging
in most of Kbuild from the Linux kernel this adds Makefile.kconfig which
is our real entry point into building kconfig. This attempts to reuse as
much of the Xen build bits as possible and wire them to the bits that
kconfig expects to be provided by Kbuild.

CC: Ian Campbell <ian.campbell@citrix.com>
CC: Stefano Stabellini <stefano.stabellini@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 .gitignore                            |  6 ++++
 xen/Kconfig                           | 24 +++++++++++++
 xen/Makefile                          | 21 +++++++++++
 xen/arch/arm/Kconfig                  | 31 ++++++++++++++++
 xen/arch/arm/configs/arm32_defconfig  |  0
 xen/arch/arm/configs/arm64_defconfig  |  0
 xen/arch/x86/Kconfig                  | 17 +++++++++
 xen/arch/x86/configs/x86_64_defconfig |  0
 xen/common/Kconfig                    |  4 +++
 xen/drivers/Kconfig                   |  3 ++
 xen/tools/kconfig/Makefile.kconfig    | 66 +++++++++++++++++++++++++++++++++++
 11 files changed, 172 insertions(+)
 create mode 100644 xen/Kconfig
 create mode 100644 xen/arch/arm/Kconfig
 create mode 100644 xen/arch/arm/configs/arm32_defconfig
 create mode 100644 xen/arch/arm/configs/arm64_defconfig
 create mode 100644 xen/arch/x86/Kconfig
 create mode 100644 xen/arch/x86/configs/x86_64_defconfig
 create mode 100644 xen/common/Kconfig
 create mode 100644 xen/drivers/Kconfig
 create mode 100644 xen/tools/kconfig/Makefile.kconfig

diff --git a/.gitignore b/.gitignore
index 91e1430..0a0f3ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -217,6 +217,8 @@ tools/xentrace/tbctl
 tools/xentrace/xenctx
 tools/xentrace/xentrace
 xen/.banner
+xen/.config
+xen/.config.old
 xen/System.map
 xen/arch/arm/asm-offsets.s
 xen/arch/arm/xen.lds
@@ -239,10 +241,14 @@ xen/include/headers++.chk
 xen/include/asm
 xen/include/asm-*/asm-offsets.h
 xen/include/compat/*
+xen/include/config/
+xen/include/generated/
 xen/include/public/public
 xen/include/xen/*.new
 xen/include/xen/acm_policy.h
 xen/include/xen/compile.h
+xen/tools/kconfig/.tmp_gtkcheck
+xen/tools/kconfig/.tmp_qtcheck
 xen/tools/symbols
 xen/xsm/flask/include/av_perm_to_string.h
 xen/xsm/flask/include/av_permissions.h
diff --git a/xen/Kconfig b/xen/Kconfig
new file mode 100644
index 0000000..ffe3f45
--- /dev/null
+++ b/xen/Kconfig
@@ -0,0 +1,24 @@
+#
+# For a description of the syntax of this configuration file,
+# see docs/misc/kconfig-language.txt
+#
+mainmenu "Xen/$SRCARCH $XEN_FULLVERSION Configuration"
+
+config SRCARCH
+	string
+	option env="SRCARCH"
+
+config ARCH
+	string
+	option env="ARCH"
+
+source "arch/$SRCARCH/Kconfig"
+
+config XEN_FULLVERSION
+	string
+	option env="XEN_FULLVERSION"
+
+config DEFCONFIG_LIST
+	string
+	option defconfig_list
+	default "$ARCH_DEFCONFIG"
diff --git a/xen/Makefile b/xen/Makefile
index 62c3a6e..fd16650 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -20,6 +20,13 @@ MAKEFLAGS += -rR
 
 EFI_MOUNTPOINT ?= $(BOOT_DIR)/efi
 
+# Don't break if the build process wasn't called from the top level
+# we need XEN_TARGET_ARCH to generate the proper config
+include $(XEN_ROOT)/Config.mk
+
+# Allow someone to change their config file
+export KCONFIG_CONFIG ?= .config
+
 .PHONY: default
 default: build
 
@@ -91,6 +98,7 @@ _clean: delete-unfresh-files
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C xsm clean
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C crypto clean
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig clean
 	find . \( -name "*.o" -o -name ".*.d" \) -exec rm -f {} \;
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms *~ core
 	rm -f include/asm-*/asm-offsets.h
@@ -220,3 +228,16 @@ FORCE:
 
 %/: FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o built_in_bin.o
+
+kconfig := silentoldconfig oldconfig config menuconfig defconfig \
+	nconfig xconfig gconfig savedefconfig listnewconfig olddefconfig
+.PHONY: $(kconfig)
+$(kconfig):
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(XEN_TARGET_ARCH) $@
+
+include/config/%.conf: include/config/auto.conf.cmd
+	$(Q)$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(XEN_TARGET_ARCH) silentoldconfig
+
+# Allow people to just run `make` as before and not force them to configure
+$(KCONFIG_CONFIG):
+	$(Q)$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(XEN_TARGET_ARCH) defconfig
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
new file mode 100644
index 0000000..91b96bc
--- /dev/null
+++ b/xen/arch/arm/Kconfig
@@ -0,0 +1,31 @@
+# Select 32 or 64 bit
+config 64BIT
+	bool
+	default ARCH != "arm32"
+	help
+	  Say yes to build a 64-bit Xen
+	  Say no to build a 32-bit Xen
+
+config ARM_32
+	def_bool y
+	depends on !64BIT
+
+config ARM_64
+	def_bool y
+	depends on 64BIT
+
+config ARM
+	def_bool y
+
+config ARCH_DEFCONFIG
+	string
+	default "arch/arm/configs/arm32_defconfig" if ARM_32
+	default "arch/arm/configs/arm64_defconfig" if ARM_64
+
+menu "Architecture Features"
+
+endmenu
+
+source "common/Kconfig"
+
+source "drivers/Kconfig"
diff --git a/xen/arch/arm/configs/arm32_defconfig b/xen/arch/arm/configs/arm32_defconfig
new file mode 100644
index 0000000..e69de29
diff --git a/xen/arch/arm/configs/arm64_defconfig b/xen/arch/arm/configs/arm64_defconfig
new file mode 100644
index 0000000..e69de29
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
new file mode 100644
index 0000000..9df34a4
--- /dev/null
+++ b/xen/arch/x86/Kconfig
@@ -0,0 +1,17 @@
+config X86_64
+	def_bool y
+
+config X86
+	def_bool y
+
+config ARCH_DEFCONFIG
+	string
+	default "arch/x86/configs/x86_64_defconfig"
+
+menu "Architecture Features"
+
+endmenu
+
+source "common/Kconfig"
+
+source "drivers/Kconfig"
diff --git a/xen/arch/x86/configs/x86_64_defconfig b/xen/arch/x86/configs/x86_64_defconfig
new file mode 100644
index 0000000..e69de29
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
new file mode 100644
index 0000000..0251856
--- /dev/null
+++ b/xen/common/Kconfig
@@ -0,0 +1,4 @@
+
+menu "Common Features"
+
+endmenu
diff --git a/xen/drivers/Kconfig b/xen/drivers/Kconfig
new file mode 100644
index 0000000..7bc7b6e
--- /dev/null
+++ b/xen/drivers/Kconfig
@@ -0,0 +1,3 @@
+menu "Device Drivers"
+
+endmenu
diff --git a/xen/tools/kconfig/Makefile.kconfig b/xen/tools/kconfig/Makefile.kconfig
new file mode 100644
index 0000000..574ce1d
--- /dev/null
+++ b/xen/tools/kconfig/Makefile.kconfig
@@ -0,0 +1,66 @@
+# xen/tools/kconfig
+
+# default rule to do nothing
+all:
+
+# Xen doesn't have a silent build flag
+quiet := silent_
+Q := @
+kecho := :
+
+# eventually you'll want to do out of tree builds
+srctree := $(XEN_ROOT)/xen
+objtree := $(srctree)
+src := tools/kconfig
+obj := $(src)
+KBUILD_SRC :=
+
+# handle functions (most of these lifted from different Linux makefiles
+dot-target = $(dir $@).$(notdir $@)
+depfile = $(subst $(comma),,$(dot-target).d)
+basetarget = $(basename $(notdir $@))
+cmd = $(cmd_$(1))
+if_changed = $(cmd_$(1))
+if_changed_dep = $(cmd_$(1))
+
+define multi_depend
+$(foreach m, $(notdir $1), \
+	$(eval $(obj)/$m: \
+	$(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
+endef
+
+# Set our default defconfig file
+KBUILD_DEFCONFIG := $(ARCH)_defconfig
+
+# provide our shell
+CONFIG_SHELL := $(SHELL)
+
+# provide the host compiler
+HOSTCC := gcc
+HOSTCXX := g++
+
+# force target
+PHONY += FORCE
+
+FORCE:
+
+SRCARCH = $(shell echo $(ARCH) | \
+	sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g')
+export SRCARCH
+
+# include the original Makefile and Makefile.host from Linux
+include $(src)/Makefile
+include $(src)/Makefile.host
+
+# clean up rule
+clean-deps = $(foreach f,$(host-cobjs) $(host-cxxobjs),$(dir $f).$(notdir $f).d)
+clean-shipped = $(patsubst %_shipped,%,$(wildcard $(obj)/*_shipped))
+
+clean:
+	rm -rf $(clean-files)
+	rm -rf $(clean-deps)
+	rm -rf $(host-csingle) $(host-cmulti) $(host-cxxmulti) $(host-cobjs) $(host-cxxobjs)
+	rm -rf $(clean-shipped)
+
+$(obj)/zconf%: $(src)/zconf%_shipped
+	@cp -f $< $@
-- 
2.4.10

  parent reply	other threads:[~2015-12-15 13:13 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 13:12 [PATCH v8 00/28] Kconfig conversion Doug Goldstein
2015-12-15 13:12 ` [PATCH v8 01/28] build: import Kbuild/Kconfig from Linux 4.3 Doug Goldstein
2015-12-15 13:13 ` [PATCH v8 02/28] MAINTAINERS: add myself for kconfig Doug Goldstein
2015-12-15 21:58   ` Doug Goldstein
2015-12-16  7:39     ` Jan Beulich
2015-12-15 22:39   ` [PATCH] " Doug Goldstein
2015-12-16  7:27     ` Jan Beulich
2015-12-16 10:49       ` Doug Goldstein
2015-12-16 14:41         ` Doug Goldstein
2016-01-05 12:07           ` Ian Campbell
2016-01-06 13:45             ` Jan Beulich
2016-01-06 14:26               ` Tim Deegan
2016-01-06 14:40                 ` Jan Beulich
2016-01-06 14:58                   ` Ian Jackson
2016-01-06 14:42                 ` Ian Campbell
2016-01-06 15:31                 ` Lars Kurth
2016-01-06 16:30                   ` Ian Jackson
2016-01-14 17:19                     ` Lars Kurth
2016-01-14 17:24                       ` Ian Campbell
2016-01-15 15:59                         ` Ian Campbell
2016-01-15 16:17                           ` Jan Beulich
2016-01-18 17:05           ` Ian Campbell
2015-12-15 13:13 ` Doug Goldstein [this message]
2015-12-16 10:27   ` [PATCH v8 03/28] build: build Kconfig and config rules Ian Campbell
2015-12-15 13:13 ` [PATCH v8 04/28] build: use generated Kconfig options for Xen Doug Goldstein
2015-12-16 10:27   ` Ian Campbell
2015-12-16 10:33   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 05/28] build: convert HAS_PASSTHROUGH use to Kconfig Doug Goldstein
2015-12-15 21:25   ` Daniel De Graaf
2015-12-16 10:34   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 06/28] build: convert HAS_DEVICE_TREE " Doug Goldstein
2015-12-15 21:25   ` Daniel De Graaf
2015-12-16 10:34   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 07/28] build: convert HAS_PCI " Doug Goldstein
2015-12-15 21:26   ` Daniel De Graaf
2015-12-15 13:13 ` [PATCH v8 08/28] build: convert HAS_NS16550 " Doug Goldstein
2015-12-16 10:34   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 09/28] build: convert HAS_IOPORTS " Doug Goldstein
2015-12-15 13:13 ` [PATCH v8 10/28] build: convert HAS_ACPI " Doug Goldstein
2015-12-15 13:13 ` [PATCH v8 11/28] build: convert HAS_VIDEO " Doug Goldstein
2015-12-16 10:35   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 12/28] build: convert HAS_VGA " Doug Goldstein
2015-12-15 13:13 ` [PATCH v8 13/28] build: convert HAS_CPUFREQ " Doug Goldstein
2015-12-15 13:13 ` [PATCH v8 14/28] build: convert HAS_GDBSX " Doug Goldstein
2015-12-15 13:13 ` [PATCH v8 15/28] build: convert HAS_PDX " Doug Goldstein
2015-12-16 10:35   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 16/28] build: convert HAS_KEXEC / KEXEC " Doug Goldstein
2015-12-15 13:13 ` [PATCH v8 17/28] build: convert HAS_ARM_HDLCD " Doug Goldstein
2015-12-16 10:35   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 18/28] build: convert HAS_CADENCE_UART " Doug Goldstein
2015-12-16 10:36   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 19/28] build: convert HAS_PL011 " Doug Goldstein
2015-12-16 10:36   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 20/28] build: convert HAS_EXYNOS4210 " Doug Goldstein
2015-12-16 10:36   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 21/28] build: convert HAS_OMAP " Doug Goldstein
2015-12-16 10:38   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 22/28] build: convert HAS_SCIF " Doug Goldstein
2015-12-16 10:38   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 23/28] build: convert HAS_EHCI " Doug Goldstein
2015-12-15 13:13 ` [PATCH v8 24/28] build: convert HAS_MEM_ACCESS " Doug Goldstein
2015-12-15 21:26   ` Daniel De Graaf
2015-12-16 10:38   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 25/28] build: convert HAS_MEM_PAGING " Doug Goldstein
2015-12-15 21:27   ` Daniel De Graaf
2015-12-16 10:39   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 26/28] build: convert HAS_MEM_SHARING " Doug Goldstein
2015-12-15 21:27   ` Daniel De Graaf
2015-12-15 13:13 ` [PATCH v8 27/28] build: convert HAS_GICV3 " Doug Goldstein
2015-12-16 10:39   ` Ian Campbell
2015-12-15 13:13 ` [PATCH v8 28/28] build: convert CONFIG_COMPAT " Doug Goldstein
2015-12-15 15:23   ` Jan Beulich
2015-12-16 12:00     ` [PATCH] " Doug Goldstein
2015-12-16 12:52       ` Jan Beulich
2015-12-16 17:01       ` Jan Beulich
2015-12-17 16:00         ` Doug Goldstein
2015-12-16 12:02     ` [PATCH v8 28/28] " Doug Goldstein
2015-12-16  7:37 ` [PATCH v8 00/28] Kconfig conversion Jan Beulich
2015-12-16 10:41   ` Ian Campbell
2015-12-16 14:38   ` Doug Goldstein
2015-12-16 10:33 ` Ian Campbell
2015-12-16 10:43   ` Ian Campbell
2015-12-16 11:42   ` [PATCH] squash into 'build: use generated Kconfig options for Xen' Doug Goldstein
2015-12-16 11:55     ` Ian Campbell
2015-12-16 11:49   ` [PATCH v8 00/28] Kconfig conversion Doug Goldstein
2015-12-18 10:30 ` Ian Campbell
2015-12-18 14:20   ` Doug Goldstein
2015-12-18 14:55     ` Juergen Gross
2015-12-18 15:06       ` Andrew Cooper
2015-12-18 15:16         ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450185206-14259-4-git-send-email-cardoe@cardoe.com \
    --to=cardoe@cardoe.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.