commit 42f5e1aec1bc9e706ecf341485f5dc68ba5c5bdc
parent ab03c3e52af66a7d0d94ec49596ee361ed15fbfe
Author: Matsuda Kenji <info@mtkn.jp>
Date: Sat, 30 Mar 2024 12:46:10 +0900
download OVMF.fd from sourceforge.net
Diffstat:
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
@@ -31,20 +31,24 @@ loader.efi: loader.dll
kernel.elf: kernel.o kernel.ld
ld $(KERN_LDFLAGS) -T kernel.ld -o $@ $<
-run: disk.img
+run: disk.img OVMF.fd
qemu-system-x86_64 \
- -bios /usr/share/edk2/x64/OVMF.fd \
+ -bios OVMF.fd \
-drive format=raw,file=disk.img \
-gdb: disk.img
+gdb: disk.img OVMF.fd
qemu-system-x86_64 \
-bios /usr/share/edk2/x64/OVMF.fd \
-drive format=raw,file=disk.img \
-gdb tcp::1234 -S
+OVMF.fd:
+ curl -OL https://downloads.sourceforge.net/project/edk2/OVMF/OVMF-X64-r15214.zip
+ unzip OVMF-X64-r15214.zip OVMF.fd
+
test: test/* $(SRC) $(HDR)
(cd test && make)
clean:
- rm -rf *.o *.efi *.elf *.dll disk.img image
+ rm -rf *.o *.efi *.elf *.dll disk.img image OVMF*
(cd test && make clean)
diff --git a/loader.c b/loader.c
@@ -45,9 +45,9 @@ EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *systab)
efi_printf("open_gop: %d\n", stat);
return stat;
}
- UINT8 *frame_buffer = (UINT8 *)gop->Mode->FrameBufferBase;
- for (UINTN i = 0; i < gop->Mode->FrameBufferSize; i++) {
- frame_buffer[i] = 0xFF;
+ UINT32 *frame_buffer = (UINT32 *)gop->Mode->FrameBufferBase;
+ for (UINTN i = 0; i < gop->Mode->FrameBufferSize/4; i++) {
+ frame_buffer[i] = 0x427f94;
}
efi_printf("frame buffer: base: %x, size: %x\n", frame_buffer,
gop->Mode->FrameBufferSize);