diff --git a/SConstruct b/SConstruct index 77d87bd..c03de2a 100644 --- a/SConstruct +++ b/SConstruct @@ -175,6 +175,7 @@ SConscript('lib/libc/SConscript', variant_dir='build/lib/libc') #SConscript('lib/liblwip/SConscript', variant_dir='build/lib/liblwip') SConscript('bin/cat/SConscript', variant_dir='build/bin/cat') SConscript('bin/date/SConscript', variant_dir='build/bin/date') +SConscript('bin/echo/SConscript', variant_dir='build/bin/echo') SConscript('bin/ethdump/SConscript', variant_dir='build/bin/ethdump') SConscript('bin/ethinject/SConscript', variant_dir='build/bin/ethinject') SConscript('bin/ls/SConscript', variant_dir='build/bin/ls') @@ -203,6 +204,7 @@ if env["BOOTDISK"] == "1": Depends(bootdisk, "#build/tools/newfs_o2fs/newfs_o2fs") Depends(bootdisk, "#build/bin/cat/cat") Depends(bootdisk, "#build/bin/date/date") + Depends(bootdisk, "#build/bin/echo/echo") Depends(bootdisk, "#build/bin/ethdump/ethdump") Depends(bootdisk, "#build/bin/ethinject/ethinject") Depends(bootdisk, "#build/bin/ls/ls") diff --git a/bin/echo/SConscript b/bin/echo/SConscript new file mode 100644 index 0000000..15f3dec --- /dev/null +++ b/bin/echo/SConscript @@ -0,0 +1,23 @@ +import sys + +Import('env') + +init_env = env.Clone() + +src = [ ] + +src_common = [ + "echo.c" +] + +src.append(env["CRTBEGIN"]) +src.append(src_common) +src.append(env["CRTEND"]) + +init_env.Append(LINKFLAGS = ['-nostdlib']) +init_env.Append(CPPFLAGS = ['-fno-builtin', '-nostdinc']) +init_env.Append(CPPPATH = ['#build/include']) +init_env.Append(LIBPATH = ['#build/lib/libc'], LIBS = ['c']) + +init_env.Program("echo", src) + diff --git a/bin/echo/echo.c b/bin/echo/echo.c new file mode 100644 index 0000000..9b137ec --- /dev/null +++ b/bin/echo/echo.c @@ -0,0 +1,14 @@ + +#include + +int +main(int argc, const char *argv[]) +{ + for (int i = 0; i < argc; i++) + printf("%s ", argv[i]); + + printf("\n"); + + return 0; +} + diff --git a/bin/shell/shell.c b/bin/shell/shell.c index 3a6194b..7e2b3ef 100644 --- a/bin/shell/shell.c +++ b/bin/shell/shell.c @@ -32,23 +32,10 @@ void Cmd_Help(int argc, const char *argv[]) { printf("bkpt Trigger a kernel breakpoint\n"); - printf("echo Echo arguments\n"); printf("exit Exit shell\n"); printf("help Display the list of commands\n"); } -void -Cmd_Echo(int argc, const char *argv[]) -{ - int i; - - for (i = 1; i < argc; i++) - { - printf("%s ", argv[i]); - } - printf("\n"); -} - const char *searchpath[] = { "", "/sbin/", @@ -125,8 +112,6 @@ DispatchCommand(char *buf) Cmd_Help(argc, (const char **)argv); } else if (strcmp(argv[0], "bkpt") == 0) { asm volatile("int3"); - } else if (strcmp(argv[0], "echo") == 0) { - Cmd_Echo(argc, (const char **)argv); } else if (strcmp(argv[0], "exit") == 0) { exit(0); } else if (strcmp(argv[0], "#") == 0) { diff --git a/release/bootdisk.manifest b/release/bootdisk.manifest index 941175c..3e85654 100644 --- a/release/bootdisk.manifest +++ b/release/bootdisk.manifest @@ -7,6 +7,7 @@ DIR / DIR bin FILE cat build/bin/cat/cat FILE date build/bin/date/date + FILE echo build/bin/echo/echo FILE ethdump build/bin/ethdump/ethdump FILE ethinject build/bin/ethinject/ethinject FILE ls build/bin/ls/ls