diff --git a/Makefile b/Makefile index 0e91fd0..fb7a020 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,10 @@ all: ./rscons build -.PHONY: run -run: - qemu-system-x86_64 -bios OVMF.fd -hda build/hos.img +.PHONY: run-efi +run-efi: + qemu-system-x86_64 -bios OVMF.fd -hda build/hos-efi.img + +.PHONY: run-bios +run-bios: + qemu-system-x86_64 -hda build/hos-bios.img diff --git a/Rsconscript b/Rsconscript index d6fb8ee..af7e747 100644 --- a/Rsconscript +++ b/Rsconscript @@ -3,6 +3,7 @@ configure do check_program "genext2fs" check_program "grub-mkstandalone" check_program "mformat", on_fail: "Install the mtools package" + check_program "xorriso" end build do @@ -13,10 +14,36 @@ build do # HOS partition size (MiB) HOS_PART_SIZE = 4 - class Image < Builder + class BiosImage < Builder def run(options) unless @cache.up_to_date?(@target, nil, @sources, @env) - print_run_message("Generating disk image #{@target}", nil) + print_run_message("Generating BIOS boot image #{@target}", nil) + Dir.mktmpdir do |tmpdir| + # Create iso directory. + FileUtils.mkdir_p("#{tmpdir}/iso/boot/grub") + File.open("#{tmpdir}/iso/boot/grub/grub.cfg", "wb") do |fh| + fh.write(<