summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorOfer Heifetz <oferh@marvell.com>2016-05-19 16:17:03 +0300
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-06-11 16:19:30 +0200
commit11dd7406c8b18ba83b4e8773c76ee10c96c824fb (patch)
treeedee1437b02e3425c632237913da22581e2e0c0c /linux
parent1008ac4406a5544ec87985db880e68377031bca9 (diff)
linux: align endianess based on the Buildroot configuration
The endianess of the Linux kernel should be based on BR2_ENDIAN, so that it is automatically built for the right endianness. Signed-off-by: Ofer Heifetz <oferh@marvell.com> [Thomas: tweak commit message, add comment in .mk file.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'linux')
-rw-r--r--linux/linux.mk15
1 files changed, 15 insertions, 0 deletions
diff --git a/linux/linux.mk b/linux/linux.mk
index fdd8421d9..a751da93b 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -216,6 +216,20 @@ LINUX_KCONFIG_OPTS = $(LINUX_MAKE_FLAGS)
# If no package has yet set it, set it from the Kconfig option
LINUX_NEEDS_MODULES ?= $(BR2_LINUX_NEEDS_MODULES)
+# Make sure the Linux kernel is built with the right endianness. Not
+# all architectures support
+# CONFIG_CPU_BIG_ENDIAN/CONFIG_CPU_LITTLE_ENDIAN in Linux, but the
+# option will be thrown away and ignored if it doesn't exist.
+ifeq ($(BR2_ENDIAN),"BIG")
+define LINUX_FIXUP_CONFIG_ENDIANNESS
+ $(call KCONFIG_ENABLE_OPT,CONFIG_CPU_BIG_ENDIAN,$(@D)/.config)
+endef
+else
+define LINUX_FIXUP_CONFIG_ENDIANNESS
+ $(call KCONFIG_ENABLE_OPT,CONFIG_CPU_LITTLE_ENDIAN,$(@D)/.config)
+endef
+endif
+
define LINUX_KCONFIG_FIXUP_CMDS
$(if $(LINUX_NEEDS_MODULES),
$(call KCONFIG_ENABLE_OPT,CONFIG_MODULES,$(@D)/.config))
@@ -223,6 +237,7 @@ define LINUX_KCONFIG_FIXUP_CMDS
$(foreach opt, $(LINUX_COMPRESSION_OPT_),
$(call KCONFIG_DISABLE_OPT,$(opt),$(@D)/.config)
)
+ $(LINUX_FIXUP_CONFIG_ENDIANNESS)
$(if $(BR2_arm)$(BR2_armeb),
$(call KCONFIG_ENABLE_OPT,CONFIG_AEABI,$(@D)/.config))
$(if $(BR2_TARGET_ROOTFS_CPIO),