diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-23 19:13:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-23 19:15:17 +0100 |
| commit | a13e1c0911c0627184bc38f18c7fdda64447b3ad (patch) | |
| tree | 073a62c09bf216e85a3f310376640fa1805147f9 /dev/boot/arm64-mobile.make | |
| parent | 149fa096eb306d03686b3b67e813cf1a78e08cd0 (diff) | |
meta(kernel): Reworked repository's filesystem structure.
Removing useless parts of the project too.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/boot/arm64-mobile.make')
| -rw-r--r-- | dev/boot/arm64-mobile.make | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/dev/boot/arm64-mobile.make b/dev/boot/arm64-mobile.make new file mode 100644 index 00000000..485bfed0 --- /dev/null +++ b/dev/boot/arm64-mobile.make @@ -0,0 +1,113 @@ +################################################## +# (c) Amlal EL Mahrouss, all rights reserved. +# This is the bootloader makefile. +################################################## + +CC_GNU = clang++ +LD_GNU = lld-link + +ADD_FILE=touch +COPY=cp +HTTP_GET=wget + +# Select this for Windows. +ifneq ($(findstring CYGWIN_NT-10.0,$(shell uname)), ) +EMU=qemu-system-aarch64w.exe +else +# this for NT distributions +EMU=qemu-system-aarch64 +endif + +ifeq ($(NEOS_MODEL), ) +NE_MODEL=-DkMachineModel="\"NeKernel\"" +endif + +BIOS=OVMF.fd +IMG=epm-master-1.img +IMG_2=epm-slave.img +IMG_3=epm-master-2.img + +EMU_FLAGS=-net none -smp 4 -m 8G -cpu max -M virt-9.1 \ + -bios $(BIOS) \ + -drive id=disk,file=$(IMG),format=raw,if=none \ + -drive \ + file=fat:rw:src/Root/,index=1,format=raw \ + -device virtio-tablet-pci \ + -no-shutdown -no-reboot -cpu cortex-a72 -device virtio-gpu-pci + +LD_FLAGS=-subsystem:efi_application -entry:Main /nodefaultlib + +STANDALONE_MACRO=-D__BOOTLDR_STANDALONE__ +OBJ=*.o + +REM=rm +REM_FLAG=-f + +FLAG_ASM=-f win64 +FLAG_GNU=-fshort-wchar -c -ffreestanding -MMD -mno-red-zone -D__NE_ARM64__ -fno-rtti -fno-exceptions -I./ \ + -target aarch64-unknown-windows \ + -std=c++20 -DBOOTZ_EPM_SUPPORT -DkExpectedWidth=320 -DkExpectedHeight=480 -D__FSKIT_USE_NEFS__ -D__BOOTLDR_STANDALONE__ -D__NEOSKRNL__ -D__BOOTZ__ -D__HAVE_NE_APIS__ -D__NE__ -I../ -I../kernel + +BOOT_LOADER=bootz.exe +KERNEL=neoskrnl.exe +SYSCHK=syschk.sys +STARTUP=startup.sys + +.PHONY: invalid-recipe +invalid-recipe: + @echo "invalid-recipe: Use make compile-<arch> instead." + +.PHONY: all +all: compile + mkdir -p src/Root/EFI/BOOT + $(LD_GNU) $(OBJ) $(LD_FLAGS) /out:src/$(BOOT_LOADER) + $(COPY) src/$(BOOT_LOADER) src/Root/EFI/BOOT/BOOTAA64.EFI + $(COPY) src/$(BOOT_LOADER) src/Root/EFI/BOOT/BootZ.EFI + $(COPY) ../kernel/$(KERNEL) src/Root/$(KERNEL) + $(COPY) ./modules/SysChk/$(SYSCHK) src/Root/$(SYSCHK) + $(COPY) src/$(BOOT_LOADER) src/Root/$(BOOT_LOADER) + +ifneq ($(DEBUG_SUPPORT), ) +DEBUG = -D__DEBUG__ +endif + +.PHONY: compile +compile: + $(RESCMD) + $(CC_GNU) $(NE_MODEL) $(STANDALONE_MACRO) $(FLAG_GNU) $(DEBUG) \ + $(wildcard src/HEL/ARM64/*.cc) \ + $(wildcard src/HEL/ARM64/*.S) \ + $(wildcard src/*.cc) + +.PHONY: run +run: + $(EMU) $(EMU_FLAGS) + +# img_2 is the rescue disk. img is the bootable disk, as provided by the Zeta. +.PHONY: epm-img +epm-img: + qemu-img create -f raw $(IMG) 10G + qemu-img create -f raw $(IMG_2) 4G + qemu-img create -f raw $(IMG_3) 4G + +.PHONY: efi +efi: + $(HTTP_GET) https://retrage.github.io/edk2-nightly/bin/DEBUGAARCH64_QEMU_EFI.fd -O OVMF.fd + +BINS=*.bin +EXECUTABLES=bootz.exe neoskrnl.exe OVMF.fd + +TARGETS=$(REM_FLAG) $(OBJ) $(BIN) $(IMG) $(IMG_2) $(EXECUTABLES) + +.PHONY: clean +clean: + $(REM) $(TARGETS) + +.PHONY: help +help: + @echo "=== HELP ===" + @echo "epm-img: Format a disk using the Explicit Partition Map." + @echo "gpt-img: Format a disk using the Explicit Partition Map." + @echo "clean: clean bootloader." + @echo "bootloader-amd64: Build bootloader. (PC AMD64)" + @echo "run-efi-amd64: Run bootloader. (PC AMD64)" |
