2022-01-23 04:36:46 +03:00
|
|
|
ARCH=aarch64
|
|
|
|
|
|
|
|
ARCH_KERNEL_CFLAGS = -z max-page-size=0x1000 -nostdlib -mgeneral-regs-only -mno-outline-atomics -ffixed-x18
|
2022-02-22 11:30:17 +03:00
|
|
|
ARCH_USER_CFLAGS = -Wno-psabi
|
2022-01-23 04:36:46 +03:00
|
|
|
|
|
|
|
TARGET=aarch64-unknown-toaru
|
|
|
|
|
|
|
|
all: system
|
2022-02-16 06:36:03 +03:00
|
|
|
system: misaka-kernel ramdisk.igz bootstub kernel8.img | $(BUILD_KRK)
|
2022-01-23 04:36:46 +03:00
|
|
|
|
|
|
|
misaka-kernel: ${KERNEL_ASMOBJS} ${KERNEL_OBJS} kernel/symbols.o kernel/arch/aarch64/link.ld
|
|
|
|
${CC} -g -T kernel/arch/${ARCH}/link.ld ${KERNEL_CFLAGS} -o $@ ${KERNEL_ASMOBJS} ${KERNEL_OBJS} kernel/symbols.o
|
|
|
|
|
|
|
|
BOOTSTUB_OBJS = $(patsubst %.c,%.o,$(wildcard kernel/arch/aarch64/bootstub/*.c))
|
|
|
|
BOOTSTUB_OBJS += $(patsubst %.S,%.o,$(wildcard kernel/arch/aarch64/bootstub/*.S))
|
|
|
|
BOOTSTUB_OBJS += kernel/misc/kprintf.o kernel/misc/string.o
|
|
|
|
|
|
|
|
bootstub: ${BOOTSTUB_OBJS} kernel/arch/aarch64/bootstub/link.ld
|
2022-02-16 06:36:03 +03:00
|
|
|
${CC} -g -T kernel/arch/aarch64/bootstub/link.ld ${KERNEL_CFLAGS} -o $@ ${BOOTSTUB_OBJS}
|
|
|
|
|
|
|
|
|
|
|
|
RPI400_OBJS = $(patsubst %.c,%.o,$(wildcard kernel/arch/aarch64/rpi400/*.c))
|
|
|
|
RPI400_OBJS += $(patsubst %.S,%.o,$(wildcard kernel/arch/aarch64/rpi400/*.S))
|
|
|
|
RPI400_OBJS += kernel/misc/kprintf.o kernel/misc/string.o
|
|
|
|
|
|
|
|
kernel/arch/aarch64/rpi400/start.o: misaka-kernel ramdisk.igz
|
|
|
|
kernel8.img: ${RPI400_OBJS} kernel/arch/aarch64/rpi400/link.ld
|
|
|
|
${CC} -g -T kernel/arch/aarch64/rpi400/link.ld ${KERNEL_CFLAGS} -o $@.elf ${RPI400_OBJS}
|
|
|
|
${OC} $@.elf -O binary $@
|
2022-01-23 04:36:46 +03:00
|
|
|
|
2022-02-06 15:23:16 +03:00
|
|
|
QEMU = qemu-system-aarch64
|
2022-01-23 04:36:46 +03:00
|
|
|
|
|
|
|
EMU_MACH = virt-2.12
|
|
|
|
EMU_CPU = cortex-a72
|
2022-02-02 18:08:47 +03:00
|
|
|
SMP ?= 4
|
2022-01-23 04:36:46 +03:00
|
|
|
RAM ?= 4G
|
|
|
|
|
|
|
|
EMU_ARGS = -M $(EMU_MACH)
|
|
|
|
EMU_ARGS += -m $(RAM)
|
|
|
|
EMU_ARGS += -smp $(SMP)
|
|
|
|
EMU_ARGS += -cpu $(EMU_CPU)
|
|
|
|
EMU_RAGS += -no-reboot
|
|
|
|
EMU_ARGS += -serial mon:stdio
|
|
|
|
EMU_ARGS += -device bochs-display
|
2022-02-01 11:06:07 +03:00
|
|
|
EMU_ARGS += -device virtio-tablet-pci # Mouse with absolute positioning
|
|
|
|
EMU_ARGS += -device virtio-keyboard-pci # Keyboard
|
2022-02-14 03:33:56 +03:00
|
|
|
EMU_ARGS += -device AC97
|
2022-01-23 04:36:46 +03:00
|
|
|
EMU_ARGS += -d guest_errors
|
2022-02-14 03:33:56 +03:00
|
|
|
EMU_ARGS += -net user
|
|
|
|
EMU_ARGS += -netdev hubport,id=u1,hubid=0, -device e1000e,netdev=u1
|
2022-01-23 04:36:46 +03:00
|
|
|
|
|
|
|
EMU_RAMDISK = -fw_cfg name=opt/org.toaruos.initrd,file=ramdisk.igz
|
|
|
|
EMU_KERNEL = -fw_cfg name=opt/org.toaruos.kernel,file=misaka-kernel
|
|
|
|
|
|
|
|
run: system
|
|
|
|
${QEMU} ${EMU_ARGS} -kernel bootstub -append "root=/dev/ram0 migrate start=live-session vid=auto" ${EMU_RAMDISK} ${EMU_KERNEL}
|
|
|
|
|
2022-02-06 15:23:16 +03:00
|
|
|
hvf: EMU_MACH = virt-2.12,highmem=off
|
|
|
|
hvf: EMU_CPU = host -accel hvf
|
|
|
|
hvf: system
|
|
|
|
${QEMU} ${EMU_ARGS} -kernel bootstub -append "root=/dev/ram0 migrate start=live-session vid=auto" ${EMU_RAMDISK} ${EMU_KERNEL}
|
|
|
|
|
2022-01-23 04:36:46 +03:00
|
|
|
debug: system
|
|
|
|
${QEMU} ${EMU_ARGS} -kernel bootstub -append "root=/dev/ram0 migrate start=live-session vid=auto" ${EMU_RAMDISK} ${EMU_KERNEL} -d int 2>&1
|
|
|
|
|
2022-02-06 08:51:02 +03:00
|
|
|
BUILD_KRK=$(TOOLCHAIN)/local/bin/kuroko
|
|
|
|
$(TOOLCHAIN)/local/bin/kuroko: kuroko/src/*.c
|
|
|
|
mkdir -p $(TOOLCHAIN)/local/bin
|
|
|
|
cc -Ikuroko/src -DNO_RLINE -DSTATIC_ONLY -DKRK_DISABLE_THREADS -o "${TOOLCHAIN}/local/bin/kuroko" kuroko/src/*.c
|
|
|
|
|