summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2025-10-21 10:09:02 -0500
committerDanny Holman <dholman@gymli.org>2025-10-21 10:09:02 -0500
commit58c65a77bbdfa9b590524e2328b6f76416e91adb (patch)
tree788d005da32995e4dfdf234e22e358f085874ff9
parentbootstrap: stage1: remove extraneous definition (diff)
downloadbox-58c65a77bbdfa9b590524e2328b6f76416e91adb.tar.gz
box-58c65a77bbdfa9b590524e2328b6f76416e91adb.tar.zst
box-58c65a77bbdfa9b590524e2328b6f76416e91adb.zip
bootstrap: stage2: make the build configs modular
Make the build configuration for the bootloader more modular by breaking out variable updates into multiple makefile includes. These files should (if optional) check against variables in build.conf and update the OBJS list accordingly. Signed-off-by: Danny Holman <dholman@gymli.org>
-rw-r--r--bootstrap/stage2/Makefile12
-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
5 files changed, 70 insertions, 5 deletions
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/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