kv2: add new build modular system
Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
parent
552f45c258
commit
584a79f355
5 changed files with 127 additions and 118 deletions
62
scripts/Makefile.limine
Normal file
62
scripts/Makefile.limine
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# 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/
|
||||
|
||||
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
|
||||
|
||||
limine/limine:
|
||||
rm -rf limine
|
||||
git clone https://codeberg.org/Limine/Limine.git limine --branch=$(LIMINE_VERSION)-binary --depth=1
|
||||
$(MAKE) -C limine \
|
||||
CC="$(HOST_CC)" \
|
||||
CFLAGS="$(HOST_CFLAGS)" \
|
||||
CPPFLAGS="$(HOST_CPPFLAGS)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS)" \
|
||||
LIBS="$(HOST_LIBS)"
|
||||
|
||||
.PHONY += run
|
||||
run: edk2-ovmf $(IMG)
|
||||
qemu-system-$(ARCH) \
|
||||
-M q35 \
|
||||
-drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-$(ARCH).fd,readonly=on \
|
||||
-nographic \
|
||||
-cdrom $(IMG) \
|
||||
$(QEMUFLAGS)
|
||||
|
||||
.PHONY += debug
|
||||
debug: edk2-ovmf $(IMG)
|
||||
qemu-system-$(ARCH) \
|
||||
-S -s \
|
||||
-M q35 \
|
||||
-drive if=pflash,unit=0,format=raw,file=edk2-ovmf/ovmf-code-$(ARCH).fd,readonly=on \
|
||||
-nographic \
|
||||
-cdrom $(IMG) \
|
||||
$(QEMUFLAGS)
|
||||
|
||||
edk2-ovmf:
|
||||
curl -L https://github.com/osdev0/edk2-ovmf-nightly/releases/latest/download/edk2-ovmf.tar.gz | gunzip | tar -xf -
|
||||
|
||||
.PHONY += distclean
|
||||
distclean:
|
||||
make clean
|
||||
rm -rf limine
|
||||
Loading…
Reference in a new issue