kv2: initialize memory manager, early pci devices

Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
Michael Shaw 2026-05-12 02:59:37 -04:00
commit a252a3f8e9
58 changed files with 1270 additions and 505 deletions

View file

@ -1,28 +1,26 @@
# SPDX-License-Identifier: GPL-2.0-only
# Makefile stuff for all the booting and bootloader related stuff
$(IMG): limine/limine $(KERNEL) limine.conf
rm -rf iso_root
mkdir -p iso_root/boot
cp -v $(KERNEL) iso_root/
mkdir -p iso_root/boot/limine
cp -v limine.conf iso_root/boot/limine/
mkdir -p iso_root/EFI/BOOT
cp -v limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/boot/limine/
cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/
cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT/
$(IMG): limine/limine $(KERNEL)
rm -rf $(IMG)
dd if=/dev/zero bs=1M count=0 seek=1025 of=$(IMG)
sgdisk $(IMG) -n 1:2048:1050623 -t 1:ef00
sgdisk $(IMG) -n 2:1050624:0 -t 2:8300
mformat -F -v "ESP" -H 2048 -i $(IMG)@@1M
mmd -i $(IMG)@@1M ::/EFI ::/EFI/BOOT ::/boot ::/boot/limine
mcopy -i $(IMG)@@1M kernel.elf ::/
mcopy -i $(IMG)@@1M limine.conf ::/boot/limine
mcopy -i $(IMG)@@1M limine/limine-bios.sys ::/boot/limine
mcopy -i $(IMG)@@1M limine/BOOTX64.EFI ::/EFI/BOOT
mcopy -i $(IMG)@@1M limine/BOOTIA32.EFI ::/EFI/BOOT
mkdir -p os_root/
mke2fs -d os_root -t ext2 os_root.img 512M
xorriso -as mkisofs -R -r -J \
--efi-boot boot/limine/limine-uefi-cd.bin \
-efi-boot-part --efi-boot-image --protective-msdos-label \
--partition_offset 16 \
-append_partition 2 0x83 os_root.img \
iso_root -o $(IMG)
rm -rf os_root.img
rm -f os_root.img
mke2fs -d os_root/ -t ext2 os_root.img 511M
dd if=os_root.img of=$(IMG) bs=1M seek=513 conv=notrunc
rm os_root.img
limine/limine:
rm -rf limine
@ -40,7 +38,7 @@ run: edk2-ovmf $(IMG)
-M q35 \
-drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-$(ARCH).fd,readonly=on \
-nographic \
-cdrom $(IMG) \
-hda $(IMG) \
$(QEMUFLAGS)
.PHONY += debug
@ -50,7 +48,7 @@ debug: edk2-ovmf $(IMG)
-M q35 \
-drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-$(ARCH).fd,readonly=on \
-nographic \
-cdrom $(IMG) \
-hda $(IMG) \
$(QEMUFLAGS)
edk2-ovmf: