Skip to contentSkip to conversation

busybox: enable fully featured hush shell for nommu

PATCH New Gustavo Zacarias 4 participants 4 messages Oct 14, 2015 – Oct 16, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 busybox: enable fully featured hush shell for nommu

As pointed by Rich Fekler on IRC the basic hush shell is pretty much useless since it doesn't support if conditionals, loops, functions, case or even interactive mode.
So enable the full feature-set.
Size delta: +10184 bytes uncompressed for blackfin fdpic.

---
 package/busybox/busybox.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
package/busybox/busybox.mk +15 -0
index 3494456..d3a6fd8 100644
@@ -89,6 +89,21 @@ define BUSYBOX_SET_MMU
 	$(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))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_BASH_COMPAT,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_BRACE_EXPANSION,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_HELP,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_INTERACTIVE,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_SAVEHISTORY,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_JOB,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_TICK,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_IF,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOOPS,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_CASE,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_FUNCTIONS,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOCAL,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_RANDOM_SUPPORT,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_EXPORT_N,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_MODE_X,$(BUSYBOX_BUILD_CONFIG))
 endef
 endif
 
Signature · 1 line
2.4.9
#1 lore raw

PATCH 1/1 busybox: enable fully featured hush shell for nommu

Dear Gustavo Zacarias,

Quoted 10 lines · Gustavo Zacarias

As pointed by Rich Fekler on IRC the basic hush shell is pretty much useless since it doesn't support if conditionals, loops, functions, case or even interactive mode.
So enable the full feature-set.
Size delta: +10184 bytes uncompressed for blackfin fdpic.

---
 package/busybox/busybox.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 busybox: enable fully featured hush shell for nommu

In reply to Gustavo Zacarias
Quoted 24 lines · Gustavo Zacarias

As pointed by Rich Fekler on IRC the basic hush shell is pretty much useless since it doesn't support if conditionals, loops, functions, case or even interactive mode.
So enable the full feature-set.
Size delta: +10184 bytes uncompressed for blackfin fdpic.

---
 package/busybox/busybox.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
package/busybox/busybox.mk +5 -0
index 3494456..d3a6fd8 100644
@@ -89,6 +89,21 @@ define BUSYBOX_SET_MMU
 	$(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))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_BASH_COMPAT,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_BRACE_EXPANSION,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_HELP,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_INTERACTIVE,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_SAVEHISTORY,$(BUSYBOX_BUILD_CONFIG))

package/busybox/busybox.mk define BUSYBOX_SET_MMU · line 106

Quoted 10 lines
package/busybox/busybox.mk +10 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_JOB,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_TICK,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_IF,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOOPS,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_CASE,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_FUNCTIONS,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOCAL,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_RANDOM_SUPPORT,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_EXPORT_N,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_MODE_X,$(BUSYBOX_BUILD_CONFIG))

I don't like this, since it makes it completely impossible to disable these
hush features. I admit that it indeed doesn't make a significant difference, but on principle I'm against forcing this on the user.

So ideally, we should just let them default to y (all these options have a
default y). We can simply remove them from busybox.config.

But unfortunately, that doesn't work. The problem is that the kconfig infra
will run the oldconfig immediately after merge_config, before applying the fixups. Since in busybox.config, ash is enabled and hush is disabled, all these options will be turned off by the oldconfig run. To solve this, we should run the fixups immediately after merge_config. I've tried this and it seems to work.

But then we're running the fixups three times in the configure step, which
feels a bit like overkill to me. So perhaps a more elegant solution would be the
following: instead of calling sed-based fixups, use a kconfig fragment and merge_config to apply the fixups.

Cc-ing our Kconfig infra expert to consider this.

Regards,
Arnout

Quoted 4 lines
package/busybox/busybox.mk +0 -0
 endef
 endif
 
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#3 lore raw

PATCH 1/1 busybox: enable fully featured hush shell for nommu

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Hi,

Quoted 8 lines

package/busybox/busybox.mk define BUSYBOX_SET_MMU · line 106

Quoted 4 lines
package/busybox/busybox.mk +4 -0
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOCAL,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_RANDOM_SUPPORT,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_EXPORT_N,$(BUSYBOX_BUILD_CONFIG))
+	$(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_MODE_X,$(BUSYBOX_BUILD_CONFIG))

I don't like this, since it makes it completely impossible to disable these
hush features. I admit that it indeed doesn't make a significant difference, but on principle I'm against forcing this on the user.

Yeah, I also don't think this is really nice.

Quoted 6 lines

But then we're running the fixups three times in the configure step, which
feels a bit like overkill to me. So perhaps a more elegant solution would be the
following: instead of calling sed-based fixups, use a kconfig fragment and merge_config to apply the fixups.

Cc-ing our Kconfig infra expert to consider this.

Lets here what he has to say ;) A further complication is that busybox uses a really old kconfig version.

Signature · 1 line
Bye, Peter Korsgaard