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: [PATCHv2] 02/27] build: hookup Kconfig build and usage
Date: Wed, 11 Nov 2015 10:49:52 -0600	[thread overview]
Message-ID: <1447260617-10138-3-git-send-email-cardoe@cardoe.com> (raw)
In-Reply-To: <1447260617-10138-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.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

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                    |  8 +++++
 xen/Kconfig                   | 26 +++++++++++++++
 xen/Makefile                  | 18 ++++++++++
 xen/Rules.mk                  |  2 ++
 xen/arch/arm/Kconfig          | 31 ++++++++++++++++++
 xen/arch/arm/Makefile.kconfig |  8 +++++
 xen/arch/arm/defconfig        |  0
 xen/arch/x86/Kconfig          | 18 ++++++++++
 xen/arch/x86/Makefile.kconfig |  9 +++++
 xen/arch/x86/i386_defconfig   |  1 +
 xen/arch/x86/x86_64_defconfig |  0
 xen/common/Kconfig            |  4 +++
 xen/drivers/Kconfig           |  3 ++
 xen/include/xen/config.h      |  2 ++
 xen/scripts/kconfig/Makefile  | 76 +++++++++++++++++++++++++++++++++++++++++++
 15 files changed, 206 insertions(+)
 create mode 100644 xen/Kconfig
 create mode 100644 xen/arch/arm/Kconfig
 create mode 100644 xen/arch/arm/Makefile.kconfig
 create mode 100644 xen/arch/arm/defconfig
 create mode 100644 xen/arch/x86/Kconfig
 create mode 100644 xen/arch/x86/Makefile.kconfig
 create mode 100644 xen/arch/x86/i386_defconfig
 create mode 100644 xen/arch/x86/x86_64_defconfig
 create mode 100644 xen/common/Kconfig
 create mode 100644 xen/drivers/Kconfig
 create mode 100644 xen/scripts/kconfig/Makefile

diff --git a/.gitignore b/.gitignore
index 91e1430..780df23 100644
--- a/.gitignore
+++ b/.gitignore
@@ -217,6 +217,11 @@ tools/xentrace/tbctl
 tools/xentrace/xenctx
 tools/xentrace/xentrace
 xen/.banner
+xen/.config
+xen/.config.old
+xen/defconfig
+xen/**/*.cmd
+xen/**/modules.order
 xen/System.map
 xen/arch/arm/asm-offsets.s
 xen/arch/arm/xen.lds
@@ -239,6 +244,9 @@ xen/include/headers++.chk
 xen/include/asm
 xen/include/asm-*/asm-offsets.h
 xen/include/compat/*
+xen/include/config.h
+xen/include/config/
+xen/include/generated/
 xen/include/public/public
 xen/include/xen/*.new
 xen/include/xen/acm_policy.h
diff --git a/xen/Kconfig b/xen/Kconfig
new file mode 100644
index 0000000..2407313
--- /dev/null
+++ b/xen/Kconfig
@@ -0,0 +1,26 @@
+#
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/kconfig-language.txt from the Linux
+# kernel source tree.
+#
+mainmenu "Xen $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"
+	default "arch/$SRCARCH/defconfig"
diff --git a/xen/Makefile b/xen/Makefile
index c556198..2e63a48 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -17,12 +17,18 @@ export XEN_ROOT := $(BASEDIR)/..
 
 EFI_MOUNTPOINT ?= $(BOOT_DIR)/efi
 
+# Don't break if the build process wasn't called from the top level
+XEN_TARGET_ARCH ?= $(shell uname -m)
+
 .PHONY: default
 default: build
 
 .PHONY: dist
 dist: install
 
+.PHONY: build
+build:: include/config/auto.conf
+
 .PHONY: build install uninstall clean distclean cscope TAGS tags MAP gtags
 build install uninstall debug clean distclean cscope TAGS tags MAP gtags::
 ifneq ($(XEN_TARGET_ARCH),x86_32)
@@ -88,6 +94,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 scripts/kconfig/Makefile clean
 	rm -f include/asm *.o $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms *~ core
 	rm -f include/asm-*/asm-offsets.h
 	rm -f .banner
