build: Make eltorito-efi build manually toggleable

This commit is contained in:
mintsuki 2022-02-08 15:35:54 +01:00
parent 319326a7f5
commit 23ee0bf491
2 changed files with 15 additions and 0 deletions

View File

@ -16,6 +16,8 @@ NASMESCAPE = $(subst ','"'$(COMMA) \"'\"$(COMMA) '"',$(1))
override PATH := $(BUILDDIR)/toolchain/bin:/usr/local/bin:$(PATH)
export PATH
override BUILD_ELTORITO_EFI := @build_eltorito_efi@
WERROR ?= @werror@
export WERROR
@ -140,6 +142,7 @@ limine-bios: common-bios decompressor
.PHONY: limine-eltorito-efi
limine-eltorito-efi:
ifeq ($(BUILD_ELTORITO_EFI), yes)
mkdir -p '$(call SHESCAPE,$(BINDIR))'
dd if=/dev/zero of='$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' bs=512 count=2880 2>/dev/null
( mformat -i '$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' -f 1440 :: && \
@ -150,6 +153,7 @@ limine-eltorito-efi:
( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi32/BOOTIA32.EFI' ] && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi32/BOOTIA32.EFI' ::/EFI/BOOT ) || true ) \
) || rm -f '$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin'
endif
.PHONY: limine-uefi
limine-uefi: limine-uefi32 limine-uefi64

View File

@ -41,9 +41,20 @@ if ! test "x$GZIP_FOUND" = "xyes"; then
AC_MSG_ERROR([gzip not found, please install gzip before configuring])
fi
BUILD_ELTORITO_EFI="yes"
AC_ARG_ENABLE([eltorito-efi],
AS_HELP_STRING([--disable-eltorito-efi], [disable limine-eltorito-efi.bin build]),
BUILD_ELTORITO_EFI="$enableval")
AC_CHECK_PROG([MTOOLS_FOUND], [mcopy], [yes])
if ! test "x$MTOOLS_FOUND" = "xyes"; then
AC_MSG_WARN([mtools not found, install mtools to build limine-eltorito-efi.bin])
BUILD_ELTORITO_EFI="no"
fi
if test "$BUILD_ELTORITO_EFI" = "yes"; then
AC_SUBST(build_eltorito_efi, [yes])
fi
AC_ARG_VAR(HOST_CC, [C compiler for the build host [default: $CC]])