mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-08 19:30:39 +00:00
Updated intro and Makefiles to use LLVM clang in the right location
This commit is contained in:
parent
96e64218e9
commit
fcef8b6535
8 changed files with 26 additions and 14 deletions
12
README.md
12
README.md
|
@ -54,10 +54,22 @@ Don't proceed until you get Raspbian running!
|
|||
|
||||
The RPi4 runs on an Arm Cortex-A72 processor. Your dev machine is likely running on an Intel processor. You'll therefore need some software that helps you build code to run on a different architecture. This is called a **cross-compiler**.
|
||||
|
||||
Using Arm's compiler for Linux
|
||||
------------------------------
|
||||
|
||||
Download and unpack [Arm's gcc compiler](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads). For reasons that I won't go into here, you'll need to use the "AArch64 ELF bare-metal target". Since I'm using WSL on Windows 10 to emulate Ubuntu, I downloaded the x86_64 Linux hosted cross-compiler.
|
||||
|
||||
I also advocate installing GNU make - you'll need it soon enough. Because I'm using WSL, for me that was simply a matter of typing `sudo apt install make` and entering my password.
|
||||
|
||||
Using clang on Mac OS X (Apple Silicon or Intel)
|
||||
------------------------------------------------
|
||||
|
||||
Download and install XCode from the App Store. This will give you a raft of developer tools for free, including `make`.
|
||||
|
||||
I recommend using [Homebrew](https://docs.brew.sh/Installation) to install LLVM. For me, Homebrew was already installed, so this was a simple case of typing `brew install llvm`.
|
||||
|
||||
LLVM will give you all you need to start building for Raspberry Pi bare metal on Mac. It even works on my M1 MacBook Pro with Apple Silicon, which runs an ARM processor rather than an Intel processsor.
|
||||
|
||||
_Now you're ready to start writing your OS!_
|
||||
|
||||
[Go to part1-bootstrapping >](./part1-bootstrapping/)
|
||||
|
|
|
@ -6,10 +6,10 @@ GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
|||
all: clean kernel8.img
|
||||
|
||||
boot.o: boot.S
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
|
||||
%.o: %.c
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
|
||||
kernel8.img: boot.o $(OFILES)
|
||||
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) -T link.ld -o kernel8.elf
|
||||
|
|
|
@ -6,10 +6,10 @@ GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
|||
all: clean kernel8.img
|
||||
|
||||
boot.o: boot.S
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
|
||||
%.o: %.c
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
|
||||
kernel8.img: boot.o $(OFILES)
|
||||
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) -T link.ld -o kernel8.elf
|
||||
|
|
|
@ -6,10 +6,10 @@ GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
|||
all: clean kernel8.img
|
||||
|
||||
boot.o: boot.S
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
|
||||
%.o: %.c
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
|
||||
kernel8.img: boot.o $(OFILES)
|
||||
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) -T link.ld -o kernel8.elf
|
||||
|
|
|
@ -6,10 +6,10 @@ GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
|||
all: clean kernel8.img
|
||||
|
||||
boot.o: boot.S
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
|
||||
%.o: %.c
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
|
||||
kernel8.img: boot.o $(OFILES)
|
||||
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) -T link.ld -o kernel8.elf
|
||||
|
|
|
@ -6,10 +6,10 @@ GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
|||
all: clean kernel8.img
|
||||
|
||||
boot.o: boot.S
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
|
||||
%.o: %.c
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
|
||||
kernel8.img: boot.o $(OFILES)
|
||||
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) -T link.ld -o kernel8.elf
|
||||
|
|
|
@ -6,13 +6,13 @@ GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
|||
all: clean kernel8.img
|
||||
|
||||
boot.o: boot.S
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
|
||||
BCM4345C0.o : BCM4345C0.hcd
|
||||
$(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@
|
||||
|
||||
%.o: %.c
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
|
||||
kernel8.img: boot.o $(OFILES) BCM4345C0.o
|
||||
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) BCM4345C0.o -T link.ld -o kernel8.elf
|
||||
|
|
|
@ -6,13 +6,13 @@ GCCFLAGS = -Wall -O2 -ffreestanding -nostdinc -nostdlib -mcpu=cortex-a72+nosimd
|
|||
all: clean kernel8.img
|
||||
|
||||
boot.o: boot.S
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c boot.S -o boot.o
|
||||
|
||||
BCM4345C0.o : BCM4345C0.hcd
|
||||
$(LLVMPATH)/llvm-objcopy -I binary -O elf64-littleaarch64 -B aarch64 $< $@
|
||||
|
||||
%.o: %.c
|
||||
clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
$(LLVMPATH)/clang --target=aarch64-elf $(GCCFLAGS) -c $< -o $@
|
||||
|
||||
kernel8.img: boot.o $(OFILES) BCM4345C0.o
|
||||
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib boot.o $(OFILES) BCM4345C0.o -T link.ld -o kernel8.elf
|
||||
|
|
Loading…
Reference in a new issue