summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Applications/About/Makefile11
-rw-r--r--Applications/FileManager/Makefile11
-rw-r--r--Applications/FontEditor/Makefile9
-rw-r--r--Applications/Launcher/Makefile9
-rw-r--r--Applications/Terminal/Makefile9
-rw-r--r--Kernel/Makefile10
-rwxr-xr-xKernel/makeall.sh2
-rw-r--r--LibC/Makefile20
-rw-r--r--LibC/string.cpp6
-rw-r--r--LibC/sys/types.h2
-rw-r--r--LibGUI/Makefile11
-rw-r--r--ReadMe.md6
-rw-r--r--SharedGraphics/Font.cpp2
-rw-r--r--Userland/Makefile10
-rw-r--r--Userland/sh.cpp4
-rw-r--r--Userland/sysctl.cpp2
-rw-r--r--WindowServer/Makefile9
17 files changed, 58 insertions, 75 deletions
diff --git a/Applications/About/Makefile b/Applications/About/Makefile
index 69a58233de..96f4fae787 100644
--- a/Applications/About/Makefile
+++ b/Applications/About/Makefile
@@ -5,19 +5,18 @@ APP = About
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
-FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
+FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
-CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
+CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
+CXX = i686-elf-g++
+LD = i686-elf-ld
AR = ar
-LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
+LDFLAGS = -static
all: $(APP)
diff --git a/Applications/FileManager/Makefile b/Applications/FileManager/Makefile
index 35f4111004..981cfe430b 100644
--- a/Applications/FileManager/Makefile
+++ b/Applications/FileManager/Makefile
@@ -6,19 +6,18 @@ APP = FileManager
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
-FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
+FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
-CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
+CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
+CXX = i686-elf-g++
+LD = i686-elf-ld
AR = ar
-LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
+LDFLAGS = -static
all: $(APP)
diff --git a/Applications/FontEditor/Makefile b/Applications/FontEditor/Makefile
index e65e962f70..70722ae8cc 100644
--- a/Applications/FontEditor/Makefile
+++ b/Applications/FontEditor/Makefile
@@ -6,7 +6,6 @@ APP = FontEditor
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
@@ -14,11 +13,11 @@ INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
-CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
+CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
+CXX = i686-elf-g++
+LD = i686-elf-ld
AR = ar
-LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
+LDFLAGS = -static
all: $(APP)
diff --git a/Applications/Launcher/Makefile b/Applications/Launcher/Makefile
index 3158cda285..e8c5644c2f 100644
--- a/Applications/Launcher/Makefile
+++ b/Applications/Launcher/Makefile
@@ -5,7 +5,6 @@ APP = Launcher
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
@@ -13,11 +12,11 @@ INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
-CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
+CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
+CXX = i686-elf-g++
+LD = i686-elf-ld
AR = ar
-LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
+LDFLAGS = -static
all: $(APP)
diff --git a/Applications/Terminal/Makefile b/Applications/Terminal/Makefile
index 9a74f22908..e14dcf5554 100644
--- a/Applications/Terminal/Makefile
+++ b/Applications/Terminal/Makefile
@@ -6,7 +6,6 @@ APP = Terminal
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
@@ -14,11 +13,11 @@ INCLUDE_FLAGS = -I../.. -I. -I../../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
-CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
+CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
+CXX = i686-elf-g++
+LD = i686-elf-ld
AR = ar
-LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
+LDFLAGS = -static
all: $(APP)
diff --git a/Kernel/Makefile b/Kernel/Makefile
index 6b04393e21..62df5aaa9e 100644
--- a/Kernel/Makefile
+++ b/Kernel/Makefile
@@ -66,9 +66,9 @@ BOOTLOADER = Boot/boot.bin
IMAGE = .floppy-image
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-KERNEL_FLAGS = -ffreestanding -fno-stack-protector -fno-builtin
+KERNEL_FLAGS =
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
-FLAVOR_FLAGS = -mregparm=3 -march=i686 -m32 -fno-exceptions -fno-rtti
+FLAVOR_FLAGS = -mregparm=3 -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I.. -I.
#SUGGEST_FLAGS = -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override #-Wsuggest-attribute=noreturn
@@ -76,9 +76,9 @@ INCLUDE_FLAGS = -I.. -I.
DEFINES = -DSERENITY -DKERNEL -DSANITIZE_PTRS
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(KERNEL_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(SUGGEST_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
-LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections
+CXX = ~/opt/cross/bin/i686-elf-g++
+LD = ~/opt/cross/bin/i686-elf-ld
+LDFLAGS = -T linker.ld
all: $(KERNEL) $(IMAGE) kernel.map
diff --git a/Kernel/makeall.sh b/Kernel/makeall.sh
index 5dd42bc9dd..cecd5a1aaa 100755
--- a/Kernel/makeall.sh
+++ b/Kernel/makeall.sh
@@ -16,8 +16,6 @@ $make_cmd -C ../Applications/Terminal clean && \
$make_cmd -C ../Applications/Terminal && \
$make_cmd -C ../Applications/FontEditor clean && \
$make_cmd -C ../Applications/FontEditor && \
-$make_cmd -C ../Applications/Clock clean && \
-$make_cmd -C ../Applications/Clock && \
$make_cmd -C ../Applications/Launcher clean && \
$make_cmd -C ../Applications/Launcher && \
$make_cmd -C ../Applications/FileManager clean && \
diff --git a/LibC/Makefile b/LibC/Makefile
index d2ff62ae1a..a40dbe87d5 100644
--- a/LibC/Makefile
+++ b/LibC/Makefile
@@ -6,14 +6,6 @@ AK_OBJS = \
../AK/StdLibExtras.o \
../AK/kmalloc.o
-SHAREDGRAPHICS_OBJS = \
- ../SharedGraphics/Painter.o \
- ../SharedGraphics/Font.o \
- ../SharedGraphics/Rect.o \
- ../SharedGraphics/GraphicsBitmap.o \
- ../SharedGraphics/CharacterBitmap.o \
- ../SharedGraphics/Color.o
-
LIBC_OBJS = \
stdio.o \
unistd.o \
@@ -49,24 +41,24 @@ LIBC_OBJS = \
ASM_OBJS = setjmp.no
-CPP_OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS) $(SHAREDGRAPHICS_OBJS)
+CPP_OBJS = $(AK_OBJS) $(WIDGETS_OBJS) $(LIBC_OBJS)
LIBRARY = LibC.a
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-LIBC_FLAGS = -ffreestanding -fno-stack-protector -fno-builtin
+LIBC_FLAGS =
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
-FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
+FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I.. -I.
DEFINES = -DSERENITY -DUSERLAND -DSANITIZE_PTRS
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(LIBC_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
+CXX = i686-elf-g++
+LD = i686-elf-ld
AR = ar
-LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections
+LDFLAGS = -T linker.ld
all: $(LIBRARY)
diff --git a/LibC/string.cpp b/LibC/string.cpp
index dbea2a5b3b..e56c5498cb 100644
--- a/LibC/string.cpp
+++ b/LibC/string.cpp
@@ -102,7 +102,7 @@ int memcmp(const void* v1, const void* v2, size_t n)
return 0;
}
-void* memcpy(void* dest_ptr, const void* src_ptr, dword n)
+void* memcpy(void* dest_ptr, const void* src_ptr, size_t n)
{
if (n >= 1024)
return mmx_memcpy(dest_ptr, src_ptr, n);
@@ -130,7 +130,7 @@ void* memcpy(void* dest_ptr, const void* src_ptr, dword n)
return dest_ptr;
}
-void* memset(void* dest_ptr, int c, dword n)
+void* memset(void* dest_ptr, int c, size_t n)
{
dword dest = (dword)dest_ptr;
// FIXME: Support starting at an unaligned address.
@@ -293,7 +293,5 @@ char* strpbrk(const char* s, const char* accept)
return nullptr;
}
-
-
}
diff --git a/LibC/sys/types.h b/LibC/sys/types.h
index 8a80a4c340..17e87cf1b0 100644
--- a/LibC/sys/types.h
+++ b/LibC/sys/types.h
@@ -17,7 +17,7 @@ typedef uint32_t uid_t;
typedef uint32_t gid_t;
typedef int16_t pid_t;
-typedef uint32_t size_t;
+typedef __SIZE_TYPE__ size_t;
typedef int32_t ssize_t;
typedef uint32_t ino_t;
diff --git a/LibGUI/Makefile b/LibGUI/Makefile
index ec8abacc1b..629436e7f3 100644
--- a/LibGUI/Makefile
+++ b/LibGUI/Makefile
@@ -37,19 +37,18 @@ LIBS = ../LibC/LibC.a
LIBRARY = LibGUI.a
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-LIBC_FLAGS = -ffreestanding -fno-stack-protector -fno-ident
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
-FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
+FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I../LibC -I.. -I.
DEFINES = -DSERENITY -DUSERLAND -DSANITIZE_PTRS -DLIBGUI
-CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(LIBC_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
+CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
+CXX = i686-elf-g++
+LD = i686-elf-ld
AR = ar
-LDFLAGS = -T linker.ld --strip-debug -melf_i386 --gc-sections
+LDFLAGS =
all: $(LIBRARY)
diff --git a/ReadMe.md b/ReadMe.md
index 6dca05b731..638bea43ae 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -23,11 +23,13 @@ I always wanted to write my own operating system, but I never took it seriously.
## How do I get it to run?
-I've only tested this on an Ubuntu 18.10 host with clang, so I'm not sure it works anywhere else. If you'd like to run it, here's how you'd get it to boot:
+You need a cross-compiler for the i686-elf target.
+I've only tested this on an Ubuntu 18.10 host with GCC, so I'm not sure it works anywhere else.
+
+If you'd like to run it, here's how you'd get it to boot:
cd Kernel
./makeall.sh
- sudo ./sync.sh
./run q # Runs in QEMU
./run # Runs in bochs
diff --git a/SharedGraphics/Font.cpp b/SharedGraphics/Font.cpp
index 2dd0a1b2a8..3b68b6d6f6 100644
--- a/SharedGraphics/Font.cpp
+++ b/SharedGraphics/Font.cpp
@@ -120,7 +120,7 @@ bool Font::write_to_file(const String& path)
header.glyph_width = m_glyph_width;
header.glyph_height = m_glyph_height;
header.type = 0;
- memcpy(header.name, m_name.characters(), min(m_name.length(), 63u));
+ memcpy(header.name, m_name.characters(), min(m_name.length(), (size_t)63));
size_t bytes_per_glyph = sizeof(unsigned) * m_glyph_height;
diff --git a/Userland/Makefile b/Userland/Makefile
index ee357c30d7..e49e488b7a 100644
--- a/Userland/Makefile
+++ b/Userland/Makefile
@@ -71,19 +71,19 @@ APPS = \
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-USERLAND_FLAGS = -ffreestanding -fno-stack-protector
+USERLAND_FLAGS =
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
-FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
+FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I.. -I. -I../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
+CXX = i686-elf-g++
+LD = i686-elf-ld
AR = ar
-LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections
+LDFLAGS = -static -e _start
all: $(OBJS) $(APPS)
diff --git a/Userland/sh.cpp b/Userland/sh.cpp
index 99c1db9ef2..9ac70d36f8 100644
--- a/Userland/sh.cpp
+++ b/Userland/sh.cpp
@@ -19,7 +19,7 @@ struct GlobalState {
char hostname[32];
pid_t sid;
uid_t uid;
- termios termios;
+ struct termios termios;
bool was_interrupted { false };
};
static GlobalState* g;
@@ -159,7 +159,7 @@ static int sh_mp(int, char**)
return 1;
}
printf("mapped file @ %p\n", data);
- printf("contents: %c%c%c%c%c%c%c...\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
+ printf("contents: %c%c%c%c%c%c%c%c...\n", data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);
printf("leaving it open :)\n");
return 0;
diff --git a/Userland/sysctl.cpp b/Userland/sysctl.cpp
index 274a55fd62..b83211ec99 100644
--- a/Userland/sysctl.cpp
+++ b/Userland/sysctl.cpp
@@ -52,7 +52,7 @@ int show_all()
perror("opendir");
return 1;
}
- char pathbuf[256];
+ char pathbuf[PATH_MAX];
while (auto* de = readdir(dirp)) {
if (de->d_name[0] == '.')
diff --git a/WindowServer/Makefile b/WindowServer/Makefile
index 5f582e6c27..86798c082c 100644
--- a/WindowServer/Makefile
+++ b/WindowServer/Makefile
@@ -24,17 +24,16 @@ OBJS = $(SHAREDGRAPHICS_OBJS) $(WINDOWSERVER_OBJS)
ARCH_FLAGS =
STANDARD_FLAGS = -std=c++17 -nostdinc++ -nostdlib -nostdinc
-USERLAND_FLAGS = -ffreestanding -fno-stack-protector
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
-FLAVOR_FLAGS = -march=i686 -m32 -fno-exceptions -fno-rtti
+FLAVOR_FLAGS = -fno-exceptions -fno-rtti
OPTIMIZATION_FLAGS = -Os
INCLUDE_FLAGS = -I.. -I. -I../LibC
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
-CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(USERLAND_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
-CXX = clang
-LD = ld
+CXXFLAGS = -MMD -MP $(WARNING_FLAGS) $(OPTIMIZATION_FLAGS) $(FLAVOR_FLAGS) $(ARCH_FLAGS) $(STANDARD_FLAGS) $(INCLUDE_FLAGS) $(DEFINES)
+CXX = i686-elf-g++
+LD = i686-elf-ld
AR = ar
LDFLAGS = -static --strip-debug -melf_i386 -e _start --gc-sections