@@ -216,3 +223,14 @@ 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 scripts/kconfig/Makefile ARCH=$(XEN_TARGET_ARCH) $@
+
+include/config/auto.conf: include/config/auto.conf.cmd
+	$(Q)$(MAKE) -f scripts/kconfig/Makefile ARCH=$(XEN_TARGET_ARCH) silentoldconfig
+
+-include include/config/auto.conf.cmd
diff --git a/xen/Rules.mk b/xen/Rules.mk
index e9d03b9..011768a 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -12,6 +12,8 @@ frame_pointer ?= n
 lto           ?= n
 kexec         ?= y
 
+-include $(BASEDIR)/include/config/auto.conf
+
 include $(XEN_ROOT)/Config.mk
 
 # Hardcoded configuration implications and dependencies.
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
new file mode 100644
index 0000000..422de13
--- /dev/null
+++ b/xen/arch/arm/Kconfig
@@ -0,0 +1,31 @@
+# Select 32 or 64 bit
+config 64BIT
+	bool "64-bit Xen" if ARCH = "arm64"
+	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/arm32_defconfig" if ARM_32
+	default "arch/arm/arm64_defconfig" if ARM_64
+
+menu "Architecture Features"
+
+endmenu
+
+source "common/Kconfig"
+
+source "drivers/Kconfig"
diff --git a/xen/arch/arm/Makefile.kconfig b/xen/arch/arm/Makefile.kconfig
new file mode 100644
index 0000000..35a475f
--- /dev/null
+++ b/xen/arch/arm/Makefile.kconfig
@@ -0,0 +1,8 @@
+
+KBUILD_DEFCONFIG := $(ARCH)_defconfig
+
+KBUILD_CFLAGS += -Iinclude/asm-arm/$(ARCH)
+
+define archhelp
+  echo '* xen.gz    - Compressed Xen image'
+endef
diff --git a/xen/arch/arm/defconfig b/xen/arch/arm/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..644f684
--- /dev/null
+++ b/xen/arch/x86/Kconfig
@@ -0,0 +1,18 @@
+config X86_64
+	def_bool y
+
+config X86
+	def_bool y
+	select HAS_GDBSX
+
+config ARCH_DEFCONFIG
+	string
+	default "arch/x86/x86_64_defconfig" if X86_64
+
+menu "Architecture Features"
+
+endmenu
+
+source "common/Kconfig"
+
+source "drivers/Kconfig"
diff --git a/xen/arch/x86/Makefile.kconfig b/xen/arch/x86/Makefile.kconfig
new file mode 100644
index 0000000..8ffa0cd
--- /dev/null
+++ b/xen/arch/x86/Makefile.kconfig
@@ -0,0 +1,9 @@
+
+KBUILD_DEFCONFIG := $(ARCH)_defconfig
+
+KBUILD_CFLAGS += -Iinclude/asm-x86/mach-default
+KBUILD_CFLAGS += -Iinclude/asm-x86/mach-generic
+
+define archhelp
+  echo '* xen.gz    - Compressed Xen image'
+endef
diff --git a/xen/arch/x86/i386_defconfig b/xen/arch/x86/i386_defconfig
new file mode 100644
index 0000000..2441d5a
--- /dev/null
+++ b/xen/arch/x86/i386_defconfig
@@ -0,0 +1 @@
+# CONFIG_64BIT is not set
diff --git a/xen/arch/x86/x86_64_defconfig b/xen/arch/x86/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/include/xen/config.h b/xen/include/xen/config.h
index f7258c7..12a4688 100644
--- a/xen/include/xen/config.h
+++ b/xen/include/xen/config.h
@@ -12,6 +12,8 @@
 #endif
 #include <asm/config.h>
 
+#include <generated/autoconf.h>
+
 #define EXPORT_SYMBOL(var)
 #define EXPORT_SYMBOL_GPL(var)
 
