changed to x86

This commit is contained in:
rami 2024-06-25 21:43:07 -04:00
parent 01c693cd17
commit 34687780df
4 changed files with 10 additions and 14 deletions

View File

@ -1,8 +1,8 @@
CC = x86_64-elf-gcc
CC = i686-elf-gcc
AS = nasm
BUILDDIR := build
CFLAGS := -ffreestanding -Wall -Wextra -Werror -mno-red-zone
CFLAGS := -ffreestanding -Wall -Wextra -Werror
LDFLAGS := -ffreestanding -nostdlib -lgcc -T kernel/kernel.ld
KSRC := $(wildcard kernel/*.asm kernel/*.c)
@ -14,7 +14,7 @@ KIMG := kernel.bin
$(BUILDDIR)/$(KIMG): $(KOBJ)
$(CC) $^ -o $@ $(LDFLAGS)
$(BUILDDIR)/%.o: */%.asm
$(AS) -felf64 $^ -o $@
$(AS) -felf32 $^ -o $@
$(BUILDDIR)/%.o: */%.c
$(CC) $(CFLAGS) -c $^ -o $@
@ -26,7 +26,7 @@ $(BUILDDIR)/Hazel.iso: kernel
iso: $(BUILDDIR)/Hazel.iso
qemu: iso
qemu-system-x86_64 -cdrom $(BUILDDIR)/Hazel.iso
qemu-system-i386 -cdrom $(BUILDDIR)/Hazel.iso
clean:
rm build/* boot/*.bin

View File

@ -1,5 +1,5 @@
default=0
timeout=0
menuentry "Hazel" {
multiboot2 /boot/kernel.bin
multiboot /boot/kernel.bin
}

View File

@ -1,14 +1,10 @@
%define MAGIC 0xE85250D6
%define ARCH 0x0
%define LEN (multiboot_end - multiboot_start)
%define MAGIC 0x1BADB002
%define FLAGS 0x0
section .multiboot
multiboot_start:
dd MAGIC
dd ARCH
dd LEN
dd -(MAGIC + ARCH + LEN)
multiboot_end:
dd FLAGS
dd -(MAGIC + FLAGS)
section .text
global _start

View File

@ -17,7 +17,7 @@ SECTIONS
memory which is verified to be available by the firmware, in order to
work around this issue. This does not use that feature, so 2M was
chosen as a safer option than the traditional 1M. */
. = 2M;
. = 1M;
/* First put the multiboot header, as it is required to be put very early
in the image or the bootloader won't recognize the file format.