This commit is contained in:
aramya 2023-07-01 10:43:35 +01:00
parent 74790b7525
commit 75d8667cb3

View File

@ -1,37 +1,46 @@
MACHINE=mac99
PPC=powerpc-eabi
QEMU=qemu-system-ppc
RES=1600x900x32
MACHINE = mac99
PPC = powerpc-eabi
QEMU = qemu-system-ppc
RES = 1600x900x32
SOURCES_C = $(wildcard entry/*.c)
SOURCES_S = $(wildcard entry/*.s)
OBJECTS = $(SOURCES_C:.c=.elf) $(SOURCES_S:.s=.elf)
.PHONY: all clean run debug beige
DISK.APM: kernel.elf bootinfo.txt scripts/kpartx.sh
dd bs=512K count=2 if=/dev/zero of=DISK.APM
parted DISK.APM --script mklabel mac mkpart primary hfs+ 32.8KB 100%
sudo chmod +x scripts/kpartx.sh
sudo ./scripts/kpartx.sh
sudo mkdir /mnt/ppc
sudo mkdir /mnt/boot
sudo mkdir -p /mnt/ppc /mnt/boot
sudo cp bootinfo.txt /mnt/ppc
sudo cp kernel.elf /mnt/boot
sudo umount /mnt/
sudo kpartx -d DISK.APM
bootinfo.txt: loader/load.fth loader/def.fth
echo "<chrp-boot><boot-script>" >> bootinfo.txt
cat loader/def.fth >> bootinfo.txt
cat loader/load.fth >> bootinfo.txt
echo "</boot-script></chrp-boot>" >> bootinfo.txt
kernel.elf: start.elf boot.elf
$(PPC)-ld -Ttext=0x200000 -Tdata=0x300000 start.elf boot.elf -o kernel.elf
boot.elf: entry/boot.c entry/boot.h
$(PPC)-gcc -c entry/boot.c -o boot.elf
start.elf: entry/start.s
$(PPC)-as -c entry/start.s -o start.elf
kernel.elf: $(OBJECTS)
$(PPC)-ld -Ttext=0x200000 -Tdata=0x300000 $^ -o $@
%.elf: %.c
$(PPC)-gcc -c $< -o $@
%.elf: %.s
$(PPC)-as -c $< -o $@
clean:
rm *.APM *elf *txt
rm -f *.APM *elf *txt
run:
$(QEMU) -hda *.APM -g $(RES) -machine $(MACHINE)
beige:
$(QEMU) -hda *.APM -g $(RES) -machine g3beige
$(QEMU) -hda *.APM -g $(RES) -machine $(MACHINE)
debug:
$(QEMU) -hda *.APM -d in_asm -g $(RES) -machine $(MACHINE)
all:
make clean && make && make run