Update Limine as submodule and refactor build system
Migrated Limine bootloader to a git submodule, ensuring consistent and easy updates alongside source versioning. Removed explicit bootloader files from version control in favor of submodule structure. Cleaned up makefile targets to integrate submodule initialization and limine build process, stepping towards better build reproducibility. In the build system, 'submodules' target is added to ensure submodules are properly initialized, which is now a prerequisite for 'bin/$(KERNEL)' target, as well as for ISO and HDD image creation. Additionally, streamlined the gitignore file to retain the iso_root directory while excluding generated image files and the previously tracked 'limine' directory. Minor whitespace cleanup in GNUmakefile enhances readability and maintains consistency. Included fonts module directly in source files to support future graphics handling and replaced a placeholder hang function with a framebuffer write operation in the kernel startup code, setting the foundation for further development of graphics rendering.
This commit is contained in:
parent
8b16798b54
commit
877dcc247d
6 changed files with 36 additions and 36 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,6 +1,3 @@
|
||||||
obj/
|
obj/
|
||||||
bin/
|
bin/
|
||||||
iso_root/
|
iso_root/
|
||||||
image.iso
|
|
||||||
image.hdd
|
|
||||||
limine/
|
|
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[submodule "vendor/limine"]
|
||||||
|
path = vendor/limine
|
||||||
|
url = https://github.com/limine-bootloader/limine.git
|
||||||
|
branch = v6.x-branch-binary
|
48
GNUmakefile
48
GNUmakefile
|
@ -95,7 +95,7 @@ override HEADER_DEPS := $(addprefix obj/,$(CFILES:.c=.c.d) $(ASFILES:.S=.S.d))
|
||||||
all: bin/$(KERNEL) iso hdd
|
all: bin/$(KERNEL) iso hdd
|
||||||
|
|
||||||
# Link rules for the final kernel executable.
|
# Link rules for the final kernel executable.
|
||||||
bin/$(KERNEL): GNUmakefile linker.ld $(OBJ)
|
bin/$(KERNEL): submodules GNUmakefile linker.ld $(OBJ)
|
||||||
mkdir -p "$$(dirname $@)"
|
mkdir -p "$$(dirname $@)"
|
||||||
$(LD) $(OBJ) $(LDFLAGS) -o $@
|
$(LD) $(OBJ) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
@ -120,25 +120,29 @@ obj/%.asm.o: src/%.asm GNUmakefile
|
||||||
# Remove object files and the final executable.
|
# Remove object files and the final executable.
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf bin obj iso_root image.iso image.hdd limine
|
rm -rf bin obj iso_root vendor/*
|
||||||
|
|
||||||
|
# Initialize and update git submodules.
|
||||||
|
.PHONY: submodules
|
||||||
|
submodules:
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
# The `limine` target builds the Limine bootloader.
|
||||||
|
.PHONY: limine
|
||||||
|
limine: submodules
|
||||||
|
$(MAKE) -C vendor/limine
|
||||||
|
|
||||||
# The `iso` target builds the bootable ISO image using Limine.
|
# The `iso` target builds the bootable ISO image using Limine.
|
||||||
.PHONY: iso
|
.PHONY: iso
|
||||||
iso: bin/$(KERNEL)
|
iso: bin/$(KERNEL) limine
|
||||||
# Clone the Limine repository
|
|
||||||
git clone https://github.com/limine-bootloader/limine.git --branch=v6.x-branch-binary --depth=1
|
|
||||||
|
|
||||||
# Build the Limine bootloader binaries.
|
|
||||||
$(MAKE) -C limine
|
|
||||||
|
|
||||||
# Create the iso_root directory and copy relevant files.
|
# Create the iso_root directory and copy relevant files.
|
||||||
mkdir -p iso_root
|
mkdir -p iso_root
|
||||||
cp -v bin/$(KERNEL) limine.cfg limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/
|
cp -v bin/$(KERNEL) limine.cfg vendor/limine/limine-bios.sys vendor/limine/limine-bios-cd.bin vendor/limine/limine-uefi-cd.bin iso_root/
|
||||||
|
|
||||||
# Create the EFI boot directory and copy EFI executables.
|
# Create the EFI boot directory and copy EFI executables.
|
||||||
mkdir -p iso_root/EFI/BOOT
|
mkdir -p iso_root/EFI/BOOT
|
||||||
cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/
|
cp -v vendor/limine/BOOTX64.EFI iso_root/EFI/BOOT/
|
||||||
cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT/
|
cp -v vendor/limine/BOOTIA32.EFI iso_root/EFI/BOOT/
|
||||||
|
|
||||||
# Create the bootable ISO.
|
# Create the bootable ISO.
|
||||||
xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot \
|
xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot \
|
||||||
|
@ -147,7 +151,7 @@ iso: bin/$(KERNEL)
|
||||||
iso_root -o image.iso
|
iso_root -o image.iso
|
||||||
|
|
||||||
# Install Limine stage 1 and 2 for legacy BIOS boot.
|
# Install Limine stage 1 and 2 for legacy BIOS boot.
|
||||||
./limine/limine bios-install image.iso
|
./vendor/limine/limine bios-install image.iso
|
||||||
|
|
||||||
mv image.iso bin/$(KERNEL).iso
|
mv image.iso bin/$(KERNEL).iso
|
||||||
|
|
||||||
|
@ -155,23 +159,15 @@ iso: bin/$(KERNEL)
|
||||||
|
|
||||||
# The `hdd` target builds the bootable HDD image using Limine.
|
# The `hdd` target builds the bootable HDD image using Limine.
|
||||||
.PHONY: hdd
|
.PHONY: hdd
|
||||||
hdd: bin/$(KERNEL)
|
hdd: bin/$(KERNEL) limine
|
||||||
# Create empty HDD image file.
|
# Create empty HDD image file.
|
||||||
dd if=/dev/zero bs=1M count=0 seek=64 of=image.hdd
|
dd if=/dev/zero bs=1M count=0 seek=64 of=image.hdd
|
||||||
|
|
||||||
# Create GPT partition.
|
# Create GPT partition.
|
||||||
sgdisk image.hdd -n 1:2048 -t 1:ef00
|
sgdisk image.hdd -n 1:2048 -t 1:ef00
|
||||||
|
|
||||||
# Clone Limine if it doesn't already exist.
|
|
||||||
if [ ! -d "limine" ]; then \
|
|
||||||
git clone https://github.com/limine-bootloader/limine.git --branch=v6.x-branch-binary --depth=1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Build the Limine bootloader binaries, if not already built.
|
|
||||||
$(MAKE) -C limine
|
|
||||||
|
|
||||||
# Install Limine BIOS stages.
|
# Install Limine BIOS stages.
|
||||||
./limine/limine bios-install image.hdd
|
./vendor/limine/limine bios-install image.hdd
|
||||||
|
|
||||||
# Format the partition to fat32 filesystem.
|
# Format the partition to fat32 filesystem.
|
||||||
mformat -i image.hdd@@1M -F ::
|
mformat -i image.hdd@@1M -F ::
|
||||||
|
@ -180,9 +176,9 @@ hdd: bin/$(KERNEL)
|
||||||
mmd -i image.hdd@@1M ::/EFI ::/EFI/BOOT
|
mmd -i image.hdd@@1M ::/EFI ::/EFI/BOOT
|
||||||
|
|
||||||
# Copy kernel and Limine config over to the HDD image.
|
# Copy kernel and Limine config over to the HDD image.
|
||||||
mcopy -i image.hdd@@1M bin/$(KERNEL) limine.cfg limine/limine-bios.sys ::/
|
mcopy -i image.hdd@@1M bin/$(KERNEL) limine.cfg vendor/limine/limine-bios.sys ::/
|
||||||
mcopy -i image.hdd@@1M limine/BOOTX64.EFI ::/EFI/BOOT
|
mcopy -i image.hdd@@1M vendor/limine/BOOTX64.EFI ::/EFI/BOOT
|
||||||
mcopy -i image.hdd@@1M limine/BOOTIA32.EFI ::/EFI/BOOT
|
mcopy -i image.hdd@@1M vendor/limine/BOOTIA32.EFI ::/EFI/BOOT
|
||||||
|
|
||||||
mv image.hdd bin/$(KERNEL).hdd
|
mv image.hdd bin/$(KERNEL).hdd
|
||||||
|
|
||||||
|
|
0
src/console/fonts.c
Normal file
0
src/console/fonts.c
Normal file
|
@ -3,6 +3,8 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <limine.h>
|
#include <limine.h>
|
||||||
|
|
||||||
|
#include <console/fonts.c>
|
||||||
|
|
||||||
// Set the base revision to 1, this is recommended as this is the latest
|
// Set the base revision to 1, this is recommended as this is the latest
|
||||||
// base revision described by the Limine boot protocol specification.
|
// base revision described by the Limine boot protocol specification.
|
||||||
// See specification for further info.
|
// See specification for further info.
|
||||||
|
@ -107,6 +109,6 @@ void _start(void) {
|
||||||
fb_ptr[i * (framebuffer->pitch / 4) + i] = 0xffffff;
|
fb_ptr[i * (framebuffer->pitch / 4) + i] = 0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're done, just hang...
|
// Write to framebuffer
|
||||||
hcf();
|
|
||||||
}
|
}
|
1
vendor/limine
vendored
Submodule
1
vendor/limine
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 1fbee19c25393a7948039b8ee99cb98daa6684dc
|
Loading…
Reference in a new issue