Skip to content

Commit

Permalink
Fix MacOS Support (makeopensource#45)
Browse files Browse the repository at this point in the history
* apple silicon

* fix objcopy

* Fix

theoretical fix, pls check
  • Loading branch information
Sploder12 authored Oct 6, 2023
1 parent 621f24a commit cd99258
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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
Expand Down

0 comments on commit cd99258

Please sign in to comment.