diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cf0c471 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ +iso/boot/kernel.bin \ No newline at end of file diff --git a/Makefile b/Makefile index 6d26038..9838444 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,19 @@ +# Compiler configuration ASM = nasm -f elf32 GCC = gcc -m32 -ffreestanding -fno-stack-protector -fno-pie -Wall -Wextra -nostdlib -Iinclude -c LD = ld -m elf_i386 -T linker.ld -o iso/boot/kernel.bin +# Kernel configuration +KERNEL_NAME = x32_KERNEL + +# Main Logic +# DISCLAIMER: +# Do not touch this unless you REALLY know what you are doing +# Only touch this when fixing a bug or adding a feature/folder/file(we should get dynamic file handling) + +# Also someone PLEASE add dynamic file handling... - HashedVsy 19:56 17.02.2026 +# American format: +# HashedVsy 7:56PM 02.17.2026 all: $(ASM) src/asm/multiboot.asm -o build/multiboot.o $(ASM) src/asm/boot.asm -o build/boot.o @@ -16,4 +28,4 @@ all: build/panic.o \ build/kernel.o - grub-mkrescue -o os.iso iso \ No newline at end of file + grub-mkrescue -o $(KERNEL_NAME).iso iso \ No newline at end of file diff --git a/README.md b/README.md index 3be6e45..5a80965 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,11 @@ I strongly recommend reading the Multiboot2 spec to understand what you are doin ###### https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html +Also, read the OSDev wiki for a better learning experience. +###### https://wiki.osdev.org/ + + +### FILES multiboot.asm > - Multiboot2 compliant header, 8 byte aligned, contains: > - Magic Number @@ -36,11 +41,27 @@ linker.ld Makefile > - Convenience script. I strongly recommend you use Makefile / CMake during your development process of this OS or any of your projects -Required tools: -> - make -> - gcc -> - ld (comes with gcc) -> - nasm -> - grub +### Setup Docker +1. Install Docker +2. Run the following command if you havent built the image(besure Docker engine is on or else itll error!) +`` +docker build dockerenv -t kernel-buildenv +`` +3. Enter build environment: + +- Linux or MacOS: `docker run --rm -it -v "$(pwd)":/root/env kernel-buildenv` +- Windows (CMD): `docker run --rm -it -v "%cd%":/root/env kernel-buildenv` +- Windows (PowerShell): `docker run --rm -it -v "${pwd}:/root/env" kernel-buildenv` +- Please use the linux command if you are using WSL, msys2 or git bash +-> NOTE: If you are having trouble with an unshared drive, ensure your docker daemon -> has access to the drive you're development environment is in. For Docker Desktop, -> this is in "Settings > Shared Drives" or "Settings > Resources > File Sharing". + + +### Required tools +> - make - use Makefile to automatically run compile commands (not needed, but HEAVILY recommended for organizing.) +> - gcc - compile .c files +> - ld (comes with gcc) - link files to make them work +> - nasm - Make .asm files into .o +> - grub - Make ISO +> - docker(not needed, but HEAVILY recommended for organizing.) I recommend you have an emulator like qemu and run this with qemu-system-i386 diff --git a/build/initalltags.o b/build/initalltags.o index f1349fd..7854769 100644 Binary files a/build/initalltags.o and b/build/initalltags.o differ diff --git a/build/kernel.o b/build/kernel.o index 4a43fcc..13dbe27 100644 Binary files a/build/kernel.o and b/build/kernel.o differ diff --git a/build/panic.o b/build/panic.o index 7a3c655..d33e099 100644 Binary files a/build/panic.o and b/build/panic.o differ diff --git a/dockerenv/Dockerfile b/dockerenv/Dockerfile new file mode 100644 index 0000000..4b5eccf --- /dev/null +++ b/dockerenv/Dockerfile @@ -0,0 +1,10 @@ +FROM debian:12 + +# Setup enviroment +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y gcc make nasm xorriso grub-pc-bin grub-common && \ + rm -rf /var/lib/apt/lists/* + +VOLUME /root/env +WORKDIR /root/env diff --git a/iso/boot/kernel.bin b/iso/boot/kernel.bin index 4b31c2b..9258429 100644 Binary files a/iso/boot/kernel.bin and b/iso/boot/kernel.bin differ diff --git a/x32_KERNEL.iso b/x32_KERNEL.iso new file mode 100644 index 0000000..c0d5ddc Binary files /dev/null and b/x32_KERNEL.iso differ