Added some framework to create a bootable ISO with grub as the

bootloader. Eventually the bootloader will be a submodule of this dir -
but for now GRUB works for boot.
This commit is contained in:
lordtet 2025-05-26 17:42:00 -04:00
parent 1de036ad09
commit 0831fb86e4
3 changed files with 23 additions and 4 deletions

View file

@ -3,6 +3,7 @@
#Some definitions #Some definitions
SRC_DIR = src SRC_DIR = src
BUILD_DIR = build BUILD_DIR = build
LOADER_DIR = module_bootloader
KERNEL_MAIN = $(SRC_DIR)/main.c KERNEL_MAIN = $(SRC_DIR)/main.c
KERNEL_MAIN_OBJ = $(BUILD_DIR)/main.o KERNEL_MAIN_OBJ = $(BUILD_DIR)/main.o
@ -12,12 +13,11 @@ ENTRY_ASM_OBJ = $(BUILD_DIR)/start.o
LINKING_RECIPE = $(SRC_DIR)/linker.ld LINKING_RECIPE = $(SRC_DIR)/linker.ld
KERNEL_IMG = $(BUILD_DIR)/mykernel.elf KERNEL_IMG = $(BUILD_DIR)/ukern.elf
QEMU = qemu-system-i386 QEMU = qemu-system-i386
GCC = i686-elf-gcc GCC = i686-elf-gcc
#Actual recipe #Actual recipe
all: $(KERNEL_IMG) all: $(KERNEL_IMG)
@ -37,6 +37,13 @@ $(KERNEL_IMG): $(KERNEL_MAIN_OBJ) $(ENTRY_ASM_OBJ)
run: all run: all
$(QEMU) -kernel $(KERNEL_IMG) $(QEMU) -kernel $(KERNEL_IMG)
clean: iso: all
rm -rf $(BUILD_DIR)/* mv $(KERNEL_IMG) $(LOADER_DIR)/src/boot/; \
cd $(LOADER_DIR); \
make all; \
cd ..; \
mv $(LOADER_DIR)/build/uOS.iso $(BUILD_DIR)/
clean:
rm -rf $(BUILD_DIR)/*

View file

@ -0,0 +1,9 @@
# Makefile
#Some definitions
SRC_DIR = src
BUILD_DIR = build
all:
grub-mkrescue -o $(BUILD_DIR)/uOS.iso $(SRC_DIR)

View file

@ -0,0 +1,3 @@
menuentry "Untitled_Kernel" {
multiboot /boot/ukern.elf
}