summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2015-05-25 13:04:41 +0200
committerMichal Idziorek <m.i@gmx.at>2015-05-25 13:04:41 +0200
commit2c8cefb3a269d66a6a705bcb4912b0657379273c (patch)
tree677ee15b87072e5ccd560f1be277abaf11b1ec28
parent8ea3e244d44190e44a092ffb004e13ad94174c68 (diff)
fixed crt0.o for compiler toolchain (-lfool no more!)
-rw-r--r--userspace/Makefile13
-rw-r--r--userspace/sys/Makefile22
-rw-r--r--userspace/sys/crt.S (renamed from userspace/sys/crt0.S)0
-rw-r--r--userspace/sys/crt0.obin660 -> 0 bytes
-rw-r--r--userspace/sys/libfool.abin37550 -> 0 bytes
-rw-r--r--userspace/sys/linker.ld37
-rw-r--r--userspace/sys/sgtty.h15
-rw-r--r--userspace/sys/sys.obin18236 -> 0 bytes
-rw-r--r--userspace/sys/sys/ioctl.h0
-rw-r--r--userspace/sys/sys/termios.h (renamed from userspace/sys/termios.h)0
-rw-r--r--userspace/sys/syscalls.obin18544 -> 0 bytes
11 files changed, 63 insertions, 24 deletions
diff --git a/userspace/Makefile b/userspace/Makefile
index 1f562ab..d87b7a7 100644
--- a/userspace/Makefile
+++ b/userspace/Makefile
@@ -2,16 +2,14 @@
CC=i686-foolos-gcc
CFLAGS=
-#CFLAGS+=-fstack-protector-all
CFLAGS+=-I..
CFLAGS+=-w
CFLAGS+=-std=gnu11
-CFLAGS+=-O3
+CFLAGS+=-O0
CFLAGS+=-g
-LDFLAGS=
-LDFLAGS=-lfool
+#CFLAGS+=-fstack-protector-all
-#CFLAGS+=$(SYSROOT)/usr/lib/crt0.o
+LDFLAGS=
PROGS=foolshell ls simple brainfuck add checker clear task1 task2 init cat snake
@@ -44,7 +42,7 @@ snake: snake.o
foolshell: foolshell.o
simple: simple.o
add: add.o
- $(CC) -o $@ $< -lm -lfool
+ $(CC) -o $@ $< -lm
checker: checker.o
task1: task1.o
task2: task2.o
@@ -64,6 +62,3 @@ umount:
rm mnt -rf
new: clean ext2.img
-
-
-
diff --git a/userspace/sys/Makefile b/userspace/sys/Makefile
index 2e71714..05177a6 100644
--- a/userspace/sys/Makefile
+++ b/userspace/sys/Makefile
@@ -1,31 +1,23 @@
SYSROOT=/home/miguel/opt/foolos
CC=i686-foolos-gcc
+LD=i686-foolos-ld
CFLAGS=
CFLAGS+=-w
CFLAGS+=-I../..
CFLAGS+=-gstabs
-OBJECTS=sys.o syscalls.o crt0.o
-
-full: clean library_install crt_install header_install
-
-all: $(OBJECTS)
-
-crt0.o: crt0.S
+install: crt_install header_install
crt_install: crt0.o
cp crt0.o $(SYSROOT)/usr/lib/
-header_install:
- cp termios.h $(SYSROOT)/usr/include/sys/
-
-libfool.a: sys.o syscalls.o
- ar rcs libfool.a sys.o syscalls.o
-
-library_install: libfool.a
- cp libfool.a $(SYSROOT)/usr/lib/
+crt0.o: crt.o sys.o syscalls.o
+ $(LD) -r $^ -o $@
+header_install:
+ cp *.h $(SYSROOT)/usr/include/
+ cp sys/*.h $(SYSROOT)/usr/include/sys/
clean:
-rm *.o *.a
diff --git a/userspace/sys/crt0.S b/userspace/sys/crt.S
index d09f8ca..d09f8ca 100644
--- a/userspace/sys/crt0.S
+++ b/userspace/sys/crt.S
diff --git a/userspace/sys/crt0.o b/userspace/sys/crt0.o
deleted file mode 100644
index 1b71404..0000000
--- a/userspace/sys/crt0.o
+++ /dev/null
Binary files differ
diff --git a/userspace/sys/libfool.a b/userspace/sys/libfool.a
deleted file mode 100644
index 0823595..0000000
--- a/userspace/sys/libfool.a
+++ /dev/null
Binary files differ
diff --git a/userspace/sys/linker.ld b/userspace/sys/linker.ld
new file mode 100644
index 0000000..7c1c4bf
--- /dev/null
+++ b/userspace/sys/linker.ld
@@ -0,0 +1,37 @@
+ENTRY(_start)
+
+SECTIONS
+{
+ . = 1M;
+
+ kernel_start = .;
+
+ .text BLOCK(4K) : ALIGN(4K)
+ {
+ *(.multiboot)
+ *(.text)
+ }
+
+ /* Read-only data. */
+ .rodata BLOCK(4K) : ALIGN(4K)
+ {
+ *(.rodata)
+ }
+
+ /* Read-write data (initialized) */
+ .data BLOCK(4K) : ALIGN(4K)
+ {
+ *(.data)
+ }
+
+ /* Read-write data (uninitialized) and stack */
+ .bss BLOCK(4K) : ALIGN(4K)
+ {
+ *(COMMON)
+ *(.bss)
+ *(.bootstrap_stack)
+ }
+
+ kernel_end = .;
+
+}
diff --git a/userspace/sys/sgtty.h b/userspace/sys/sgtty.h
new file mode 100644
index 0000000..9e91b44
--- /dev/null
+++ b/userspace/sys/sgtty.h
@@ -0,0 +1,15 @@
+#define TIOCFLUSH 0x01
+#define RAW 0x02
+#define CBREAK 0x04
+#define XTABS 0x08
+#define CRMOD 0x10
+#define ECHO 0x20
+
+struct sgttyb{
+ int sg_ospeed;
+ int sg_erase;
+ int sg_kill;
+ int sg_flags;
+
+ // TODO: same struct should be used for /terminal/terminal.h ?
+};
diff --git a/userspace/sys/sys.o b/userspace/sys/sys.o
deleted file mode 100644
index dc5a2e3..0000000
--- a/userspace/sys/sys.o
+++ /dev/null
Binary files differ
diff --git a/userspace/sys/sys/ioctl.h b/userspace/sys/sys/ioctl.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/userspace/sys/sys/ioctl.h
diff --git a/userspace/sys/termios.h b/userspace/sys/sys/termios.h
index b6625be..b6625be 100644
--- a/userspace/sys/termios.h
+++ b/userspace/sys/sys/termios.h
diff --git a/userspace/sys/syscalls.o b/userspace/sys/syscalls.o
deleted file mode 100644
index a0a4265..0000000
--- a/userspace/sys/syscalls.o
+++ /dev/null
Binary files differ