utokyo_syspro_baremetal icon indicating copy to clipboard operation
utokyo_syspro_baremetal copied to clipboard

macOS support

Open ytakano opened this issue 1 year ago • 0 comments

On macOS, it can be compiled to modify kernel/Makefile as follows.

CFLAGS = -Wall -Wextra -nostdlib --target=x86_64-w64-mingw32-elf
LDFLAGS = -s -x
LD = lld -flavor ld.lld

all: kernel apps/app1 apps/app2 apps/app3
        make -C ../
        make copy

kernel: kernel.o segmentation.o hardware.o load_gdt.o font.o
        $(LD) $(LDFLAGS) -e start -T kernel.ld -o $@ $+

apps/app1: apps/app1.o
        $(LD) $(LDFLAGS) -T apps/app1.ld -o $@ $+

apps/app2: apps/app2.o
        $(LD) $(LDFLAGS) -T apps/app2.ld -o $@ $+

apps/app3: apps/app3.o
        $(LD) $(LDFLAGS) -T apps/app3.ld -o $@ $+

-e start is required for lld.

However, it fails to boot on macOS.

Required libraries:

$ brew install wget mingw-w64 qemu

To use lld, the following line has been removed from the linker scripts.

OUTPUT_FORMAT("binary");

ytakano avatar Apr 24 '23 07:04 ytakano