Skip to contentSkip to conversation

busybox: set/unset CONFIG_NOMMU

PATCH New Gustavo Zacarias 3 participants 6 messages Aug 9, 2013 – Aug 10, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 busybox: set/unset CONFIG_NOMMU

Set busybox .config CONFIG_NOMMU appropiately and streamline this new setting with the previous BUSYBOX_DISABLE_MMU_APPLETS in a single BUSYBOX_SET_MMU definition (since it's not just applets now).

---
 package/busybox/busybox.mk | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)
package/busybox/busybox.mk +14 -9
index acc9008..ad8bdaf 100644
@@ -75,6 +75,19 @@ define BUSYBOX_SET_MDEV
 endef
 endif
 
+ifeq ($(BR2_USE_MMU),y)
+define BUSYBOX_SET_MMU
+	$(call KCONFIG_DISABLE_OPT,CONFIG_NOMMU,$(BUSYBOX_BUILD_CONFIG))
+endef
+else
+define BUSYBOX_SET_MMU
+	$(call KCONFIG_ENABLE_OPT,CONFIG_NOMMU,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_DISABLE_OPT,CONFIG_SWAPONOFF,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_DISABLE_OPT,CONFIG_ASH,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH,$(BUSYBOX_BUILD_CONFIG))
+endef
+endif
+
 ifeq ($(BR2_LARGEFILE),y)
 define BUSYBOX_SET_LARGEFILE
 	$(call KCONFIG_ENABLE_OPT,CONFIG_LFS,$(BUSYBOX_BUILD_CONFIG))
@@ -133,14 +146,6 @@ define BUSYBOX_INTERNAL_SHADOW_PASSWORDS
 endef
 endif
 
-ifeq ($(BR2_USE_MMU),)
-define BUSYBOX_DISABLE_MMU_APPLETS
-	$(call KCONFIG_DISABLE_OPT,CONFIG_SWAPONOFF,$(BUSYBOX_BUILD_CONFIG))
-	$(call KCONFIG_DISABLE_OPT,CONFIG_ASH,$(BUSYBOX_BUILD_CONFIG))
-	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH,$(BUSYBOX_BUILD_CONFIG))
-endef
-endif
-
 ifeq ($(BR2_INIT_BUSYBOX),y)
 define BUSYBOX_SET_INIT
 	$(call KCONFIG_ENABLE_OPT,CONFIG_INIT,$(BUSYBOX_BUILD_CONFIG))
@@ -172,6 +177,7 @@ endif
 BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
 
 define BUSYBOX_CONFIGURE_CMDS
+	$(BUSYBOX_SET_MMU)
 	$(BUSYBOX_SET_LARGEFILE)
 	$(BUSYBOX_SET_IPV6)
 	$(BUSYBOX_PREFER_STATIC)
@@ -179,7 +185,6 @@ define BUSYBOX_CONFIGURE_CMDS
 	$(BUSYBOX_NETKITBASE)
 	$(BUSYBOX_NETKITTELNET)
 	$(BUSYBOX_INTERNAL_SHADOW_PASSWORDS)
-	$(BUSYBOX_DISABLE_MMU_APPLETS)
 	$(BUSYBOX_SET_INIT)
 	$(BUSYBOX_SET_WATCHDOG)
 	@yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH 2/3 uclibc: set MMU usage accordingly

On architectures that lack a MMU (like blackfin) uclibc just undefined ARCH_HAS_MMU which disabled ARCH_USE_MMU.
But for other architectures which may or may not have one like ARM we need to set this according to user choice.

---
 package/uclibc/uclibc.mk | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
package/uclibc/uclibc.mk +14 -0
index 36a5001..39877bb 100644
@@ -242,6 +242,20 @@ endef
 endif
 
 #
+# MMU
+#
+
+ifeq ($(BR2_USE_MMU),y)
+define UCLIBC_MMU_CONFIG
+	$(call UCLIBC_OPT_SET,ARCH_USE_MMU,y,$(@D))
+endef
+else
+define UCLIBC_MMU_CONFIG
+	$(call UCLIBC_OPT_UNSET,ARCH_USE_MMU,$(@D))
+endef
+endif
+
+#
 # IPv6
 #
 
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH 3/3 eglibc: needs MMU

In reply to Gustavo Zacarias
---
 toolchain/toolchain-buildroot/Config.in | 1 +
 1 file changed, 1 insertion(+)
toolchain/toolchain-buildroot/Config.in +1 -0
index 396a434..7a26441 100644
@@ -22,6 +22,7 @@ config BR2_TOOLCHAIN_BUILDROOT_EGLIBC
 		   BR2_mips64 || BR2_mips64el || BR2_powerpc || \
 		   BR2_sh     || BR2_sh64     || BR2_sparc   || \
 		   BR2_x86_64
+	depends on BR2_USE_MMU
 	select BR2_TOOLCHAIN_USES_GLIBC
 	# our eglibc.mk enables RPC support
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH 1/3 busybox: set/unset CONFIG_NOMMU

In reply to Gustavo Zacarias

2013/8/10 Gustavo Zacarias <[email protected]>:

Quoted 5 lines

Set busybox .config CONFIG_NOMMU appropiately and streamline this new setting with the previous BUSYBOX_DISABLE_MMU_APPLETS in a single BUSYBOX_SET_MMU definition (since it's not just applets now).

Hi Gustavo,

I try to build for noMMU with below patches:
[PATCH 1/3] busybox: set/unset CONFIG_NOMMU
[PATCH 2/3] uclibc: set MMU usage accordingly

However, I still got ELF executable:

$ file output/target/bin/busybox
output/target/bin/busybox: setuid ELF 32-bit LSB executable, ARM,
version 1 (SYSV), statically linked, stripped

Regards,
Axel

#4 lore raw

PATCH 1/3 busybox: set/unset CONFIG_NOMMU

Quoted 10 lines · Axel Lin

Hi Gustavo,

I try to build for noMMU with below patches:
[PATCH 1/3] busybox: set/unset CONFIG_NOMMU
[PATCH 2/3] uclibc: set MMU usage accordingly

However, I still got ELF executable:

$ file output/target/bin/busybox
output/target/bin/busybox: setuid ELF 32-bit LSB executable, ARM,
version 1 (SYSV), statically linked, stripped

Hi Axel.
It's not ready, these are patches just to fix obvious problems. More will possibly follow unless unless i get pissed off by your continuous one bit comments.
I already know it's still doing ELF binaries - the toolchain isn't configured appropiately and without hardware finding the exact way of doing so isn't easy (seems very likely that it'll require gcc patching). Thanks and regards.

#5 lore raw

PATCH 1/3 busybox: set/unset CONFIG_NOMMU

In reply to Gustavo Zacarias

Dear Gustavo Zacarias,

Quoted 5 lines · Gustavo Zacarias

Set busybox .config CONFIG_NOMMU appropiately and streamline this new setting with the previous BUSYBOX_DISABLE_MMU_APPLETS in a single BUSYBOX_SET_MMU definition (since it's not just applets now).

Committed your three !MMU patches, thanks.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com