2022-03-26 17:54:00 +13:00
|
|
|
.PHONY: all
|
|
|
|
all: barebones.iso
|
|
|
|
|
|
|
|
.PHONY: all-hdd
|
|
|
|
all-hdd: barebones.hdd
|
|
|
|
|
|
|
|
.PHONY: run
|
|
|
|
run: barebones.iso
|
2022-07-10 06:09:03 +12:00
|
|
|
qemu-system-x86_64 -M q35 -m 2G -cdrom barebones.iso -boot d
|
2022-03-26 17:54:00 +13:00
|
|
|
|
|
|
|
.PHONY: run-uefi
|
2022-07-10 06:09:03 +12:00
|
|
|
run-uefi: ovmf-x64 barebones.iso
|
|
|
|
qemu-system-x86_64 -M q35 -m 2G -bios ovmf-x64/OVMF.fd -cdrom barebones.iso -boot d
|
2022-03-26 17:54:00 +13:00
|
|
|
|
|
|
|
.PHONY: run-hdd
|
|
|
|
run-hdd: barebones.hdd
|
2022-07-10 06:09:03 +12:00
|
|
|
qemu-system-x86_64 -M q35 -m 2G -hda barebones.hdd
|
2022-03-26 17:54:00 +13:00
|
|
|
|
|
|
|
.PHONY: run-hdd-uefi
|
2022-07-10 06:09:03 +12:00
|
|
|
run-hdd-uefi: ovmf-x64 barebones.hdd
|
|
|
|
qemu-system-x86_64 -M q35 -m 2G -bios ovmf-x64/OVMF.fd -hda barebones.hdd
|
2022-03-26 17:54:00 +13:00
|
|
|
|
2022-07-10 06:09:03 +12:00
|
|
|
ovmf-x64:
|
|
|
|
mkdir -p ovmf-x64
|
|
|
|
cd ovmf-x64 && curl -o OVMF-X64.zip https://efi.akeo.ie/OVMF/OVMF-X64.zip && 7z x OVMF-X64.zip
|
2022-03-26 17:54:00 +13:00
|
|
|
|
|
|
|
limine:
|
|
|
|
git clone https://github.com/limine-bootloader/limine.git --branch=v3.0-branch-binary --depth=1
|
|
|
|
make -C limine
|
|
|
|
|
|
|
|
.PHONY: kernel
|
|
|
|
kernel:
|
|
|
|
$(MAKE) -C kernel
|
|
|
|
|
|
|
|
barebones.iso: limine kernel
|
|
|
|
rm -rf iso_root
|
|
|
|
mkdir -p iso_root
|
|
|
|
cp kernel/kernel.elf \
|
2022-03-31 03:05:00 +13:00
|
|
|
limine.cfg limine/limine.sys limine/limine-cd.bin limine/limine-cd-efi.bin iso_root/
|
2022-03-26 17:54:00 +13:00
|
|
|
xorriso -as mkisofs -b limine-cd.bin \
|
|
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
2022-03-31 03:05:00 +13:00
|
|
|
--efi-boot limine-cd-efi.bin \
|
2022-03-26 17:54:00 +13:00
|
|
|
-efi-boot-part --efi-boot-image --protective-msdos-label \
|
|
|
|
iso_root -o barebones.iso
|
2022-04-02 22:27:58 +13:00
|
|
|
limine/limine-deploy barebones.iso
|
2022-03-26 17:54:00 +13:00
|
|
|
rm -rf iso_root
|
|
|
|
|
|
|
|
barebones.hdd: limine kernel
|
|
|
|
rm -f barebones.hdd
|
|
|
|
dd if=/dev/zero bs=1M count=0 seek=64 of=barebones.hdd
|
|
|
|
parted -s barebones.hdd mklabel gpt
|
|
|
|
parted -s barebones.hdd mkpart ESP fat32 2048s 100%
|
|
|
|
parted -s barebones.hdd set 1 esp on
|
2022-04-02 22:27:58 +13:00
|
|
|
limine/limine-deploy barebones.hdd
|
2022-03-26 17:54:00 +13:00
|
|
|
sudo losetup -Pf --show barebones.hdd >loopback_dev
|
|
|
|
sudo mkfs.fat -F 32 `cat loopback_dev`p1
|
|
|
|
mkdir -p img_mount
|
|
|
|
sudo mount `cat loopback_dev`p1 img_mount
|
|
|
|
sudo mkdir -p img_mount/EFI/BOOT
|
|
|
|
sudo cp -v kernel/kernel.elf limine.cfg limine/limine.sys img_mount/
|
2022-07-10 06:09:03 +12:00
|
|
|
sudo cp -v limine/BOOTX64.EFI img_mount/EFI/BOOT/
|
2022-03-26 17:54:00 +13:00
|
|
|
sync
|
|
|
|
sudo umount img_mount
|
|
|
|
sudo losetup -d `cat loopback_dev`
|
|
|
|
rm -rf loopback_dev img_mount
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf iso_root barebones.iso barebones.hdd
|
|
|
|
$(MAKE) -C kernel clean
|
|
|
|
|
|
|
|
.PHONY: distclean
|
|
|
|
distclean: clean
|
2022-07-10 06:09:03 +12:00
|
|
|
rm -rf limine ovmf-x64
|
2022-03-26 17:54:00 +13:00
|
|
|
$(MAKE) -C kernel distclean
|