#!/bin/sh

make -C boot/limine
rm -rf iso_root
mkdir -p iso_root/boot/limine
mkdir -p iso_root/EFI/BOOT

cp -v kernel/build/kernel.elf iso_root/boot
cp -v boot/limine/limine-bios.sys boot/limine/limine-bios-cd.bin \
  boot/limine/limine-uefi-cd.bin boot/limine.conf iso_root/boot/limine

cp -v boot/limine/BOOTX64.EFI boot/limine/BOOTIA32.EFI iso_root/EFI/BOOT

cp -v mop3dist.tar.lz4 iso_root/boot

xorriso -as mkisofs -R -r -J -b boot/limine/limine-bios-cd.bin \
  -no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \
  -apm-block-size 2048 --efi-boot boot/limine/limine-uefi-cd.bin \
  -efi-boot-part --efi-boot-image --protective-msdos-label \
  iso_root -o mop3.iso

boot/limine/limine bios-install mop3.iso
