working build of bootloader
This commit is contained in:
@@ -20,7 +20,7 @@ set(POSIX_UEFI_SOURCES
|
|||||||
Source/uefi/unistd.c
|
Source/uefi/unistd.c
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(posix_uefi_lib STATIC ${POSIX_UEFI_SOURCES})
|
add_library(posix_uefi_lib OBJECT ${POSIX_UEFI_SOURCES})
|
||||||
target_compile_options(posix_uefi_lib PRIVATE ${UEFI_COMPILE_OPTIONS})
|
target_compile_options(posix_uefi_lib PRIVATE ${UEFI_COMPILE_OPTIONS})
|
||||||
target_include_directories(posix_uefi_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Source/uefi)
|
target_include_directories(posix_uefi_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Source/uefi)
|
||||||
|
|
||||||
@@ -34,6 +34,7 @@ target_link_options(BOOTAA64 PRIVATE
|
|||||||
-target aarch64-unknown-windows-msvc
|
-target aarch64-unknown-windows-msvc
|
||||||
-nostdlib
|
-nostdlib
|
||||||
-Wl,-subsystem:efi_application
|
-Wl,-subsystem:efi_application
|
||||||
|
-Wl,-include:uefi_init
|
||||||
-Wl,-entry:uefi_init
|
-Wl,-entry:uefi_init
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "uefi/uefi.h"
|
#include "uefi/uefi.h" // IWYU pragma: keep
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("Meow!\n");
|
printf("Meow!\n");
|
||||||
|
while (1) __asm__ ("wfi");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,11 @@ OS_NAME := os()
|
|||||||
ARCH_NAME := arch()
|
ARCH_NAME := arch()
|
||||||
|
|
||||||
OVMF_ARM := if OS_NAME == "macos" {
|
OVMF_ARM := if OS_NAME == "macos" {
|
||||||
|
if ARCH_NAME == "arm64" {
|
||||||
"/opt/homebrew/share/qemu/edk2-aarch64-code.fd"
|
"/opt/homebrew/share/qemu/edk2-aarch64-code.fd"
|
||||||
|
} else {
|
||||||
|
"/usr/local/share/qemu/edk2-aarch64-code.fd"
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
"/usr/share/edk2/aarch64/QEMU_EFI.fd"
|
"/usr/share/edk2/aarch64/QEMU_EFI.fd"
|
||||||
}
|
}
|
||||||
@@ -24,7 +28,7 @@ CPU := if ARCH_NAME == "arm64" { "host" } else {
|
|||||||
export BUILD_DIR := justfile_directory() + "/.build"
|
export BUILD_DIR := justfile_directory() + "/.build"
|
||||||
export TEMP_DIR := BUILD_DIR + "/temp"
|
export TEMP_DIR := BUILD_DIR + "/temp"
|
||||||
export BOOT_BIN := BUILD_DIR + "/bootloader/BOOTAA64.EFI"
|
export BOOT_BIN := BUILD_DIR + "/bootloader/BOOTAA64.EFI"
|
||||||
export IMG_FILE := BUILD_DIR + "/termOS.img"
|
export IMG_FILE := BUILD_DIR + "/ksOS.img"
|
||||||
|
|
||||||
mod Bootloader
|
mod Bootloader
|
||||||
|
|
||||||
@@ -48,13 +52,16 @@ _prep:
|
|||||||
|
|
||||||
@run: _image
|
@run: _image
|
||||||
@echo "🚀 Launching..."
|
@echo "🚀 Launching..."
|
||||||
@cp /usr/share/edk2/aarch64/QEMU_VARS.fd {{TEMP_DIR}}/vars.fd
|
|
||||||
qemu-system-aarch64 {{ACCEL}} \
|
qemu-system-aarch64 {{ACCEL}} \
|
||||||
-machine virt \
|
-machine virt \
|
||||||
-cpu {{CPU}} \
|
-cpu {{CPU}} \
|
||||||
-m 512M \
|
-m 512M \
|
||||||
-drive if=pflash,format=raw,readonly=on,file=/usr/share/edk2/aarch64/QEMU_EFI.fd \
|
-device virtio-gpu-pci \
|
||||||
-drive if=pflash,format=raw,file={{TEMP_DIR}}/vars.fd \
|
-display cocoa,show-cursor=on \
|
||||||
|
-drive if=pflash,format=raw,readonly=on,file={{OVMF_ARM}} \
|
||||||
-drive file={{IMG_FILE}},format=raw,if=none,id=hd0 \
|
-drive file={{IMG_FILE}},format=raw,if=none,id=hd0 \
|
||||||
-device virtio-blk-device,drive=hd0 \
|
-device virtio-blk-device,drive=hd0 \
|
||||||
-serial mon:stdio
|
-serial mon:stdio
|
||||||
|
|
||||||
|
@clean:
|
||||||
|
rm -rf {{BUILD_DIR}}
|
||||||
Reference in New Issue
Block a user