summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gdbinit2
-rw-r--r--README.md12
-rw-r--r--fs/elf.c16
-rw-r--r--fs/ext2.c1
-rw-r--r--kernel/config.h2
-rw-r--r--packages/ncurses-5.9/README14
-rw-r--r--packages/ncurses-5.9/ncurses-5.9-foolos.patch77
-rw-r--r--userspace/Makefile2
-rw-r--r--userspace/foolshell.c4
-rw-r--r--userspace/sys/sys/termios.h7
10 files changed, 112 insertions, 25 deletions
diff --git a/.gdbinit b/.gdbinit
index 4a45ea3..aeea92b 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -1,3 +1,3 @@
file foolos.img
+path ~/temp/fool-os-stuff/ncurses/ncurses-5.9-build/progs
target remote :1234
-
diff --git a/README.md b/README.md
index 8c77cc8..4b9dee0 100644
--- a/README.md
+++ b/README.md
@@ -38,18 +38,16 @@ Requirements:
gcc-5.1.0
* Newlib 2.2.0 [2]
+
+ (newlib-2.2.0.20150423.tar.gz)
+
+ adapt config.sub (add -foolos*) and build in a separate direcotry.
- adapt config.sub
+ $ ../newlib-xxx/configure --target=i686-foolos --prefix=/home/miguel/opt/gcc-5.1.0-foolos/
- $ ./configure --target=i686-foolos --prefix=/home/miguel/opt/gcc-5.1.0-foolos/
$ make
$ make install
- /*
- adapt libgloss/libnosys
- uncomment environ.c and add stubwarnings for sbrk and exit
- */
-
* GRUB2
diff --git a/fs/elf.c b/fs/elf.c
index dc5f472..73570d9 100644
--- a/fs/elf.c
+++ b/fs/elf.c
@@ -81,7 +81,7 @@ uint32_t load_elf(char *name, uint32_t *alloc)
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"loading %s",name);
ext2_check(ext2_ramimage);
- ext2_inode_content(ext2_ramimage,inode_nr,vaddr,0x100000); // load 1mb;
+ ext2_inode_content(ext2_ramimage,inode_nr,vaddr,0x100000); // max ignored??
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_DEBUG,"ELF File loaded to final destination.");
@@ -144,15 +144,20 @@ uint32_t load_elf(char *name, uint32_t *alloc)
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_DEBUG,"bss: 0x%08X-0x%08X",phdr->p_vaddr+phdr->p_filesz,phdr->p_vaddr+phdr->p_memsz);
// let's copy the rw- data block
- uint32_t *data=vaddr+phdr->p_offset;
- for(uint32_t *addr=phdr->p_vaddr; addr<=phdr->p_vaddr+phdr->p_filesz; addr++)
+ // from right to left so we not overwrite ourselves!!
+
+ //for(uint8_t *addr=phdr->p_vaddr; addr<=phdr->p_vaddr+phdr->p_filesz; addr++) // this was wrong!
+ //uint8_t *data=vaddr+phdr->p_offset;
+ uint8_t *data=vaddr+phdr->p_offset+phdr->p_filesz-1;
+
+ for(uint8_t *addr=phdr->p_vaddr+phdr->p_filesz-1; addr>=phdr->p_vaddr; addr--)
{
*addr=*data;
- data++;
+ data--;
}
// let's zero init bss and set alloc (heap) just right after it!
- for(uint32_t *addr=phdr->p_vaddr+phdr->p_filesz; addr<=phdr->p_vaddr+phdr->p_memsz; addr++)
+ for(uint8_t *addr=phdr->p_vaddr+phdr->p_filesz; addr<=phdr->p_vaddr+phdr->p_memsz; addr++)
{
*addr=0;
}
@@ -162,6 +167,7 @@ uint32_t load_elf(char *name, uint32_t *alloc)
}
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_DEBUG,"heap starts at: 0x%08X",*alloc);
return elf->e_entry;
diff --git a/fs/ext2.c b/fs/ext2.c
index 1f4d04e..c313775 100644
--- a/fs/ext2.c
+++ b/fs/ext2.c
@@ -184,7 +184,6 @@ void* ext2_get_indirectstart_double(void *start, uint32_t block_size, uint32_t i
int idx=block_idx%(block_size/4);
//log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"bl: %d : %d / %d",block_idx,indirect1_idx, idx);
-
return ext2_get_indirectstart(start,block_size,dil[indirect1_idx],idx);
}
diff --git a/kernel/config.h b/kernel/config.h
index 5c58245..cf81361 100644
--- a/kernel/config.h
+++ b/kernel/config.h
@@ -13,7 +13,7 @@
#define FOOLOS_CONSOLE_AUTOBREAK // add newline automatically at end of line
#define FOOLOS_LOG_OFF // do not log anything
-#define FOOLOS_LOG_WHITELIST "elf","ext2","" // make exceptions for these modules. wmpty string marks the end
+#define FOOLOS_LOG_WHITELIST "","elf","ext2","" // make exceptions for these modules. wmpty string marks the end
#define FOOLOS_LOG_LEVEL FOOLOS_LOG_FINE // minimal severity level to log
#define FOOLOS_CONSOLE // otherwise VESA will be used!
diff --git a/packages/ncurses-5.9/README b/packages/ncurses-5.9/README
index d5bcc5a..5f22dfa 100644
--- a/packages/ncurses-5.9/README
+++ b/packages/ncurses-5.9/README
@@ -1,9 +1,9 @@
-1. extract ncurses-5.9
-2. cd ncurses
-3. exchange config.sub (just add foolos) and add +x
-4. put termios.h in sysroot/usr/include/sys
-5. ./configure --host=i686-foolos --without-tests --with-fallbacks=linux
-(or $ ./configure --host=i686-foolos --without-tests --with-fallbacks=linux --with-debug CFLAGS="-gstabs -O0" CXXFLAGS="-gstabs -O0"
+1. extract ncurses-5.9.tar.gz
+2. apply patch inside direcotry with : patch -p1 < ../ncurses-5.9-foolos.patch
+3. build in seperate directory
+5. ../ncurses-xxx/configure --host=i686-foolos --without-tests --with-fallbacks=linux
+(or $ ../ncurses-xxx/configure --host=i686-foolos --without-tests --with-fallbacks=linux --with-debug CFLAGS="-gstabs -O0" CXXFLAGS="-gstabs -O0")
+
+??? FOR SOME REASON WE NEED TO PASS : CC=i686-foolos-gcc
6. make
-AS A WORKAROUND PASS: LDFLAGS=-lfool CC=i686-foolos-gcc
diff --git a/packages/ncurses-5.9/ncurses-5.9-foolos.patch b/packages/ncurses-5.9/ncurses-5.9-foolos.patch
new file mode 100644
index 0000000..3bd30ac
--- /dev/null
+++ b/packages/ncurses-5.9/ncurses-5.9-foolos.patch
@@ -0,0 +1,77 @@
+diff -rc ncurses-5.9-original/config.sub ncurses-5.9-foolos/config.sub
+*** ncurses-5.9-original/config.sub 2010-09-11 00:25:58.000000000 +0200
+--- ncurses-5.9-foolos/config.sub 2015-05-24 11:32:41.269431181 +0200
+***************
+*** 1303,1309 ****
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+! | -sym* | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+--- 1303,1309 ----
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+! | -sym* | -kopensolaris* | -foolos* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+diff -rc ncurses-5.9-original/ncurses/tinfo/lib_baudrate.c ncurses-5.9-foolos/ncurses/tinfo/lib_baudrate.c
+*** ncurses-5.9-original/ncurses/tinfo/lib_baudrate.c 2010-12-19 02:50:50.000000000 +0100
+--- ncurses-5.9-foolos/ncurses/tinfo/lib_baudrate.c 2015-05-24 12:02:40.096469069 +0200
+***************
+*** 39,44 ****
+--- 39,48 ----
+
+ #include <curses.priv.h>
+ #include <termcap.h> /* ospeed */
++ #include <termios.h>
++
++
++
+ #if defined(__FreeBSD__)
+ #include <sys/param.h>
+ #endif
+diff -rc ncurses-5.9-original/ncurses/tty/lib_twait.c ncurses-5.9-foolos/ncurses/tty/lib_twait.c
+*** ncurses-5.9-original/ncurses/tty/lib_twait.c 2010-12-26 00:43:58.000000000 +0100
+--- ncurses-5.9-foolos/ncurses/tty/lib_twait.c 2015-05-24 12:15:03.770339113 +0200
+***************
+*** 53,58 ****
+--- 53,60 ----
+ #include <OS.h>
+ #endif
+
++ # include <sys/time.h>
++
+ #if USE_FUNC_POLL
+ # if HAVE_SYS_TIME_H
+ # include <sys/time.h>
+diff -rc ncurses-5.9-original/progs/toe.c ncurses-5.9-foolos/progs/toe.c
+*** ncurses-5.9-original/progs/toe.c 2010-05-02 00:04:08.000000000 +0200
+--- ncurses-5.9-foolos/progs/toe.c 2015-05-24 12:38:52.000570377 +0200
+***************
+*** 36,41 ****
+--- 36,43 ----
+ * toe.c --- table of entries report generator
+ */
+
++ #include <termios.h>
++
+ #include <progs.priv.h>
+
+ #include <sys/stat.h>
+diff -rc ncurses-5.9-original/progs/tset.c ncurses-5.9-foolos/progs/tset.c
+*** ncurses-5.9-original/progs/tset.c 2010-05-01 23:42:46.000000000 +0200
+--- ncurses-5.9-foolos/progs/tset.c 2015-05-24 12:34:33.000328018 +0200
+***************
+*** 85,90 ****
+--- 85,91 ----
+ * SUCH DAMAGE.
+ */
+
++ #include <termios.h>
+ #define USE_LIBTINFO
+ #define __INTERNAL_CAPS_VISIBLE /* we need to see has_hardware_tabs */
+ #include <progs.priv.h>
diff --git a/userspace/Makefile b/userspace/Makefile
index d87b7a7..5590a42 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -29,7 +29,7 @@ ext2.img: $(PROGS) ../mp/mp.bin
echo "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++." > mnt/home/miguel/hello.brain
# cp ~/temp/fool-os-stuff/binutils-build-host-foolos/binutils/readelf mnt/bin
# cp ../font/binfont.bin mnt/
- cp ~/temp/fool-os-stuff/ncurses-5.9-foolos-new/progs/* mnt/bin/
+ cp ~/temp/fool-os-stuff/ncurses/ncurses-5.9-build/progs/* mnt/bin/
cp ../mp/mp.bin mnt/boot/
mkdir -p mnt/etc
echo "127.0.0.1 localhost" > mnt/etc/hosts
diff --git a/userspace/foolshell.c b/userspace/foolshell.c
index fa62094..ba73e1d 100644
--- a/userspace/foolshell.c
+++ b/userspace/foolshell.c
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
if(!silent)hello();
//char *buf=malloc(256);
- char buf[256];
+ char *buf=calloc(sizeof(char),256);
while(1)
{
@@ -101,7 +101,7 @@ char **tokenize(char *buf)
for(i=0;i<l;i++)
{
// init space for next token
- token[c]=calloc(sizeof(char),256);
+ token[c]=malloc(256);
//skip all the whitespace
while(buf[i]==' '&&i<l)i++;
diff --git a/userspace/sys/sys/termios.h b/userspace/sys/sys/termios.h
index b6625be..9b9cdc4 100644
--- a/userspace/sys/sys/termios.h
+++ b/userspace/sys/sys/termios.h
@@ -1,3 +1,5 @@
+#include <stdint.h>
+
typedef uint32_t speed_t;
typedef uint32_t DIR;
@@ -18,3 +20,8 @@ typedef uint32_t DIR;
#define B19200 0000016
#define B38400 0000017
+struct direct{
+ char d_name[256];
+ int d_namlen
+};
+