:: commit edf490b8725b4183a64234a67beb4391c7fa8d30

mintsuki <mintsuki@protonmail.com> — 2021-05-31 19:48

parents: 6ac24628e8

build: Handle broken or missing mtools

diff --git a/Makefile b/Makefile
index c921107c..b765ed9c 100644
--- a/Makefile
+++ b/Makefile
@@ -66,10 +66,11 @@ limine-bios: stage23-bios decompressor
 
 bin/limine-eltorito-efi.bin: build/stage23-uefi/BOOTX64.EFI
 	dd if=/dev/zero of=$@ bs=512 count=2880
-	mformat -i $@ -f 1440 ::
-	mmd -D s -i $@ ::/EFI
-	mmd -D s -i $@ ::/EFI/BOOT
-	mcopy -D o -i $@ build/stage23-uefi/BOOTX64.EFI ::/EFI/BOOT
+	( mformat -i $@ -f 1440 :: && \
+	  mmd -D s -i $@ ::/EFI && \
+	  mmd -D s -i $@ ::/EFI/BOOT && \
+	  mcopy -D o -i $@ build/stage23-uefi/BOOTX64.EFI ::/EFI/BOOT ) \
+	|| rm -f $@
 
 .PHONY: limine-uefi
 limine-uefi:
diff --git a/README.md b/README.md
index a225a13b..d3ff23d9 100644
--- a/README.md
+++ b/README.md
@@ -79,7 +79,7 @@ make toolchain
 ### Building Limine
 
 In order to build Limine, the following packages have to be installed: `bash`, `make`, `git`,
-`which`, `nasm`, `mtools`. Furthermore, either the toolchain must have been built in
+`which`, `nasm`, `mtools` (optional, necessary to build `limine-eltorito-efi.bin`). Furthermore, either the toolchain must have been built in
 the previous paragraph, or `gcc` and `binutils` must also be installed.
 
 The bootloader can then be built with:
tab: 248 wrap: offon