From 58c65a77bbdfa9b590524e2328b6f76416e91adb Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Tue, 21 Oct 2025 10:09:02 -0500 Subject: 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 --- bootstrap/stage2/Makefile | 12 +++++++----- bootstrap/stage2/arch/x86_64/make.conf | 5 +++++ bootstrap/stage2/core/make.conf | 21 +++++++++++++++++++++ bootstrap/stage2/drivers/make.conf | 19 +++++++++++++++++++ bootstrap/stage2/fs/make.conf | 18 ++++++++++++++++++ 5 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 bootstrap/stage2/core/make.conf create mode 100644 bootstrap/stage2/drivers/make.conf create mode 100644 bootstrap/stage2/fs/make.conf (limited to 'bootstrap') 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 . +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 +# +# 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 . + +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 +# +# 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 . + +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 +# +# 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 . + +include fs/fat/make.conf -- cgit v1.2.3