diff --git a/src/bin/Makefile b/src/bin/Makefile index 55415f9..b657cf1 100755 --- a/src/bin/Makefile +++ b/src/bin/Makefile @@ -1,11 +1,14 @@ # $Id$ # The System Makefile (C) 2002 The UbixOS Project -all: init-bin shell-bin test-bin ls-bin pwd-bin +all: init-bin login-bin shell-bin test-bin ls-bin pwd-bin init-bin: init (cd init;make) +login-bin: login + (cd login;make) + shell-bin: shell (cd shell;make) @@ -24,3 +27,4 @@ (cd test;make clean) (cd ls;make clean) (cd pwd;make clean) + (cd login;make clean) diff --git a/src/bin/init/main.c b/src/bin/init/main.c index e6cf0b2..cbcd581 100755 --- a/src/bin/init/main.c +++ b/src/bin/init/main.c @@ -33,10 +33,10 @@ printf("Sorry This Program Must Be Started By The Kernel!!!!\n"); exit(1); } - printf("Initializing system.\n"); + printf("Initializing System.\n"); if (!fork()) { - exec("shell"); - printf("Error Starting Shell\n"); + exec("login"); + printf("Error Starting System\n"); } exit(1); } diff --git a/src/bin/login/Makefile b/src/bin/login/Makefile new file mode 100755 index 0000000..71cebce --- /dev/null +++ b/src/bin/login/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 -fno-builtin + +#Linker +LD = ld + +#Binary File Name +BINARY = login + +#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 + +#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/login/main.c b/src/bin/login/main.c new file mode 100755 index 0000000..705ad1a --- /dev/null +++ b/src/bin/login/main.c @@ -0,0 +1,56 @@ +/************************************************************************************** + 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 +#include +#include +#include + +int main() { + int shellPid = 0; + char userName[32]; + char passWord[128]; + while (1) { + printf("\nUbixOS/IA-32 (devel.ubixos.com) (console)\n\n"); + login: + printf("Login: "); + gets((char *)&userName); + printf("Password: "); + gets((char *)&passWord); + if ((0 == memcmp(userName,"root",4)) && (0 == memcmp(passWord,"root",4))) { + shellPid = fork(); + if (!shellPid) { + exec("shell"); + } + else { + while (pidStatus(shellPid)) { asm("nop"); } + } + } + else { + printf("Login Incorrect!\n"); + goto login; + } + } + exit(1); + } diff --git a/src/bin/ls/main.c b/src/bin/ls/main.c index c7642da..167139a 100755 --- a/src/bin/ls/main.c +++ b/src/bin/ls/main.c @@ -22,17 +22,9 @@ **************************************************************************************/ #include +#include int main() { - long *test = 0x0; - int i=0; printf("pwd init shell ls\n"); - if (!(test = malloc(4096))) { - printf("Error"); - exit(1); - } - for (i=0;i<1024;i++) { - test[i] = 0x0; - } exit(1); } diff --git a/src/bin/pwd/main.c b/src/bin/pwd/main.c index b9c4c57..5314e5b 100755 --- a/src/bin/pwd/main.c +++ b/src/bin/pwd/main.c @@ -22,6 +22,7 @@ **************************************************************************************/ #include +#include #include int main() { diff --git a/src/bin/shell/main.c b/src/bin/shell/main.c index 8f5a021..ada9e50 100755 --- a/src/bin/shell/main.c +++ b/src/bin/shell/main.c @@ -22,8 +22,10 @@ **************************************************************************************/ #include +#include #include #include +#include int main() { unsigned char *buffer,*tmp; diff --git a/src/bin/test/main.c b/src/bin/test/main.c index 2abace5..f4401fe 100755 --- a/src/bin/test/main.c +++ b/src/bin/test/main.c @@ -23,6 +23,7 @@ #include #include +#include #include int main() { diff --git a/src/lib/libc/include/stdlib.h b/src/lib/libc/include/stdlib.h index 13b4a03..eadf5ac 100755 --- a/src/lib/libc/include/stdlib.h +++ b/src/lib/libc/include/stdlib.h @@ -27,5 +27,6 @@ #include void exit(int); +void *malloc(uInt len); #endif diff --git a/src/lib/libc/include/sys/sys.h b/src/lib/libc/include/sys/sys.h index 742f4b9..325afe3 100755 --- a/src/lib/libc/include/sys/sys.h +++ b/src/lib/libc/include/sys/sys.h @@ -26,5 +26,6 @@ int exec(char *); int pidStatus(int pid); +void *getPage(); -#endif \ No newline at end of file +#endif diff --git a/src/lib/libc/stdio/vsprintf.c b/src/lib/libc/stdio/vsprintf.c index 0c9ba99..6a1055f 100755 --- a/src/lib/libc/stdio/vsprintf.c +++ b/src/lib/libc/stdio/vsprintf.c @@ -15,6 +15,7 @@ */ #include +#include /* we use this so that we can do without the ctype library */ #define is_digit(c) ((c) >= '0' && (c) <= '9') diff --git a/src/lib/libc/stdlib/exit.c b/src/lib/libc/stdlib/exit.c index 0722f34..6d09554 100755 --- a/src/lib/libc/stdlib/exit.c +++ b/src/lib/libc/stdlib/exit.c @@ -21,9 +21,11 @@ **************************************************************************************/ +#include + void exit(int status) { asm( "int %0\n" : : "i" (0x80),"a" (2),"b" (status) ); - } \ No newline at end of file + } diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 8754aa3..5ee8a7b 100755 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -22,6 +22,8 @@ **************************************************************************************/ #include +#include +#include struct memDescriptor { void *page; diff --git a/src/lib/libc/sys/getpage.c b/src/lib/libc/sys/getpage.c index 57c88d2..a835b03 100755 --- a/src/lib/libc/sys/getpage.c +++ b/src/lib/libc/sys/getpage.c @@ -27,5 +27,5 @@ "int %0\n" : : "i" (0x80),"a" (7),"b" (&pageAddr) ); - return(pageAddr); + return((void *)pageAddr); } diff --git a/src/sys/init/main.c b/src/sys/init/main.c index edc2af2..c1bbe40 100755 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -97,7 +97,7 @@ initUbixFS(); //Initialize File System execThread(idleThread,0xAFFF,"Idle Thread"); execFile("init"); - kprintf("Free Pages: [%i]\n",freePages); + //kprintf("Free Pages: [%i]\n",freePages); enableIrq(0); while (1); } diff --git a/src/tools/Makefile b/src/tools/Makefile index 3b5fb7d..635281e 100755 --- a/src/tools/Makefile +++ b/src/tools/Makefile @@ -48,9 +48,11 @@ (cp ../bin/test/test ./) (cp ../bin/ls/ls ./) (cp ../bin/pwd/pwd ./) - (./format 101 2000 init shell test ls pwd) + (cp ../bin/login/login ./) + (./format 101 2000 init shell test ls pwd login) (rm init) (rm shell) (rm test) (rm ls) (rm pwd) + (rm login) diff --git a/ubixos.kdevprj b/ubixos.kdevprj index 805bc11..b10fdd0 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,src/bin/pwd/Makefile.am,src/lib/libc/generic/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,src/bin/login/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,pwd +sub_dirs=shell,init,test,ls,pwd,login type=normal [src/bin/init/Makefile] @@ -125,6 +125,23 @@ install_location= type=SOURCE +[src/bin/login/Makefile] +dist=true +install=false +install_location= +type=DATA + +[src/bin/login/Makefile.am] +files=src/bin/login/Makefile,src/bin/login/main.c +sub_dirs= +type=static_library + +[src/bin/login/main.c] +dist=true +install=false +install_location= +type=SOURCE + [src/bin/ls/Makefile] dist=true install=false