summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--bootstrap/stage1/firmware/efi/tty.c5
-rw-r--r--bootstrap/stage2/Makefile12
-rw-r--r--bootstrap/stage2/arch/x86_64/linker.ld10
-rw-r--r--bootstrap/stage2/arch/x86_64/make.conf5
-rw-r--r--bootstrap/stage2/core/make.conf21
-rw-r--r--bootstrap/stage2/drivers/make.conf19
-rw-r--r--bootstrap/stage2/fs/make.conf18
8 files changed, 82 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 4085e24..1b4dadf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,10 @@
*.xz
*.zst
+# Testing and debugging files
+esp/
+.gdbinit
+
# Built exec's
bin/cat/cat
bin/chmod/chmod
diff --git a/bootstrap/stage1/firmware/efi/tty.c b/bootstrap/stage1/firmware/efi/tty.c
index 9131d95..fdbf38a 100644
--- a/bootstrap/stage1/firmware/efi/tty.c
+++ b/bootstrap/stage1/firmware/efi/tty.c
@@ -18,10 +18,7 @@
*/
#include <bootabi/efi.h>
-
-#ifndef NULL
-#define NULL (void*)(0)
-#endif
+#include <stddef.h>
extern uint64_t errno;
extern efi_loaded_image_protocol_t *lip;
diff --git a/bootstrap/stage2/Makefile b/bootstrap/stage2/Makefile
index 1799157..fcc64c0 100644
--- a/bootstrap/stage2/Makefile
+++ b/bootstrap/stage2/Makefile
@@ -28,12 +28,14 @@ CFLAGS+=-ffreestanding -fno-stack-protector $(BS_OPLVL)
BINARY=bootstrap-stage2
include $(ARCHDIR)/make.conf
-FIRMWARE_DIR=firmware/$(FIRMWARE)
-include $(FIRMWARE_DIR)/make.conf
-COMMON_DIR=firmware/common
+
+include core/make.conf
+include drivers/make.conf
+include fs/make.conf
OBJS=$(ARCH_OBJS) \
- $(COMMON_OBJS) \
- $(FIRMWARE_OBJS) \
+ $(CORE_OBJS) \
+ $(DRIVER_OBJS) \
+ $(FS_OBJS) \
include $(ROOTDIR)/patterns.mk
diff --git a/bootstrap/stage2/arch/x86_64/linker.ld b/bootstrap/stage2/arch/x86_64/linker.ld
index f5489e5..14fe730 100644
--- a/bootstrap/stage2/arch/x86_64/linker.ld
+++ b/bootstrap/stage2/arch/x86_64/linker.ld
@@ -4,15 +4,19 @@ SECTIONS {
. = 0x100000;
__bstart = .;
- .text : {
+ .text : ALIGN(4K) {
*(.text)
}
- .data : {
+ .rodata : ALIGN(4K) {
+ *(.rodata)
+ }
+
+ .data : ALIGN(4K) {
*(.data)
}
- .bss : {
+ .bss : ALIGN(4K) {
*(.bss)
*(COMMON)
}
diff --git a/bootstrap/stage2/arch/x86_64/make.conf b/bootstrap/stage2/arch/x86_64/make.conf
index 4e4ab6f..6c5be48 100644
--- a/bootstrap/stage2/arch/x86_64/make.conf
+++ b/bootstrap/stage2/arch/x86_64/make.conf
@@ -15,8 +15,13 @@
# You should have received a copy of the GNU General Public License along with
# BoxOS; if not, see <https://www.gnu.org/licenses/>.
+INCLUDE+=-I$(ARCHDIR)/include
AFLAGS+=-target $(ARCH)-none-elf
CFLAGS+=-target $(ARCH)-none-elf -mno-red-zone -mno-mmx -mno-sse -mno-sse2
LDFLAGS+=--script=$(ARCHDIR)/linker.ld
ARCH_OBJS=$(ARCHDIR)/asm/entry.o \
+ $(ARCHDIR)/asm/gdt.o \
+ $(ARCHDIR)/asm/paging.o \
+ $(ARCHDIR)/gdt.o \
+ $(ARCHDIR)/paging.o \
diff --git a/bootstrap/stage2/core/make.conf b/bootstrap/stage2/core/make.conf
new file mode 100644
index 0000000..75bf7c1
--- /dev/null
+++ b/bootstrap/stage2/core/make.conf
@@ -0,0 +1,21 @@
+# Copyright (C) 2025 Danny Holman <dholman@gymli.org>
+#
+# This file is part of BoxOS, a free and open-source Unix-like operating
+# system.
+#
+# BoxOS is free software; you can redistribute it and/or modify under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# BoxOS is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY;
+# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# BoxOS; if not, see <https://www.gnu.org/licenses/>.
+
+CORE_OBJS+=core/balloc.o \
+ core/bprintf.o \
+ core/init.o \
+ core/string.o \
diff --git a/bootstrap/stage2/drivers/make.conf b/bootstrap/stage2/drivers/make.conf
new file mode 100644
index 0000000..066ed57
--- /dev/null
+++ b/bootstrap/stage2/drivers/make.conf
@@ -0,0 +1,19 @@
+# Copyright (C) 2025 Danny Holman <dholman@gymli.org>
+#
+# This file is part of BoxOS, a free and open-source Unix-like operating
+# system.
+#
+# BoxOS is free software; you can redistribute it and/or modify under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# BoxOS is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY;
+# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# BoxOS; if not, see <https://www.gnu.org/licenses/>.
+
+include drivers/firmware/efi/make.conf
+include drivers/sata/make.conf
diff --git a/bootstrap/stage2/fs/make.conf b/bootstrap/stage2/fs/make.conf
new file mode 100644
index 0000000..f01a739
--- /dev/null
+++ b/bootstrap/stage2/fs/make.conf
@@ -0,0 +1,18 @@
+# Copyright (C) 2025 Danny Holman <dholman@gymli.org>
+#
+# This file is part of BoxOS, a free and open-source Unix-like operating
+# system.
+#
+# BoxOS is free software; you can redistribute it and/or modify under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# BoxOS is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY;
+# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# BoxOS; if not, see <https://www.gnu.org/licenses/>.
+
+include fs/fat/make.conf