From cd99258d9697dcdff382b68b742fa9808273513d Mon Sep 17 00:00:00 2001 From: Sploder12 Date: Fri, 6 Oct 2023 16:12:56 -0400 Subject: [PATCH] Fix MacOS Support (#45) * apple silicon * fix objcopy * Fix theoretical fix, pls check --- Makefile | 10 ++++++---- README.md | 8 ++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b009e32..8fd6871 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ PLATFORM := $(shell uname) DEBUG ?= false # lowers optimization levels and increases command verbosity ifeq ($(PLATFORM), Darwin) -CC := i386-elf-gcc -LD := i386-elf-ld -OBJCOPY := gobjcopy +CC := x86_64-elf-gcc +LD := x86_64-elf-ld +OBJCOPY := x86_64-elf-objcopy else CC := gcc LD := ld @@ -30,7 +30,9 @@ export DEBUG_CFLAGS export DEBUG_NASM_FLAGS export DEBUG_QEMU_FLAGS -export CFLAGS := -Wall -Werror $(DEBUG_CFLAGS) -Wl,--oformat=binary -no-pie -m32 -s -falign-functions=4 -ffreestanding -fno-asynchronous-unwind-tables +export CFLAGS := -Wall -Werror $(DEBUG_CFLAGS) -Wl,--oformat=binary -no-pie -m32 -mno-mmx -mno-sse -mno-sse2 -mno-sse3 \ + -s -falign-functions=4 -ffreestanding -fno-asynchronous-unwind-tables + export LFLAGS := -melf_i386 --build-id=none ASM_BOOT_SECT_SOURCE := ./src/boot/boot_sect.asm diff --git a/README.md b/README.md index 93ee578..086a800 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,7 @@ For contributing _fork_ this repository and then make your changes in the form o Use homebrew to install the dependencies using these commands: ```shell -brew link --overwrite i386-elf-binutils -brew install i386-elf-binutils i386-elf-gcc nasm binutils qemu +brew install x86_64-elf-binutils x86_64-elf-gcc nasm binutils qemu ``` If you are on Apple Silicon, you will need to use Rosetta along with installing x86_64 libraries. This can be done by prefixing the previous commands with `arch -x86_64`. @@ -56,6 +55,11 @@ You will need to ensure that these programs are on your PATH or `make` will not * run `make qemu` in the root directory of the project +### Debugging + +* run `make qemu-gdb` in the root directory of the project +* run `make qemu-gdb-boot` in the root directory for debugging the bootloader + ### Running in DEBUG mode * run `make qemu DEBUG=true` in the root directory of the project