[Buildroot] [PATCH v2 1/2] arch: Make page size configuration architecture-independent.
Łukasz Stelmach
l.stelmach at samsung.com
Mon Dec 6 19:27:31 UTC 2021
Rename BR2_ARC_PAGE_SIZE_* to BR2_ARCH_MMU_PAGE_SIZE_* options.
Add BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE and
BR2_ARCH_HAS_MMU_PAGE_SIZE_* to control configuration option dependencies
and visibility.
Adapt existing ARC page size selection.
Suggested-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Signed-off-by: Łukasz Stelmach <l.stelmach at samsung.com>
---
arch/Config.in | 64 ++++++++++++++++++++++++++++++++++
arch/Config.in.arc | 38 --------------------
arch/arch.mk.arc | 9 -----
linux/linux.mk | 27 +++++++-------
package/uclibc/uclibc.mk | 2 +-
toolchain/toolchain-wrapper.mk | 13 +++++++
6 files changed, 93 insertions(+), 60 deletions(-)
diff --git a/arch/Config.in b/arch/Config.in
index 1853e26bb4..561d599561 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -24,6 +24,9 @@ choice
config BR2_arcle
bool "ARC (little endian)"
select BR2_ARCH_HAS_MMU_MANDATORY
+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K
+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K
+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K
help
Synopsys' DesignWare ARC Processor Cores are a family of
32-bit CPUs that can be used from deeply embedded to high
@@ -32,6 +35,9 @@ config BR2_arcle
config BR2_arceb
bool "ARC (big endian)"
select BR2_ARCH_HAS_MMU_MANDATORY
+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_4K
+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_8K
+ select BR2_ARCH_HAS_MMU_PAGE_SIZE_16K
help
Synopsys' DesignWare ARC Processor Cores are a family of
32-bit CPUs that can be used from deeply embedded to high
@@ -426,6 +432,64 @@ config BR2_BINFMT_FLAT_SHARED
endchoice
+config BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE
+ bool
+
+config BR2_ARCH_HAS_MMU_PAGE_SIZE_4K
+ bool
+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE
+
+config BR2_ARCH_HAS_MMU_PAGE_SIZE_8K
+ bool
+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE
+
+config BR2_ARCH_HAS_MMU_PAGE_SIZE_16K
+ bool
+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE
+
+config BR2_ARCH_HAS_MMU_PAGE_SIZE_32K
+ bool
+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE
+
+config BR2_ARCH_HAS_MMU_PAGE_SIZE_64K
+ bool
+ select BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE
+
+choice
+ prompt "MMU Page Size"
+ depends on BR2_ARCH_HAS_CONFIGURABLE_MMU_PAGE_SIZE
+ help
+ Choose MMU page size
+
+config BR2_ARCH_MMU_PAGE_SIZE_4K
+ bool "4K"
+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_4K
+
+config BR2_ARCH_MMU_PAGE_SIZE_8K
+ bool "8K"
+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_8K
+
+config BR2_ARCH_MMU_PAGE_SIZE_16K
+ bool "16K"
+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_16K
+
+config BR2_ARCH_MMU_PAGE_SIZE_32K
+ bool "32K"
+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_32K
+
+config BR2_ARCH_MMU_PAGE_SIZE_64K
+ bool "64K"
+ depends on BR2_ARCH_HAS_MMU_PAGE_SIZE_64K
+endchoice
+
+config BR2_ARCH_MMU_PAGE_SIZE
+ string
+ default "4K" if BR2_ARCH_MMU_PAGE_SIZE_4K
+ default "8K" if BR2_ARCH_MMU_PAGE_SIZE_4K
+ default "16K" if BR2_ARCH_MMU_PAGE_SIZE_16K
+ default "32K" if BR2_ARCH_MMU_PAGE_SIZE_32K
+ default "64K" if BR2_ARCH_MMU_PAGE_SIZE_64K
+
if BR2_arcle || BR2_arceb
source "arch/Config.in.arc"
endif
diff --git a/arch/Config.in.arc b/arch/Config.in.arc
index f7a6d920b5..c82a580c5b 100644
--- a/arch/Config.in.arc
+++ b/arch/Config.in.arc
@@ -84,43 +84,5 @@ config BR2_READELF_ARCH_NAME
default "ARCv2" if BR2_archs38 || BR2_archs38_64mpy || BR2_archs38_full
default "ARCv2" if BR2_archs4x_rel31 || BR2_archs4x
-choice
- prompt "MMU Page Size"
- default BR2_ARC_PAGE_SIZE_8K
- help
- MMU starting from version 3 (found in ARC 770) and now
- version 4 (found in ARC HS38) allows the selection of the
- page size during ASIC design creation.
-
- The following options are available for MMU v3 and v4: 4kB,
- 8kB and 16 kB.
-
- The default is 8 kB (that really matches the only page size
- in MMU v2). It is important to build a toolchain with page
- size matching the hardware configuration. Otherwise
- user-space applications will fail at runtime.
-
-config BR2_ARC_PAGE_SIZE_4K
- bool "4KB"
- depends on !BR2_arc750d
-
-config BR2_ARC_PAGE_SIZE_8K
- bool "8KB"
- help
- This is the one and only option available for MMUv2 and
- default value for MMU v3 and v4.
-
-config BR2_ARC_PAGE_SIZE_16K
- bool "16KB"
- depends on !BR2_arc750d
-
-endchoice
-
-config BR2_ARC_PAGE_SIZE
- string
- default "4K" if BR2_ARC_PAGE_SIZE_4K
- default "8K" if BR2_ARC_PAGE_SIZE_8K
- default "16K" if BR2_ARC_PAGE_SIZE_16K
-
# vim: ft=kconfig
# -*- mode:kconfig; -*-
diff --git a/arch/arch.mk.arc b/arch/arch.mk.arc
index 32b818b0e0..a6b56a869f 100644
--- a/arch/arch.mk.arc
+++ b/arch/arch.mk.arc
@@ -5,13 +5,4 @@ ifeq ($(BR2_ARC_ATOMIC_EXT),y)
ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic
endif
-# Explicitly set LD's "max-page-size" instead of relying on some defaults
-ifeq ($(BR2_ARC_PAGE_SIZE_4K),y)
-ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096
-else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y)
-ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192
-else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y)
-ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384
-endif
-
endif
diff --git a/linux/linux.mk b/linux/linux.mk
index 61fdc0c76c..e66e0db52f 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -328,18 +328,21 @@ define LINUX_KCONFIG_FIXUP_CMDS
$(call KCONFIG_ENABLE_OPT,CONFIG_AEABI))
$(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),
$(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR))
- $(if $(BR2_ARC_PAGE_SIZE_4K),
- $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))
- $(if $(BR2_ARC_PAGE_SIZE_8K),
- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
- $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))
- $(if $(BR2_ARC_PAGE_SIZE_16K),
- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
- $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
- $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))
+ $(if $(BR2_ARCH_MMU_PAGE_SIZE_4K),
+ $(if $(BR2_arcle)$(BR2_arcbe),
+ $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)))
+ $(if $(BR2_ARCH_MMU_PAGE_SIZE_8K),
+ $(if $(BR2_arcle)$(BR2_arcbe),
+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
+ $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)))
+ $(if $(BR2_ARCH_MMU_PAGE_SIZE_16K),
+ $(if $(BR2_arcle)$(BR2_arcbe),
+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
+ $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
+ $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K)))
$(if $(BR2_TARGET_ROOTFS_CPIO),
$(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_INITRD))
# As the kernel gets compiled before root filesystems are
diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
index 87e283de2a..e6699b74b8 100644
--- a/package/uclibc/uclibc.mk
+++ b/package/uclibc/uclibc.mk
@@ -78,7 +78,7 @@ endif
#
ifeq ($(UCLIBC_TARGET_ARCH),arc)
-UCLIBC_ARC_PAGE_SIZE = CONFIG_ARC_PAGE_SIZE_$(call qstrip,$(BR2_ARC_PAGE_SIZE))
+UCLIBC_ARC_PAGE_SIZE = CONFIG_ARCH_MMU_PAGE_SIZE_$(call qstrip,$(BR2_ARCH_MMU_PAGE_SIZE))
define UCLIBC_ARC_PAGE_SIZE_CONFIG
$(SED) '/CONFIG_ARC_PAGE_SIZE_*/d' $(@D)/.config
$(call KCONFIG_ENABLE_OPT,$(UCLIBC_ARC_PAGE_SIZE))
diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index 8b551e3a18..a8564441b5 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -90,3 +90,16 @@ define TOOLCHAIN_WRAPPER_INSTALL
$(INSTALL) -D -m 0755 $(@D)/toolchain-wrapper \
$(HOST_DIR)/bin/toolchain-wrapper
endef
+
+# Explicitly set LD's "max-page-size" instead of relying on some defaults
+ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_4K),y)
+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096
+else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_8K),y)
+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192
+else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_16K),y)
+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384
+else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_32K),y)
+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=32768
+else ifeq ($(BR2_ARCH_MMU_PAGE_SIZE_64K),y)
+ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=65536
+endif
--
2.30.2
More information about the buildroot
mailing list