Exposing SystemSpawn in libc and adding skeleton for basic shell.
This commit is contained in:
parent
8d9580b273
commit
8826ed6396
@ -161,6 +161,7 @@ CopyTree('build/include/machine', 'sys/' + env['ARCH'] + '/include', env)
|
||||
# Build Targets
|
||||
SConscript('sys/SConscript', variant_dir='build/sys')
|
||||
SConscript('lib/libc/SConscript', variant_dir='build/lib/libc')
|
||||
SConscript('bin/shell/SConscript', variant_dir='build/bin/shell')
|
||||
SConscript('sbin/init/SConscript', variant_dir='build/sbin/init')
|
||||
|
||||
# Build Tools
|
||||
@ -180,6 +181,7 @@ if env["BOOTDISK"] == "1":
|
||||
env.Append(BUILDERS = {'BuildImage' : newfs})
|
||||
bootdisk = env.BuildImage('#build/bootdisk.img', '#release/bootdisk.manifest')
|
||||
Depends(bootdisk, "#build/tools/newfs_o2fs/newfs_o2fs")
|
||||
Depends(bootdisk, "#build/bin/shell/shell")
|
||||
Depends(bootdisk, "#build/sbin/init/init")
|
||||
Depends(bootdisk, "#build/sys/castor")
|
||||
env.Alias('bootdisk', '#build/bootdisk.img')
|
||||
|
21
bin/shell/SConscript
Normal file
21
bin/shell/SConscript
Normal file
@ -0,0 +1,21 @@
|
||||
import sys
|
||||
|
||||
Import('env')
|
||||
|
||||
init_env = env.Clone()
|
||||
|
||||
src = [ ]
|
||||
|
||||
src_common = [
|
||||
"shell.c"
|
||||
]
|
||||
|
||||
src.append(src_common)
|
||||
|
||||
init_env.Append(LINKFLAGS = ['-nostdlib'])
|
||||
init_env.Append(CPPFLAGS = ['-nostdinc'])
|
||||
init_env.Append(CPPPATH = ['#build/include'])
|
||||
init_env.Append(LIBPATH = ['#build/lib/libc'], LIBS = ['c'])
|
||||
|
||||
init_env.Program("shell", src)
|
||||
|
15
bin/shell/shell.c
Normal file
15
bin/shell/shell.c
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
fputs("Shell\n", stdout);
|
||||
while (1) {
|
||||
fputs("> ", stdout);
|
||||
fgets(buf, sizeof(buf), stdin);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define EBADF 2
|
||||
#define EINVAL 3
|
||||
#define EFAULT 4
|
||||
#define ENOMEM 5
|
||||
|
||||
#endif /* __ERRNO_H__ */
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
uint64_t SystemTime();
|
||||
void SystemExit(int status);
|
||||
uint64_t SystemGetPID();
|
||||
uint64_t SystemSpawn(const char *path);
|
||||
|
||||
// Memory
|
||||
void *SystemMemMap(void *addr, uint64_t len, int flags);
|
||||
|
@ -25,6 +25,12 @@ SystemGetPID()
|
||||
return syscall(SYSCALL_GETPID);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
SystemSpawn(const char *path)
|
||||
{
|
||||
return syscall(SYSCALL_SPAWN, path);
|
||||
}
|
||||
|
||||
void *
|
||||
SystemMemMap(void *addr, uint64_t len, int flags)
|
||||
{
|
||||
|
@ -4,6 +4,9 @@ DIR /
|
||||
END
|
||||
DIR dev
|
||||
END
|
||||
DIR bin
|
||||
FILE shell build/bin/shell/shell
|
||||
END
|
||||
DIR sbin
|
||||
FILE init build/sbin/init/init
|
||||
END
|
||||
|
Loading…
Reference in New Issue
Block a user