diff --git a/xen/scripts/kconfig/Makefile b/xen/scripts/kconfig/Makefile
new file mode 100644
index 0000000..5e2fd9c
--- /dev/null
+++ b/xen/scripts/kconfig/Makefile
@@ -0,0 +1,76 @@
+# xen/scripts/kconfig
+
+MAKEFLAGS += -rR
+
+# default rule to do nothing
+all:
+
+XEN_ROOT = $(CURDIR)/..
+include $(XEN_ROOT)/config/Tools.mk
+
+# 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 := scripts/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 = $(if y, \
+	@set -e; \
+	$(cmd_$(1)); \
+	)
+
+if_changed_dep = $(if y, \
+	@set -e;	\
+	$(cmd_$(1)); \
+	)
+
+define multi_depend
+$(foreach m, $(notdir $1), \
+	$(eval $(obj)/$m: \
+	$(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
+endef
+
+
+# provide our shell
+CONFIG_SHELL := $(BASH)
+
+# 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 from Linux
+include $(src)/Makefile.linux
+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-11-11 16:49 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11 16:49 [PATCHv2] 00/27] Kconfig conversion Doug Goldstein
2015-11-11 16:49 ` [PATCHv2] 01/27] build: import Kbuild/Kconfig from Linux 4.2 Doug Goldstein
2015-11-11 16:49 ` Doug Goldstein [this message]
2015-11-11 16:49 ` [PATCHv2] 03/27] build: convert HAS_PASSTHROUGH use to Kconfig Doug Goldstein
2015-11-12 15:48   ` Daniel De Graaf
2015-11-11 16:49 ` [PATCHv2] 04/27] build: convert HAS_DEVICE_TREE " Doug Goldstein
2015-11-12 15:49   ` Daniel De Graaf
2015-11-11 16:49 ` [PATCHv2] 05/27] build: convert HAS_PCI " Doug Goldstein
2015-11-12 15:50   ` Daniel De Graaf
2015-11-11 16:49 ` [PATCHv2] 06/27] build: convert HAS_NS16550 " Doug Goldstein
2015-11-11 16:49 ` [PATCHv2] 07/27] build: convert HAS_IOPORTS " Doug Goldstein
2015-11-11 16:49 ` [PATCHv2] 08/27] build: convert HAS_ACPI " Doug Goldstein
2015-11-11 16:49 ` [PATCHv2] 09/27] build: convert HAS_VIDEO " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 10/27] build: convert HAS_VGA " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 11/27] build: convert HAS_CPUFREQ " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 12/27] build: convert HAS_GDBSX " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 13/27] build: convert HAS_PDX " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 14/27] build: convert HAS_KEXEC " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 15/27] build: convert HAS_ARM_HDLCD " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 16/27] build: convert HAS_CADENCE_UART " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 17/27] build: convert HAS_PL011 " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 18/27] build: convert HAS_EXYNOS4210 " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 19/27] build: convert HAS_OMAP " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 20/27] build: convert HAS_SCIF " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 21/27] build: convert HAS_EHCI " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 22/27] build: convert HAS_MEM_ACCESS " Doug Goldstein
2015-11-12  8:58   ` Razvan Cojocaru
2015-11-12 15:51   ` Daniel De Graaf
2015-11-11 16:50 ` [PATCHv2] 23/27] build: convert HAS_MEM_PAGING " Doug Goldstein
2015-11-12  8:59   ` Razvan Cojocaru
2015-11-12 15:52   ` Daniel De Graaf
2015-11-11 16:50 ` [PATCHv2] 24/27] build: convert HAS_MEM_SHARING " Doug Goldstein
2015-11-12  9:00   ` Razvan Cojocaru
2015-11-12 15:52   ` Daniel De Graaf
2015-11-11 16:50 ` [PATCHv2] 25/27] build: convert HAS_GICV3 " Doug Goldstein
2015-11-11 16:50 ` [PATCHv2] 26/27] build: convert CONFIG_COMPAT " Doug Goldstein
2015-11-11 17:46   ` Andrew Cooper
2015-11-11 16:50 ` [PATCHv2] 27/27] build: convert kexec options to CONFIG_KEXEC Doug Goldstein
2015-11-11 18:01 ` [PATCHv2] 00/27] Kconfig conversion Doug Goldstein

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=1447260617-10138-3-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.