diff --git a/Makefile b/Makefile index 366bd67..08d642a 100755 --- a/Makefile +++ b/Makefile @@ -1,11 +1,14 @@ # $Id$ # The System Makefile (C) 2002 The UbixOS Project -all: libc bin kernel tools +all: libc depend bin kernel tools libc: src (cd src/lib/libc;make) +depend: src + (cd src/lib/ubix;make) + bin: src (cd src/bin;make) @@ -22,3 +25,4 @@ (cd src/sys;make clean) (cd src/lib/libc;make clean) (cd src/bin;make clean) + (cd src/lib/ubix;make clean) diff --git a/src/bin/Makefile b/src/bin/Makefile index 7db2a6a..55415f9 100755 --- a/src/bin/Makefile +++ b/src/bin/Makefile @@ -1,7 +1,7 @@ # $Id$ # The System Makefile (C) 2002 The UbixOS Project -all: init-bin shell-bin test-bin ls-bin +all: init-bin shell-bin test-bin ls-bin pwd-bin init-bin: init (cd init;make) @@ -15,8 +15,12 @@ ls-bin: ls (cd ls;make) +pwd-bin: pwd + (cd pwd;make) + clean: (cd init;make clean) (cd shell;make clean) (cd test;make clean) (cd ls;make clean) + (cd pwd;make clean) diff --git a/src/bin/pwd/Makefile b/src/bin/pwd/Makefile new file mode 100755 index 0000000..d470605 --- /dev/null +++ b/src/bin/pwd/Makefile @@ -0,0 +1,52 @@ +# $Id$ +# Application Makefile (C) 2002 The UbixOS Project + + +#Compiler +GCC = gcc +G++ = gcc + +#Compiler Flags +CFLAGS = -I../../lib/libc/include + +#Linker +LD = ld + +#Binary File Name +BINARY = pwd + +#Delete Program +REMOVE = rm -f + +#Objects +OBJS = main.o + +#Libraries +LIBRARIES = ../../lib/libc/stdio/*.o ../../lib/libc/stdlib/*.o ../../lib/libc/sys/*.o ../../lib/libc/string/*.o ../../lib/libc/generic/*.o + +#Startup File +STARTUP = ../../lib/ubix/startup.o + +# Link The Binary +$(BINARY) : $(OBJS) + $(GCC) -nostdlib -o $@ $(STARTUP) $(LIBRARIES) $(OBJS) + +# Compile the source files +.cc.o: + $(G++) -Wall -fomit-frame-pointer -O $(CFLAGS) -c -o $@ $< + +.cc.s: + $(G++) -Wall -fomit-frame-pointer -O $(CFLAGS) -S -o $@ $< + +.c.o: + $(GCC) -Wall -O $(CFLAGS) -c -o $@ $< + +.c.s: + $(GCC) -Wall -fomit-frame-pointer -O $(CFLAGS) -S -o $@ $< + +.S.o: + $(GCC) -Wall -fomit-frame-pointer -c -o $@ $< + +# Clean Up The junk +clean: + $(REMOVE) $(OBJS) $(BINARY) diff --git a/src/bin/pwd/main.c b/src/bin/pwd/main.c new file mode 100755 index 0000000..b9c4c57 --- /dev/null +++ b/src/bin/pwd/main.c @@ -0,0 +1,30 @@ +/************************************************************************************** + Copyright (c) 2002 The UbixOS Project + All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors +in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project nor the names of its +contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +**************************************************************************************/ + +#include +#include + +int main() { + char cwd[256]; + exit(printf("%s\n",getcwd(cwd,sizeof(cwd)))); + } diff --git a/src/bin/shell/main.c b/src/bin/shell/main.c index 0dc455a..09d6278 100755 --- a/src/bin/shell/main.c +++ b/src/bin/shell/main.c @@ -43,8 +43,6 @@ } if (0 == memcmp(tmp, "uname", 5)) printf("UbixOS v0.01a " __DATE__" " __TIME__ " \n"); - else if (0 == memcmp(tmp, "pwd", 3)) - printf("Pwd: [%s]\n",curInfo[0].pwd); else if (memcmp(tmp,"stress", 6) == 0) { while (1) { cPid = fork(); diff --git a/src/lib/libc/Makefile b/src/lib/libc/Makefile index 6a4b13b..81b26c2 100755 --- a/src/lib/libc/Makefile +++ b/src/lib/libc/Makefile @@ -27,6 +27,7 @@ (cd stdlib;make) (cd sys;make) (cd string;make) + (cd generic;make) # $(LD) -o $(OUTPUT) $(OBJS) ./stdio/*.o ./sys/*.o ./string/*.o ./stdlib/*.o $(GCC) -nostdlib -shared -soname libc.so -o $(OUTPUT) $(OBJS) $(SUBS) @@ -52,3 +53,4 @@ (cd stdio;make clean) (cd sys;make clean) (cd stdlib;make clean) + (cd generic;make clean) diff --git a/src/lib/libc/generic/Makefile b/src/lib/libc/generic/Makefile new file mode 100755 index 0000000..38f0efd --- /dev/null +++ b/src/lib/libc/generic/Makefile @@ -0,0 +1,42 @@ +# $Id$ +# The System Makefile (C) 2002 The UbixOS Project + +CFLAGS = #-fno-builtin + +#Compiler +GCC = gcc +G++ = gcc + +#Linker +LD = ld -Bshareable +AR = ar + +#Delete Program +REMOVE = rm -f + +#Objects +OBJS = getcwd.o +#Output +OUTPUT = libc.so + +$(OUTPUT): $(OBJS) + +# Compile the source files +.cc.o: + $(G++) $(CFLAGS) -Wall -nostdlib -O -I../include -c -o $@ $< + +.cc.s: + $(G++) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< + +.c.o: + $(GCC) $(CFLAGS) -Wall -nostdlib -O -I../include -c $< + +.c.s: + $(GCC) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< + +.S.o: + $(GCC) $(CFLAGS) -Wall -nostdlib -c -o $@ $< + +# Clean up the junk +clean: + $(REMOVE) $(OBJS) $(OUTPUT) diff --git a/src/lib/libc/generic/getcwd.c b/src/lib/libc/generic/getcwd.c new file mode 100755 index 0000000..042f2b5 --- /dev/null +++ b/src/lib/libc/generic/getcwd.c @@ -0,0 +1,6 @@ +#include + +char *getcwd(char *buffer,uLong size) { + buffer[0] = '/'; + return(buffer); + } diff --git a/src/lib/libc/include/unistd.h b/src/lib/libc/include/unistd.h index f819ca0..e7e8fba 100755 --- a/src/lib/libc/include/unistd.h +++ b/src/lib/libc/include/unistd.h @@ -29,4 +29,7 @@ uShort getpid(void); pid_t fork(); -#endif \ No newline at end of file +//New Functions Added Belong Under Here +char *getcwd(char *buffer,uLong size); + +#endif diff --git a/src/lib/libc/stdio/Makefile b/src/lib/libc/stdio/Makefile index 7570829..bf9ba3b 100755 --- a/src/lib/libc/stdio/Makefile +++ b/src/lib/libc/stdio/Makefile @@ -23,19 +23,19 @@ # Compile the source files .cc.o: - $(G++) $(CFLAGS) -Wall -nostdinc -O -I../include -c -o $@ $< + $(G++) $(CFLAGS) -Wall -nostdlib -O -I../include -c -o $@ $< .cc.s: - $(G++) $(CFLAGS) -Wall -nostdinc -O -I../include -S -o $@ $< + $(G++) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< .c.o: - $(GCC) $(CFLAGS) -Wall -nostdinc -O -I../include -c $< + $(GCC) $(CFLAGS) -Wall -nostdlib -O -I../include -c $< .c.s: - $(GCC) $(CFLAGS) -Wall -nostdinc -O -I../include -S -o $@ $< + $(GCC) $(CFLAGS) -Wall -nostdlib -O -I../include -S -o $@ $< .S.o: - $(GCC) $(CFLAGS) -Wall -nostdinc -c -o $@ $< + $(GCC) $(CFLAGS) -Wall -nostdlib -c -o $@ $< # Clean up the junk clean: diff --git a/src/lib/ubix/Makefile b/src/lib/ubix/Makefile new file mode 100755 index 0000000..956a6f3 --- /dev/null +++ b/src/lib/ubix/Makefile @@ -0,0 +1,42 @@ +# $Id$ +# Kernel Makefile (C) 2002 The UbixOS Project + + +#Compiler +GCC = gcc +G++ = gcc + +#Linker +LD = ld + +#Binary File Name +BINARY = none + +#Delete Program +REMOVE = rm -f + +#Objects +OBJS = startup.o + +# Make the Binary +$(BINARY) : $(OBJS) + +# Compile the source files +.cc.o: + $(G++) -Wall -fomit-frame-pointer -O -I../libc/include -c -o $@ $< + +.cc.s: + $(G++) -Wall -fomit-frame-pointer -O -I../libc/include -S -o $@ $< + +.c.o: + $(GCC) -Wall -O -I../libc/include -c -o $@ $< + +.c.s: + $(GCC) -Wall -fomit-frame-pointer -O -I../libc/include -S -o $@ $< + +.S.o: + $(GCC) -Wall -fomit-frame-pointer -c -o $@ $< + +# Clean up the junk +clean: + $(REMOVE) $(OBJS) $(BINARY) diff --git a/src/lib/ubix/startup.c b/src/lib/ubix/startup.c new file mode 100755 index 0000000..6952908 --- /dev/null +++ b/src/lib/ubix/startup.c @@ -0,0 +1,30 @@ +/************************************************************************************** + Copyright (c) 2002 The UbixOS Project + All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors +in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project nor the names of its +contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id$ + +**************************************************************************************/ + +#include + +extern int main(); + +void _start() { + exit(main()); + } \ No newline at end of file diff --git a/src/tools/Makefile b/src/tools/Makefile index 516c82a..6dd8ead 100755 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -47,8 +47,10 @@ (cp ../bin/shell/shell ./) (cp ../bin/test/test ./) (cp ../bin/ls/ls ./) - (./format 101 init shell test ls) + (cp ../bin/pwd/pwd ./) + (./format 101 init shell test ls pwd) (rm init) (rm shell) (rm test) (rm ls) + (rm pwd) diff --git a/ubixos.kdevprj b/ubixos.kdevprj index 337aefb..4ce5408 100755 --- a/ubixos.kdevprj +++ b/ubixos.kdevprj @@ -44,7 +44,7 @@ kdevprj_version=1.3 lfv_open_groups=Others make_options=\s-j1 clean all install -makefiles=./Makefile.am,src/Makefile.am,src/sys/Makefile.am,src/sys/include/Makefile.am,src/lib/Makefile.am,src/lib/libc/Makefile.am,src/lib/libc/include/Makefile.am,src/bin/Makefile.am,src/bin/shell/Makefile.am,Makefile.am,src/sys/boot/Makefile.am,src/sys/init/Makefile.am,src/sys/include/ubixos/Makefile.am,src/sys/drivers/Makefile.am,src/sys/kernel/Makefile.am,src/sys/compile/Makefile.am,src/sys/include/version/Makefile.am,src/sys/include/drivers/Makefile.am,src/sys/vmm/Makefile.am,src/sys/include/vmm/Makefile.am,src/sys/include/ubixfs/Makefile.am,src/sys/ubixfs/Makefile.am,src/tools/Makefile.am,src/bin/init/Makefile.am,src/lib/libc/stdio/Makefile.am,src/lib/libc/include/sys/Makefile.am,src/lib/libc/sys/Makefile.am,src/lib/libc/stdlib/Makefile.am,src/bin/test/Makefile.am,src/lib/ubix/Makefile.am,src/bin/ls/Makefile.am +makefiles=./Makefile.am,src/Makefile.am,src/sys/Makefile.am,src/sys/include/Makefile.am,src/lib/Makefile.am,src/lib/libc/Makefile.am,src/lib/libc/include/Makefile.am,src/bin/Makefile.am,src/bin/shell/Makefile.am,Makefile.am,src/sys/boot/Makefile.am,src/sys/init/Makefile.am,src/sys/include/ubixos/Makefile.am,src/sys/drivers/Makefile.am,src/sys/kernel/Makefile.am,src/sys/compile/Makefile.am,src/sys/include/version/Makefile.am,src/sys/include/drivers/Makefile.am,src/sys/vmm/Makefile.am,src/sys/include/vmm/Makefile.am,src/sys/include/ubixfs/Makefile.am,src/sys/ubixfs/Makefile.am,src/tools/Makefile.am,src/bin/init/Makefile.am,src/lib/libc/stdio/Makefile.am,src/lib/libc/include/sys/Makefile.am,src/lib/libc/sys/Makefile.am,src/lib/libc/stdlib/Makefile.am,src/bin/test/Makefile.am,src/lib/ubix/Makefile.am,src/bin/ls/Makefile.am,src/bin/pwd/Makefile.am,src/lib/libc/generic/Makefile.am modifyMakefiles=true project_name=UbixOS project_type=normal_empty @@ -105,7 +105,7 @@ [src/bin/Makefile.am] files=src/bin/Makefile -sub_dirs=shell,init,test,ls +sub_dirs=shell,init,test,ls,pwd type=normal [src/bin/init/Makefile] @@ -144,6 +144,25 @@ install_location= type=SOURCE +[src/bin/pwd/Makefile] +dist=true +install=false +install_location= +type=DATA + +[src/bin/pwd/Makefile.am] +files=src/bin/pwd/main.c,src/bin/pwd/Makefile +sharedlib_LDFLAGS=-version-info 0:0:0 +sharedlib_rootname=pwd +sub_dirs= +type=static_library + +[src/bin/pwd/main.c] +dist=true +install=false +install_location= +type=SOURCE + [src/bin/shell/Makefile] dist=true install=false @@ -192,9 +211,28 @@ [src/lib/libc/Makefile.am] files=src/lib/libc/vsprintf.c,src/lib/libc/Makefile -sub_dirs=include,stdio,sys,stdlib +sub_dirs=include,stdio,sys,stdlib,generic type=static_library +[src/lib/libc/generic/Makefile] +dist=true +install=false +install_location= +type=DATA + +[src/lib/libc/generic/Makefile.am] +files=src/lib/libc/generic/getcwd.c,src/lib/libc/generic/Makefile +sharedlib_LDFLAGS=-version-info 0:0:0 +sharedlib_rootname=generic +sub_dirs= +type=static_library + +[src/lib/libc/generic/getcwd.c] +dist=true +install=false +install_location= +type=SOURCE + [src/lib/libc/include/Makefile.am] files=src/lib/libc/include/stdarg.h,src/lib/libc/include/stdio.h,src/lib/libc/include/unistd.h,src/lib/libc/include/stdlib.h,src/lib/libc/include/string.h sub_dirs=sys