Invoke shells from the kernel by name/path.
Don't use the 'busybox' binary as a trampoline to start a shell.
Instead, invoke the shell directly using a filesystem name for
the shell binary: /bin/bash. Also, rename the monitor function
to invoke a shell from, "mon_bb" to "mon_shell". Add monitor
commands 'bash' and 'sh' to invoke the shell as, '/bin/bash'.
Tested: Built and ran Akaros.
Change-Id: I56be992292b28762c9925b9b40f2d765ca1e1313
Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/include/monitor.h b/kern/include/monitor.h
index 92a1f28..887058b 100644
--- a/kern/include/monitor.h
+++ b/kern/include/monitor.h
@@ -31,7 +31,7 @@
int mon_trace(int argc, char **argv, struct hw_trapframe *hw_tf);
int mon_monitor(int argc, char **argv, struct hw_trapframe *hw_tf);
int mon_fs(int argc, char **argv, struct hw_trapframe *hw_tf);
-int mon_bb(int argc, char **argv, struct hw_trapframe *hw_tf);
+int mon_shell(int argc, char **argv, struct hw_trapframe *hw_tf);
int mon_alarm(int argc, char **argv, struct hw_trapframe *hw_tf);
int mon_msr(int argc, char **argv, struct hw_trapframe *hw_tf);
int mon_db(int argc, char **argv, struct hw_trapframe *hw_tf);
diff --git a/kern/src/init.c b/kern/src/init.c
index 6f21ec6..9ab93fc 100644
--- a/kern/src/init.c
+++ b/kern/src/init.c
@@ -208,12 +208,11 @@
/* Initialize l_argv with its first three arguments, but allocate space
* for all arguments as calculated above */
- int static_args = 3;
+ int static_args = 2;
int total_args = vargs + static_args;
char *l_argv[total_args];
- l_argv[0] = "";
- l_argv[1] = "busybox";
- l_argv[2] = "ash";
+ l_argv[0] = "/bin/bash";
+ l_argv[1] = "bash";
/* Initialize l_argv with the rest of the arguments */
int i = static_args;
diff --git a/kern/src/manager.c b/kern/src/manager.c
index fe442ad..677e5ef 100644
--- a/kern/src/manager.c
+++ b/kern/src/manager.c
@@ -272,7 +272,7 @@
{
static bool first = true;
if (first)
- mon_bb(0, 0, 0);
+ mon_shell(0, 0, 0);
smp_idle();
assert(0);
}
diff --git a/kern/src/monitor.c b/kern/src/monitor.c
index 7749f89..f24c87b 100644
--- a/kern/src/monitor.c
+++ b/kern/src/monitor.c
@@ -62,7 +62,9 @@
{ "trace", "Run some tracing functions", mon_trace},
{ "monitor", "Run the monitor on another core", mon_monitor},
{ "fs", "Filesystem Diagnostics", mon_fs},
- { "bb", "Try to run busybox (ash)", mon_bb},
+ { "sh", "Try to run a shell (bash)", mon_shell},
+ { "bash", "Try to run a shell (bash)", mon_shell},
+ { "bb", "Try to run a shell (bash)", mon_shell},
{ "alarm", "Alarm Diagnostics", mon_alarm},
{ "msr", "read/write msr: msr msr [value]", mon_msr},
{ "db", "Misc debugging", mon_db},
@@ -990,10 +992,10 @@
return 0;
}
-int mon_bb(int argc, char **argv, struct hw_trapframe *hw_tf)
+int mon_shell(int argc, char **argv, struct hw_trapframe *hw_tf)
{
- char *l_argv[3] = {"", "busybox", "ash"};
- return mon_bin_run(3, l_argv, hw_tf);
+ char *l_argv[2] = {"/bin/bash", "bash"};
+ return mon_bin_run(2, l_argv, hw_tf);
}
int mon_alarm(int argc, char **argv, struct hw_trapframe *hw_tf)