[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 2/2] arch: Reorganize arch folder to reflect the CPU family schema


  • To: <minios-devel@xxxxxxxxxxxxxxxxxxxx>, <simon.kuenzer@xxxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Wed, 11 Jul 2018 09:16:18 +0000
  • Authentication-results: spf=fail (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=arm.com;
  • Cc: Kaly.Xin@xxxxxxx, nd@xxxxxxx, wei.chen@xxxxxxx
  • Delivery-date: Wed, 11 Jul 2018 09:16:44 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

As we have introduced UK_FAMILY for build scipts. In order to
reflect the CPU family schema, we modify the "arch/UK_ARCH"
to "arch/UK_FAMILY/UK_ARCH".

The "arch/UK_FAMILY" can be used to store the common codes and build
scripts for the architectures of same family.

For individual architectures, it might make sense to use forward
declarations in Compiler.uk and Makefile.uk to include a corresponding
file in a subfolder. For instance arm/Makefile.uk includes
arm/arm/Makefile.uk when an ARM32 architecture was selected.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
 Makefile                            | 12 ++++++------
 arch/Config.uk                      |  4 ++--
 arch/arm/Compiler.uk                |  7 ++-----
 arch/arm/Makefile.uk                | 23 ++++-------------------
 arch/arm/arm/Compiler.uk            |  6 ++++++
 arch/arm/{ => arm}/Config.uk        |  0
 arch/arm/arm/Makefile.uk            | 19 +++++++++++++++++++
 arch/arm/{ => arm}/divsi3.S         |  0
 arch/arm/{ => arm}/ldivmod.S        |  0
 arch/arm/{ => arm}/ldivmod_helper.c |  0
 arch/arm/{ => arm}/qdivrem.c        |  0
 arch/x86/Compiler.uk                |  4 ++++
 arch/x86/Makefile.uk                |  4 ++++
 arch/{ => x86}/x86_64/Compiler.uk   |  0
 arch/{ => x86}/x86_64/Config.uk     |  0
 arch/{ => x86}/x86_64/Makefile.uk   |  0
 16 files changed, 47 insertions(+), 32 deletions(-)
 create mode 100644 arch/arm/arm/Compiler.uk
 rename arch/arm/{ => arm}/Config.uk (100%)
 create mode 100644 arch/arm/arm/Makefile.uk
 rename arch/arm/{ => arm}/divsi3.S (100%)
 rename arch/arm/{ => arm}/ldivmod.S (100%)
 rename arch/arm/{ => arm}/ldivmod_helper.c (100%)
 rename arch/arm/{ => arm}/qdivrem.c (100%)
 create mode 100644 arch/x86/Compiler.uk
 create mode 100644 arch/x86/Makefile.uk
 rename arch/{ => x86}/x86_64/Compiler.uk (100%)
 rename arch/{ => x86}/x86_64/Config.uk (100%)
 rename arch/{ => x86}/x86_64/Makefile.uk (100%)

diff --git a/Makefile b/Makefile
index 178ebbc..d10f53b 100644
--- a/Makefile
+++ b/Makefile
@@ -350,12 +350,12 @@ export UK_FAMILY ?= $(shell echo "$(CONFIG_UK_ARCH)" | \
 
 # Quick-check if architecture exists
 ifeq ($(filter $(null_targets) print-vars,$(MAKECMDGOALS)),)
-ifeq ($(wildcard $(CONFIG_UK_BASE)/arch/$(ARCH)/Makefile.uk),)
-$(error Target architecture ($(ARCH)) is currently not supported (could not 
find $(CONFIG_UK_BASE)/arch/$(ARCH)/Makefile.uk).)
+ifeq ($(wildcard $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/$(ARCH)/Makefile.uk),)
+$(error Target architecture ($(ARCH)) is currently not supported (could not 
find $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/$(ARCH)/Makefile.uk).)
 endif
 
-ifeq ($(wildcard arch/$(ARCH)/Compiler.uk),)
-$(error Target architecture ($(ARCH)) is currently not supported (could not 
find $(CONFIG_UK_BASE)/arch/$(ARCH)/Compiler.uk).)
+ifeq ($(wildcard $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/$(ARCH)/Compiler.uk),)
+$(error Target architecture ($(ARCH)) is currently not supported (could not 
find $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/$(ARCH)/Compiler.uk).)
 endif
 endif
 
@@ -394,7 +394,7 @@ unexport MACHINE
 # Note: Some architectures assign CONFIG_CROSS_COMPILE in their 
arch/*/Makefile.uk
 CONFIG_CROSS_COMPILE := $(CROSS_COMPILE:"%"=%)
 
-include $(CONFIG_UK_BASE)/arch/$(CONFIG_UK_ARCH)/Compiler.uk
+include $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/Compiler.uk
 
 # Make variables (CC, etc...)
 LD             := $(CONFIG_CROSS_COMPILE)gcc
@@ -456,7 +456,7 @@ endif
 $(foreach E,$(ELIB_DIR), \
        $(eval $(call _import_lib,$(E))); \
 )
-$(eval $(call _import_lib,$(CONFIG_UK_BASE)/arch/$(CONFIG_UK_ARCH))) # 
architecture libraries
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY))) # architecture 
libraries
 include $(CONFIG_UK_BASE)/plat/Makefile.uk # platform libraries
 include $(CONFIG_UK_BASE)/lib/Makefile.uk # libraries
 include $(CONFIG_UK_BASE)/Makefile.uk # Unikraft base
diff --git a/arch/Config.uk b/arch/Config.uk
index 36df8d1..9236273 100644
--- a/arch/Config.uk
+++ b/arch/Config.uk
@@ -13,8 +13,8 @@ config ARCH_ARM_32
 endchoice
 
 if (ARCH_X86_64)
-       source "arch/x86_64/Config.uk"
+       source "arch/x86/x86_64/Config.uk"
 endif
 if (ARCH_ARM_32)
-       source "arch/arm/Config.uk"
+       source "arch/arm/arm/Config.uk"
 endif
diff --git a/arch/arm/Compiler.uk b/arch/arm/Compiler.uk
index 44a497d..147f662 100644
--- a/arch/arm/Compiler.uk
+++ b/arch/arm/Compiler.uk
@@ -1,6 +1,3 @@
-# set cross compile
-ifeq ($(CONFIG_CROSS_COMPILE),)
-ifneq ($(CONFIG_UK_ARCH),$(HOSTARCH))
-       CONFIG_CROSS_COMPILE := arm-linux-gnueabihf-
-endif
+ifeq ($(CONFIG_UK_ARCH),arm)
+       include $(CONFIG_UK_BASE)/arch/arm/arm/Compiler.uk
 endif
diff --git a/arch/arm/Makefile.uk b/arch/arm/Makefile.uk
index b746f70..e59b2a3 100644
--- a/arch/arm/Makefile.uk
+++ b/arch/arm/Makefile.uk
@@ -1,19 +1,4 @@
-ASFLAGS  += -D__ARM_32__
-ASFLAGS  += -marm
-CFLAGS   += -D__ARM_32__
-CFLAGS   += -marm -fms-extensions
-CXXFLAGS += -D__ARM_32__
-CXXFLAGS += -marm -fms-extensions
-
-#-march=armv7-a
-
-CFLAGS-$(CONFIG_MARCH_A20NEON)    += -mcpu=cortex-a7 -mtune=cortex-a7 
-mfpu=vfpv4-d16 -mfpu=neon-vfpv4 -funsafe-math-optimizations
-CXXFLAGS-$(CONFIG_MARCH_A20NEON)  += -mcpu=cortex-a7 -mtune=cortex-a7 
-mfpu=vfpv4-d16 -mfpu=neon-vfpv4 -funsafe-math-optimizations
-CFLAGS-$(CONFIG_MARCH_CORTEXA7)   += -mcpu=cortex-a7 -mtune=cortex-a7
-CXXFLAGS-$(CONFIG_MARCH_CORTEXA7) += -mcpu=cortex-a7 -mtune=cortex-a
-
-$(eval $(call addlib,libarmmath))
-LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) += $(CONFIG_UK_BASE)/arch/arm/divsi3.S
-LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) += $(CONFIG_UK_BASE)/arch/arm/ldivmod.S
-LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) += 
$(CONFIG_UK_BASE)/arch/arm/ldivmod_helper.c
-LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) += $(CONFIG_UK_BASE)/arch/arm/qdivrem.c
+# Include corresponding Makefiles for specified architechtures
+ifeq ($(CONFIG_UK_ARCH),arm)
+       include $(CONFIG_UK_BASE)/arch/arm/arm/Makefile.uk
+endif
diff --git a/arch/arm/arm/Compiler.uk b/arch/arm/arm/Compiler.uk
new file mode 100644
index 0000000..44a497d
--- /dev/null
+++ b/arch/arm/arm/Compiler.uk
@@ -0,0 +1,6 @@
+# set cross compile
+ifeq ($(CONFIG_CROSS_COMPILE),)
+ifneq ($(CONFIG_UK_ARCH),$(HOSTARCH))
+       CONFIG_CROSS_COMPILE := arm-linux-gnueabihf-
+endif
+endif
diff --git a/arch/arm/Config.uk b/arch/arm/arm/Config.uk
similarity index 100%
rename from arch/arm/Config.uk
rename to arch/arm/arm/Config.uk
diff --git a/arch/arm/arm/Makefile.uk b/arch/arm/arm/Makefile.uk
new file mode 100644
index 0000000..b746f70
--- /dev/null
+++ b/arch/arm/arm/Makefile.uk
@@ -0,0 +1,19 @@
+ASFLAGS  += -D__ARM_32__
+ASFLAGS  += -marm
+CFLAGS   += -D__ARM_32__
+CFLAGS   += -marm -fms-extensions
+CXXFLAGS += -D__ARM_32__
+CXXFLAGS += -marm -fms-extensions
+
+#-march=armv7-a
+
+CFLAGS-$(CONFIG_MARCH_A20NEON)    += -mcpu=cortex-a7 -mtune=cortex-a7 
-mfpu=vfpv4-d16 -mfpu=neon-vfpv4 -funsafe-math-optimizations
+CXXFLAGS-$(CONFIG_MARCH_A20NEON)  += -mcpu=cortex-a7 -mtune=cortex-a7 
-mfpu=vfpv4-d16 -mfpu=neon-vfpv4 -funsafe-math-optimizations
+CFLAGS-$(CONFIG_MARCH_CORTEXA7)   += -mcpu=cortex-a7 -mtune=cortex-a7
+CXXFLAGS-$(CONFIG_MARCH_CORTEXA7) += -mcpu=cortex-a7 -mtune=cortex-a
+
+$(eval $(call addlib,libarmmath))
+LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) += $(CONFIG_UK_BASE)/arch/arm/divsi3.S
+LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) += $(CONFIG_UK_BASE)/arch/arm/ldivmod.S
+LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) += 
$(CONFIG_UK_BASE)/arch/arm/ldivmod_helper.c
+LIBARMMATH_SRCS-$(CONFIG_ARCH_ARM_32) += $(CONFIG_UK_BASE)/arch/arm/qdivrem.c
diff --git a/arch/arm/divsi3.S b/arch/arm/arm/divsi3.S
similarity index 100%
rename from arch/arm/divsi3.S
rename to arch/arm/arm/divsi3.S
diff --git a/arch/arm/ldivmod.S b/arch/arm/arm/ldivmod.S
similarity index 100%
rename from arch/arm/ldivmod.S
rename to arch/arm/arm/ldivmod.S
diff --git a/arch/arm/ldivmod_helper.c b/arch/arm/arm/ldivmod_helper.c
similarity index 100%
rename from arch/arm/ldivmod_helper.c
rename to arch/arm/arm/ldivmod_helper.c
diff --git a/arch/arm/qdivrem.c b/arch/arm/arm/qdivrem.c
similarity index 100%
rename from arch/arm/qdivrem.c
rename to arch/arm/arm/qdivrem.c
diff --git a/arch/x86/Compiler.uk b/arch/x86/Compiler.uk
new file mode 100644
index 0000000..5f88bd3
--- /dev/null
+++ b/arch/x86/Compiler.uk
@@ -0,0 +1,4 @@
+# Include forward declarations by corresponding architecutes
+ifeq ($(CONFIG_ARCH_X86_64),y)
+       include $(CONFIG_UK_BASE)/arch/x86/x86_64/Compiler.uk
+endif
diff --git a/arch/x86/Makefile.uk b/arch/x86/Makefile.uk
new file mode 100644
index 0000000..cd0dfb9
--- /dev/null
+++ b/arch/x86/Makefile.uk
@@ -0,0 +1,4 @@
+# Include forward declarations by corresponding architecutes
+ifeq ($(CONFIG_ARCH_X86_64),y)
+       include $(CONFIG_UK_BASE)/arch/x86/x86_64/Makefile.uk
+endif
diff --git a/arch/x86_64/Compiler.uk b/arch/x86/x86_64/Compiler.uk
similarity index 100%
rename from arch/x86_64/Compiler.uk
rename to arch/x86/x86_64/Compiler.uk
diff --git a/arch/x86_64/Config.uk b/arch/x86/x86_64/Config.uk
similarity index 100%
rename from arch/x86_64/Config.uk
rename to arch/x86/x86_64/Config.uk
diff --git a/arch/x86_64/Makefile.uk b/arch/x86/x86_64/Makefile.uk
similarity index 100%
rename from arch/x86_64/Makefile.uk
rename to arch/x86/x86_64/Makefile.uk
-- 
2.17.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.