diff --git a/README.md b/README.md index 42e49d5..b277fee 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,97 @@ # ZOVboot -ZOVboot -- bootloader на основе limine для запуска системы \ No newline at end of file +ZOVboot - кастомный загрузчик для **ZovOS**, основанный на кодовой базе +[Limine](https://github.com/limine-bootloader/limine). + +Сейчас задача проекта - сохранить надёжную загрузку Limine и постепенно +добавить собственный брендинг, упаковку и интеграцию под ZovOS. + +## Статус + +Проект находится на раннем этапе разработки. + +На данный момент в репозитории уже есть: + +- vendored-копия исходников Limine +- первые патчи с брендингом ZOVboot +- база для интеграции загрузки ZovOS + +Для совместимости пока специально сохранены некоторые соглашения Limine: + +- `limine.conf` +- `limine-bios.sys` +- стандартные UEFI-имена вроде `BOOTX64.EFI` +- структуры и идентификаторы Limine Boot Protocol + +То есть сейчас ZOVboot - это **кастомизированный форк Limine для ZovOS**, а +не полностью независимый загрузчик. + +## Структура репозитория + +- `limine/` - основное дерево исходников загрузчика и его build-system +- `README.md` - описание проекта +- `LICENSE` - лицензия репозитория + +## Сборка + +Собирать проект нужно из директории `limine/`. + +Если ты работаешь прямо из этого git-репозитория, сначала нужно выполнить +bootstrap: + +```bash +cd limine +./bootstrap +``` + +После этого можно создать отдельную директорию сборки и включить нужные порты: + +```bash +mkdir -p build +cd build +../configure --enable-bios --enable-uefi-x86-64 +make +``` + +Обычно для сборки нужны: + +- `autoconf` +- `automake` +- `make` +- `clang` или `gcc` +- `ld.lld` или другой рабочий target linker +- `objcopy`, `objdump`, `readelf` +- `nasm` +- `gzip` + +Полезные дополнительные инструменты: + +- `mtools` +- `xorriso` +- `qemu` + +## Заметки + +- Пока идёт ребрендинг, проект специально сохраняет часть upstream-имён + файлов, чтобы не ломать совместимость загрузки. +- Основная низкоуровневая логика загрузки по-прежнему живёт в дереве + `limine/`. +- Документация upstream Limine всё ещё полезна, особенно файлы: + - `limine/README.md` + - `limine/INSTALL.md` + - `limine/USAGE.md` + - `limine/CONFIG.md` + +## Планы + +- закончить брендинг ZOVboot в меню и утилитах +- добавить ZovOS-специфичные boot entries и упаковку образов +- ввести собственные имена конфигов и файлов с fallback на старые +- проверить BIOS и UEFI пути загрузки для образов ZovOS + +## Лицензия + +Смотри `LICENSE` для лицензии репозитория. + +В vendored-дереве `limine/` также есть сторонние зависимости. Подробности +можно посмотреть в `limine/3RDPARTY.md`. diff --git a/limine/build-host/GNUmakefile b/limine/build-host/GNUmakefile new file mode 100644 index 0000000..6f130c5 --- /dev/null +++ b/limine/build-host/GNUmakefile @@ -0,0 +1,401 @@ +.SUFFIXES: + +override SOURCE_DATE_EPOCH := 1546297200 +export SOURCE_DATE_EPOCH + +override SOURCE_DATE_EPOCH_TOUCH := 201901010000 + +override PACKAGE_TARNAME := zovboot +override PACKAGE_VERSION := UNVERSIONED +override DIST_OUTPUT := $(PACKAGE_TARNAME)-$(PACKAGE_VERSION) + +override prefix := /usr/local +override exec_prefix := ${prefix} + +override bindir := ${exec_prefix}/bin +override datarootdir := ${prefix}/share +override mandir := ${datarootdir}/man +override docdir := ${datarootdir}/doc/${PACKAGE_TARNAME} + +override BUILDDIR := /home/wpng1337/Zovboot/ZOVboot/limine/build-host +override BINDIR := $(BUILDDIR)/bin + +override SRCDIR := /home/wpng1337/Zovboot/ZOVboot/limine + +override SPACE := $(subst ,, ) +override COMMA := , + +override MKESCAPE = $(subst $(SPACE),\ ,$(1)) +override SHESCAPE = $(subst ','\'',$(1)) +override NASMESCAPE = $(subst ','"'$(COMMA) \"'\"$(COMMA) '"',$(1)) + +override BUILD_BIOS := +override BUILD_UEFI_X86_64 := +override BUILD_UEFI_IA32 := +override BUILD_UEFI_AARCH64 := +override BUILD_UEFI_RISCV64 := +override BUILD_UEFI_LOONGARCH64 := +override BUILD_UEFI_CD := no +override BUILD_BIOS_PXE := no +override BUILD_BIOS_CD := no + +INSTALL := /usr/bin/install -c +INSTALL_PROGRAM := ${INSTALL} +INSTALL_DATA := ${INSTALL} -m 644 +STRIP := strip + +MKDIR_P := /usr/bin/mkdir -p +export MKDIR_P +GREP := /usr/bin/grep +export GREP +SED := /usr/bin/sed +export SED +AWK := gawk +export AWK + +CC := gcc + +CPPFLAGS := +CFLAGS := -g -O2 -pipe +LDFLAGS := +LIBS := + +CC_FOR_TARGET := clang +export CC_FOR_TARGET +LD_FOR_TARGET := ld +export LD_FOR_TARGET +OBJCOPY_FOR_TARGET := objcopy +export OBJCOPY_FOR_TARGET +OBJDUMP_FOR_TARGET := objdump +export OBJDUMP_FOR_TARGET +READELF_FOR_TARGET := readelf +export READELF_FOR_TARGET + +override WERROR_FLAG := -Wno-error +export WERROR_FLAG + +CFLAGS_FOR_TARGET := -g -O2 -pipe +export CFLAGS_FOR_TARGET +CPPFLAGS_FOR_TARGET := +export CPPFLAGS_FOR_TARGET +LDFLAGS_FOR_TARGET := +export LDFLAGS_FOR_TARGET +NASMFLAGS_FOR_TARGET := -g +export NASMFLAGS_FOR_TARGET + +override STAGE1_FILES := $(shell find '$(call SHESCAPE,$(SRCDIR))/stage1' -type f -name '*.asm' | LC_ALL=C sort) + +.PHONY: all +all: $(call MKESCAPE,$(BINDIR))/Makefile + $(MAKE) all1 + +.PHONY: all1 +all1: $(BUILD_UEFI_X86_64) $(BUILD_UEFI_IA32) $(BUILD_UEFI_AARCH64) $(BUILD_UEFI_RISCV64) $(BUILD_UEFI_LOONGARCH64) $(BUILD_BIOS) + $(MAKE) '$(call SHESCAPE,$(BINDIR))/limine' + $(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' + +$(call MKESCAPE,$(BINDIR))/limine-bios-hdd.h: $(call MKESCAPE,$(BINDIR))/limine-bios-hdd.bin + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cd '$(call SHESCAPE,$(BINDIR))' && '$(call SHESCAPE,$(SRCDIR))/host/hgen.sh' >limine-bios-hdd.h + +override LIMINE_NO_BIOS := +ifneq ($(BUILD_BIOS),limine-bios) +override LIMINE_NO_BIOS := -DLIMINE_NO_BIOS +endif + +$(call MKESCAPE,$(BINDIR))/limine: $(call MKESCAPE,$(BINDIR))/Makefile $(call MKESCAPE,$(SRCDIR))/host/limine.c $(if $(filter $(BUILD_BIOS),limine-bios),$(call MKESCAPE,$(BINDIR))/limine-bios-hdd.h) + $(SED) 's/%VERSION%/UNVERSIONED/g;s/%COPYRIGHT%/Copyright (C) 2019-2026 Mintsuki and contributors./g' <'$(call SHESCAPE,$(SRCDIR))/host/limine.c' >'$(call SHESCAPE,$(BINDIR))/limine.c' + $(MAKE) -C '$(call SHESCAPE,$(BINDIR))' limine \ + CC="$(CC)" \ + CFLAGS="$(CFLAGS) -Wall -Wextra $(WERROR_FLAG)" \ + CPPFLAGS='$(CPPFLAGS) $(LIMINE_NO_BIOS) -DLIMINE_DATADIR=\"$(call SHESCAPE,$(datarootdir))/limine\"' \ + LDFLAGS="$(LDFLAGS)" \ + LIBS="$(LIBS)" + +$(call MKESCAPE,$(BINDIR))/Makefile: $(call MKESCAPE,$(SRCDIR))/host/host.mk $(call MKESCAPE,$(SRCDIR))/host/.gitignore + mkdir -p '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(SRCDIR))/host/host.mk' '$(call SHESCAPE,$(BINDIR))/Makefile' + cp '$(call SHESCAPE,$(SRCDIR))/host/.gitignore' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine +limine: + $(MAKE) '$(call SHESCAPE,$(BINDIR))/limine' + +.PHONY: clean +clean: limine-bios-clean limine-uefi-ia32-clean limine-uefi-x86-64-clean limine-uefi-aarch64-clean limine-uefi-riscv64-clean limine-uefi-loongarch64-clean + rm -rf '$(call SHESCAPE,$(BINDIR))' '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp' + +.PHONY: install +install: all + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(docdir))' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/COPYING' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(docdir))/LICENSES' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/LICENSES/LicenseRef-scancode-bsd-no-disclaimer-unmodified.txt' '$(call SHESCAPE,$(DESTDIR)$(docdir))/LICENSES/' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/3RDPARTY.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/CONFIG.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/FAQ.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/USAGE.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1' + $(INSTALL_DATA) '$(call SHESCAPE,$(BUILDDIR))/man/man1/limine.1' '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/' + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(datarootdir))' + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine' +ifeq ($(BUILD_BIOS),limine-bios) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-bios.sys' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifneq ($(BUILD_BIOS_CD),no) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-bios-cd.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifneq ($(BUILD_UEFI_CD),no) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifneq ($(BUILD_BIOS_PXE),no) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-bios-pxe.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_AARCH64),limine-uefi-aarch64) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTAA64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_RISCV64),limine-uefi-riscv64) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTRISCV64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_LOONGARCH64),limine-uefi-loongarch64) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTLOONGARCH64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_X86_64),limine-uefi-x86-64) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTX64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_IA32),limine-uefi-ia32) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTIA32.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(bindir))' + $(INSTALL_PROGRAM) '$(call SHESCAPE,$(BINDIR))/limine' '$(call SHESCAPE,$(DESTDIR)$(bindir))/' + +.PHONY: install-strip +install-strip: install + $(STRIP) '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine' + +.PHONY: uninstall +uninstall: + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/COPYING' + rm -rf '$(call SHESCAPE,$(DESTDIR)$(docdir))/LICENSES' + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/3RDPARTY.md' + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/CONFIG.md' + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/FAQ.md' + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/USAGE.md' + rm -f '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/limine.1' + rm -f '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine' + rm -rf '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine' + +$(call MKESCAPE,$(BUILDDIR))/stage1.stamp: $(STAGE1_FILES) $(call MKESCAPE,$(BUILDDIR))/decompressor-build/decompressor.bin $(call MKESCAPE,$(BUILDDIR))/common-bios/stage2.bin.gz + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cd '$(call SHESCAPE,$(SRCDIR))/stage1/hdd' && nasm bootsect.asm -Wall -w-unknown-warning -w-reloc $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-bios-hdd.bin' +ifneq ($(BUILD_BIOS_CD),no) + cd '$(call SHESCAPE,$(SRCDIR))/stage1/cd' && nasm bootsect.asm -Wall -w-unknown-warning -w-reloc $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-bios-cd.bin' +endif +ifneq ($(BUILD_BIOS_PXE),no) + cd '$(call SHESCAPE,$(SRCDIR))/stage1/pxe' && nasm bootsect.asm -Wall -w-unknown-warning -w-reloc $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-bios-pxe.bin' +endif + cp '$(call SHESCAPE,$(BUILDDIR))/common-bios/limine-bios.sys' '$(call SHESCAPE,$(BINDIR))/' + touch '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp' + +.PHONY: limine-bios +limine-bios: common-bios decompressor + $(MAKE) '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp' + +$(call MKESCAPE,$(BINDIR))/limine-uefi-cd.bin: $(if $(BUILD_UEFI_IA32),$(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI) $(if $(BUILD_UEFI_X86_64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI) $(if $(BUILD_UEFI_AARCH64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI) $(if $(BUILD_UEFI_RISCV64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI) $(if $(BUILD_UEFI_LOONGARCH64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-loongarch64/BOOTLOONGARCH64.EFI) +ifneq ($(BUILD_UEFI_CD),no) + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + rm -f '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' + dd if=/dev/zero of='$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' bs=512 count=5760 2>/dev/null + mformat -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' -f 2880 -N 12345678 :: + LIMINE_UEFI_CD_TMP="$$(mktemp -d)"; \ + mkdir -p "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-loongarch64/BOOTLOONGARCH64.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + find "$$LIMINE_UEFI_CD_TMP" -exec touch -t $(SOURCE_DATE_EPOCH_TOUCH) '{}' + && \ + mcopy -D o -s -m -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' "$$LIMINE_UEFI_CD_TMP"/EFI :: && \ + rm -rf "$$LIMINE_UEFI_CD_TMP" +endif + +.PHONY: limine-uefi-cd +limine-uefi-cd: + $(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' + +$(call MKESCAPE,$(BINDIR))/BOOTX64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-x86-64 +limine-uefi-x86-64: + $(MAKE) common-uefi-x86-64 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTX64.EFI' + +$(call MKESCAPE,$(BINDIR))/BOOTIA32.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-ia32 +limine-uefi-ia32: + $(MAKE) common-uefi-ia32 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTIA32.EFI' + +$(call MKESCAPE,$(BINDIR))/BOOTAA64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-aarch64 +limine-uefi-aarch64: + $(MAKE) common-uefi-aarch64 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTAA64.EFI' + +$(call MKESCAPE,$(BINDIR))/BOOTRISCV64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-riscv64 +limine-uefi-riscv64: + $(MAKE) common-uefi-riscv64 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTRISCV64.EFI' + +$(call MKESCAPE,$(BINDIR))/BOOTLOONGARCH64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-loongarch64/BOOTLOONGARCH64.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-loongarch64/BOOTLOONGARCH64.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-loongarch64 +limine-uefi-loongarch64: + $(MAKE) common-uefi-loongarch64 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTLOONGARCH64.EFI' + +.PHONY: limine-bios-clean +limine-bios-clean: common-bios-clean decompressor-clean + +.PHONY: limine-uefi-x86-64-clean +limine-uefi-x86-64-clean: common-uefi-x86-64-clean + +.PHONY: limine-uefi-ia32-clean +limine-uefi-ia32-clean: common-uefi-ia32-clean + +.PHONY: limine-uefi-aarch64-clean +limine-uefi-aarch64-clean: common-uefi-aarch64-clean + +.PHONY: limine-uefi-riscv64-clean +limine-uefi-riscv64-clean: common-uefi-riscv64-clean + +.PHONY: limine-uefi-loongarch64-clean +limine-uefi-loongarch64-clean: common-uefi-loongarch64-clean + +.PHONY: dist +dist: + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" + $(MKDIR_P) '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" + cp -r '$(call SHESCAPE,$(SRCDIR))'/.git '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)"/ + cd '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" && git checkout . + cd '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" && ./bootstrap + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/flanterm/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/flanterm/.gitignore" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/freestnd-c-hdrs/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/limine-protocol/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/picoefi/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/picoefi/.gitignore" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/cc-runtime" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/libfdt/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/tinf" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/common/lib/stb_image.h.nopatch" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/.gitignore" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/.forgejo" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/README.md" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/autom4te.cache" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/test" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/test.mk" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/logo.png" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/screenshot.png" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/bochsrc" + echo "$(PACKAGE_VERSION)" > '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/version" + cd '$(call SHESCAPE,$(BUILDDIR))' && tar -cf "$(DIST_OUTPUT).tar" "$(DIST_OUTPUT)" + cd '$(call SHESCAPE,$(BUILDDIR))' && gzip < "$(DIST_OUTPUT).tar" > "$(DIST_OUTPUT).tar.gz" + cd '$(call SHESCAPE,$(BUILDDIR))' && ( bzip2 < "$(DIST_OUTPUT).tar" > "$(DIST_OUTPUT).tar.bz2" || rm -f "$(DIST_OUTPUT).tar.bz2" ) + cd '$(call SHESCAPE,$(BUILDDIR))' && ( xz < "$(DIST_OUTPUT).tar" > "$(DIST_OUTPUT).tar.xz" || rm -f "$(DIST_OUTPUT).tar.xz" ) + cd '$(call SHESCAPE,$(BUILDDIR))' && rm "$(DIST_OUTPUT).tar" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" + +.PHONY: distclean +distclean: clean + rm -rf edk2-ovmf config.log config.status GNUmakefile config.h man/man1/limine.1 + +.PHONY: maintainer-clean +maintainer-clean: distclean + cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf flanterm common/lib/stb_image.h.nopatch common/lib/stb_image.h decompressor/tinf tinf libfdt freestnd-c-hdrs cc-runtime common/cc-runtime.s2.c decompressor/cc-runtime.c limine-protocol picoefi configure timestamps build-aux *'~' autom4te.cache aclocal.m4 *.tar* + +.PHONY: common-uefi-x86-64 +common-uefi-x86-64: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-x86-64 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64' + +.PHONY: common-uefi-x86-64-clean +common-uefi-x86-64-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64' + +.PHONY: common-uefi-aarch64 +common-uefi-aarch64: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-aarch64 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64' + +.PHONY: common-uefi-aarch64-clean +common-uefi-aarch64-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64' + +.PHONY: common-uefi-riscv64 +common-uefi-riscv64: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-riscv64 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64' + +.PHONY: common-uefi-riscv64-clean +common-uefi-riscv64-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64' + +.PHONY: common-uefi-loongarch64 +common-uefi-loongarch64: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-loongarch64 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-loongarch64' + +.PHONY: common-uefi-loongarch64-clean +common-uefi-loongarch64-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-loongarch64' + +.PHONY: common-uefi-ia32 +common-uefi-ia32: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-ia32 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32' + +.PHONY: common-uefi-ia32-clean +common-uefi-ia32-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32' + +.PHONY: common-bios +common-bios: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=bios \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-bios' + +.PHONY: common-bios-clean +common-bios-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-bios' + +.PHONY: decompressor +decompressor: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/decompressor' -f decompressor.mk \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/decompressor-build' + +.PHONY: decompressor-clean +decompressor-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/decompressor-build' + +-include test.mk diff --git a/limine/build-host/bin/.gitignore b/limine/build-host/bin/.gitignore new file mode 100644 index 0000000..a1492fd --- /dev/null +++ b/limine/build-host/bin/.gitignore @@ -0,0 +1,2 @@ +limine +limine.exe diff --git a/limine/build-host/bin/Makefile b/limine/build-host/bin/Makefile new file mode 100644 index 0000000..4962735 --- /dev/null +++ b/limine/build-host/bin/Makefile @@ -0,0 +1,19 @@ +.POSIX: + +SHELL=/bin/sh + +CC=cc +CFLAGS=-g -O2 -pipe +CPPFLAGS= +LDFLAGS= +LIBS= + +.PHONY: all +all: limine + +.PHONY: clean +clean: + rm -f limine limine.exe + +limine: limine.c + $(CC) $(CFLAGS) -std=c99 $(CPPFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ diff --git a/limine/build-host/bin/limine.c b/limine/build-host/bin/limine.c new file mode 100644 index 0000000..f50c6df --- /dev/null +++ b/limine/build-host/bin/limine.c @@ -0,0 +1,1444 @@ +#undef IS_WINDOWS +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__) +#define IS_WINDOWS 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef LIMINE_NO_BIOS +#include "limine-bios-hdd.h" +#endif + +static char *program_name = NULL; + +static void perror_wrap(const char *fmt, ...) { + int old_errno = errno; + + fprintf(stderr, "%s: ", program_name); + + va_list args; + va_start(args, fmt); + + vfprintf(stderr, fmt, args); + + va_end(args); + + fprintf(stderr, ": %s\n", strerror(old_errno)); +} + +static void remove_arg(int *argc, char *argv[], int index) { + for (int i = index; i < *argc - 1; i++) { + argv[i] = argv[i + 1]; + } + + (*argc)--; + + argv[*argc] = NULL; +} + +static inline bool mul_u64_overflow(uint64_t a, uint64_t b, uint64_t *res) { + *res = a * b; + return a != 0 && b > UINT64_MAX / a; +} + +static inline bool add_u64_overflow(uint64_t a, uint64_t b, uint64_t *res) { + *res = a + b; + return a > UINT64_MAX - b; +} + +#ifndef LIMINE_NO_BIOS + +static bool quiet = false; + +static int set_pos(FILE *stream, uint64_t pos) { + if (sizeof(long) >= 8) { + return fseek(stream, (long)pos, SEEK_SET); + } + + long jump_size = (LONG_MAX / 2) + 1; + long last_jump = pos % jump_size; + uint64_t jumps = pos / jump_size; + + rewind(stream); + + for (uint64_t i = 0; i < jumps; i++) { + if (fseek(stream, jump_size, SEEK_CUR) != 0) { + return -1; + } + } + if (fseek(stream, last_jump, SEEK_CUR) != 0) { + return -1; + } + + return 0; +} + +#define SIZEOF_ARRAY(array) (sizeof(array) / sizeof(array[0])) +#define DIV_ROUNDUP(a, b) (((a) + ((b) - 1)) / (b)) + +struct gpt_table_header { + // the head + char signature[8]; + uint32_t revision; + uint32_t header_size; + uint32_t crc32; + uint32_t _reserved0; + + // the partitioning info + uint64_t my_lba; + uint64_t alternate_lba; + uint64_t first_usable_lba; + uint64_t last_usable_lba; + + // the guid + uint64_t disk_guid[2]; + + // entries related + uint64_t partition_entry_lba; + uint32_t number_of_partition_entries; + uint32_t size_of_partition_entry; + uint32_t partition_entry_array_crc32; +}; + +struct gpt_entry { + uint64_t partition_type_guid[2]; + + uint64_t unique_partition_guid[2]; + + uint64_t starting_lba; + uint64_t ending_lba; + + uint64_t attributes; + + uint16_t partition_name[36]; +}; + +struct gpt2mbr_type_conv { + uint64_t gpt_type1; + uint64_t gpt_type2; + uint8_t mbr_type; +}; + +// This table is very incomplete, but it should be enough for covering +// all that matters for ISOHYBRIDs. +// Of course, though, expansion is welcome. +static struct gpt2mbr_type_conv gpt2mbr_type_conv_table[] = { + { 0x11d2f81fc12a7328, 0x3bc93ec9a0004bba, 0xef }, // EFI system partition + { 0x4433b9e5ebd0a0a2, 0xc79926b7b668c087, 0x07 }, // Microsoft basic data + { 0x11aa000048465300, 0xacec4365300011aa, 0xaf }, // HFS/HFS+ +}; + +static int gpt2mbr_type(uint64_t gpt_type1, uint64_t gpt_type2) { + for (size_t i = 0; i < SIZEOF_ARRAY(gpt2mbr_type_conv_table); i++) { + if (gpt2mbr_type_conv_table[i].gpt_type1 == gpt_type1 + && gpt2mbr_type_conv_table[i].gpt_type2 == gpt_type2) { + return gpt2mbr_type_conv_table[i].mbr_type; + } + } + return -1; +} + +static void lba2chs(uint8_t *chs, uint64_t lba) { + // If LBA is too big to express, use a standard value for CHS. + if (lba > 63 * 255 * 1024) { + goto lba_too_big; + } + + uint64_t cylinder = lba / (255 * 63); + if (cylinder >= 1024) { +lba_too_big: + chs[0] = 0xfe; + chs[1] = 0xff; + chs[2] = 0xff; + return; + } + uint64_t head = (lba / 63) % 255; + uint64_t sector = (lba % 63) + 1; + + chs[0] = head; + chs[1] = (cylinder >> 2) & 0xc0; // high 2 bits + chs[1] |= sector & 0x3f; + chs[2] = cylinder; // low 8 bits +} + +static uint16_t endswap16(uint16_t value) { + uint16_t ret = 0; + ret |= (value >> 8) & 0x00ff; + ret |= (value << 8) & 0xff00; + return ret; +} + +static uint32_t endswap32(uint32_t value) { + uint32_t ret = 0; + ret |= (value >> 24) & 0x000000ff; + ret |= (value >> 8) & 0x0000ff00; + ret |= (value << 8) & 0x00ff0000; + ret |= (value << 24) & 0xff000000; + return ret; +} + +static uint64_t endswap64(uint64_t value) { + uint64_t ret = 0; + ret |= (value >> 56) & 0x00000000000000ff; + ret |= (value >> 40) & 0x000000000000ff00; + ret |= (value >> 24) & 0x0000000000ff0000; + ret |= (value >> 8) & 0x00000000ff000000; + ret |= (value << 8) & 0x000000ff00000000; + ret |= (value << 24) & 0x0000ff0000000000; + ret |= (value << 40) & 0x00ff000000000000; + ret |= (value << 56) & 0xff00000000000000; + return ret; +} + +#ifdef __BYTE_ORDER__ + +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#define bigendian true +#else +#define bigendian false +#endif + +#else /* !__BYTE_ORDER__ */ + +static bool bigendian = false; + +#endif /* !__BYTE_ORDER__ */ + +#define ENDSWAP(VALUE) (bigendian ? ( \ + sizeof(VALUE) == 1 ? (VALUE) : \ + sizeof(VALUE) == 2 ? endswap16(VALUE) : \ + sizeof(VALUE) == 4 ? endswap32(VALUE) : \ + sizeof(VALUE) == 8 ? endswap64(VALUE) : (abort(), 1) \ +) : (VALUE)) + +static enum { + CACHE_CLEAN, + CACHE_DIRTY +} cache_state; +static uint64_t cached_block; +static uint8_t *cache = NULL; +static FILE *device = NULL; +static size_t block_size; + +static bool device_init(void) { + size_t guesses[] = { 512, 2048, 4096 }; + + for (size_t i = 0; i < SIZEOF_ARRAY(guesses); i++) { + void *tmp = realloc(cache, guesses[i]); + if (tmp == NULL) { + perror_wrap("error: device_init(): realloc()"); + return false; + } + cache = tmp; + + rewind(device); + + size_t ret = fread(cache, guesses[i], 1, device); + if (ret != 1) { + continue; + } + + block_size = guesses[i]; + + if (!quiet) { + fprintf(stderr, "Physical block size of %zu bytes.\n", block_size); + } + + cache_state = CACHE_CLEAN; + cached_block = 0; + return true; + } + + fprintf(stderr, "error: device_init(): Couldn't determine block size of device.\n"); + return false; +} + +static bool device_flush_cache(void) { + if (cache_state == CACHE_CLEAN) + return true; + + if (set_pos(device, cached_block * block_size) != 0) { + perror_wrap("error: device_flush_cache(): set_pos()"); + return false; + } + + size_t ret = fwrite(cache, block_size, 1, device); + if (ret != 1) { + if (ferror(device)) { + perror_wrap("error: device_flush_cache(): fwrite()"); + } + return false; + } + + cache_state = CACHE_CLEAN; + return true; +} + +static bool device_cache_block(uint64_t block) { + if (cached_block == block) + return true; + + if (cache_state == CACHE_DIRTY) { + if (!device_flush_cache()) + return false; + } + + if (set_pos(device, block * block_size) != 0) { + perror_wrap("error: device_cache_block(): set_pos()"); + return false; + } + + size_t ret = fread(cache, block_size, 1, device); + if (ret != 1) { + if (ferror(device)) { + perror_wrap("error: device_cache_block(): fread()"); + } + return false; + } + + cached_block = block; + + return true; +} + +struct uninstall_data { + void *data; + uint64_t loc; + uint64_t count; +}; + +#define UNINSTALL_DATA_MAX 256 + +static bool uninstalling = false; +static struct uninstall_data uninstall_data[UNINSTALL_DATA_MAX]; +static struct uninstall_data uninstall_data_rev[UNINSTALL_DATA_MAX]; +static uint64_t uninstall_data_i = 0; +static const char *uninstall_file = NULL; + +static void reverse_uninstall_data(void) { + for (size_t i = 0, j = uninstall_data_i - 1; i < uninstall_data_i; i++, j--) { + uninstall_data_rev[j] = uninstall_data[i]; + } + + memcpy(uninstall_data, uninstall_data_rev, uninstall_data_i * sizeof(struct uninstall_data)); +} + +static void free_uninstall_data(void) { + for (size_t i = 0; i < uninstall_data_i; i++) { + free(uninstall_data[i].data); + } +} + +static bool store_uninstall_data(const char *filename) { + if (!quiet) { + fprintf(stderr, "Storing uninstall data to file: `%s`...\n", filename); + } + + FILE *udfile = fopen(filename, "wb"); + if (udfile == NULL) { + perror_wrap("error: `%s`", filename); + goto error; + } + + if (fwrite(&uninstall_data_i, sizeof(uint64_t), 1, udfile) != 1) { + goto fwrite_error; + } + + for (size_t i = 0; i < uninstall_data_i; i++) { + if (fwrite(&uninstall_data[i].loc, sizeof(uint64_t), 1, udfile) != 1) { + goto fwrite_error; + } + if (fwrite(&uninstall_data[i].count, sizeof(uint64_t), 1, udfile) != 1) { + goto fwrite_error; + } + if (fwrite(uninstall_data[i].data, uninstall_data[i].count, 1, udfile) != 1) { + goto fwrite_error; + } + } + + fclose(udfile); + return true; + +fwrite_error: + perror_wrap("error: store_uninstall_data(): fwrite()"); + +error: + if (udfile != NULL) { + fclose(udfile); + } + return false; +} + +static bool load_uninstall_data(const char *filename) { + size_t loaded_count = 0; + + if (!quiet) { + fprintf(stderr, "Loading uninstall data from file: `%s`...\n", filename); + } + + FILE *udfile = fopen(filename, "rb"); + if (udfile == NULL) { + perror_wrap("error: `%s`", filename); + goto error; + } + + if (fread(&uninstall_data_i, sizeof(uint64_t), 1, udfile) != 1) { + goto fread_error; + } + + if (uninstall_data_i > UNINSTALL_DATA_MAX) { + fprintf(stderr, "error: load_uninstall_data(): too many entries (%zu > %d)\n", + (size_t)uninstall_data_i, UNINSTALL_DATA_MAX); + goto error; + } + + for (size_t i = 0; i < uninstall_data_i; i++) { + if (fread(&uninstall_data[i].loc, sizeof(uint64_t), 1, udfile) != 1) { + goto fread_error; + } + if (fread(&uninstall_data[i].count, sizeof(uint64_t), 1, udfile) != 1) { + goto fread_error; + } + uninstall_data[i].data = malloc(uninstall_data[i].count); + if (uninstall_data[i].data == NULL) { + perror_wrap("error: load_uninstall_data(): malloc()"); + goto error; + } + if (fread(uninstall_data[i].data, uninstall_data[i].count, 1, udfile) != 1) { + free(uninstall_data[i].data); + goto fread_error; + } + loaded_count++; + } + + fclose(udfile); + return true; + +fread_error: + perror_wrap("error: load_uninstall_data(): fread()"); + +error: + // Free any previously allocated uninstall data + for (size_t j = 0; j < loaded_count; j++) { + free(uninstall_data[j].data); + } + if (udfile != NULL) { + fclose(udfile); + } + return false; +} + +static bool _device_read(void *_buffer, uint64_t loc, size_t count) { + uint8_t *buffer = _buffer; + uint64_t progress = 0; + while (progress < count) { + uint64_t block = (loc + progress) / block_size; + + if (!device_cache_block(block)) { + return false; + } + + uint64_t chunk = count - progress; + uint64_t offset = (loc + progress) % block_size; + if (chunk > block_size - offset) + chunk = block_size - offset; + + memcpy(buffer + progress, &cache[offset], chunk); + progress += chunk; + } + + return true; +} + +static bool _device_write(const void *_buffer, uint64_t loc, size_t count) { + struct uninstall_data *ud = NULL; + + if (uninstalling) { + goto skip_save; + } + + if (uninstall_data_i >= UNINSTALL_DATA_MAX) { + fprintf(stderr, "error: Too many uninstall data entries! Please report this bug upstream.\n"); + return false; + } + + ud = &uninstall_data[uninstall_data_i]; + + ud->data = malloc(count); + if (ud->data == NULL) { + perror_wrap("error: _device_write(): malloc()"); + return false; + } + + if (!_device_read(ud->data, loc, count)) { + free(ud->data); + return false; + } + + ud->loc = loc; + ud->count = count; + +skip_save:; + const uint8_t *buffer = _buffer; + uint64_t progress = 0; + while (progress < count) { + uint64_t block = (loc + progress) / block_size; + + if (!device_cache_block(block)) { + if (!uninstalling) { + free(ud->data); + } + return false; + } + + uint64_t chunk = count - progress; + uint64_t offset = (loc + progress) % block_size; + if (chunk > block_size - offset) + chunk = block_size - offset; + + memcpy(&cache[offset], buffer + progress, chunk); + cache_state = CACHE_DIRTY; + progress += chunk; + } + + if (!uninstalling) { + uninstall_data_i++; + } + return true; +} + +static bool uninstall(bool quiet_arg) { + bool print_cache_flush_fail = false; + bool print_write_fail = false; + bool ret = true; + + uninstalling = true; + + cache_state = CACHE_CLEAN; + cached_block = (uint64_t)-1; + + for (size_t i = 0; i < uninstall_data_i; i++) { + struct uninstall_data *ud = &uninstall_data[i]; + bool retry = false; + while (!_device_write(ud->data, ud->loc, ud->count)) { + if (retry) { + fprintf(stderr, "warning: Retry failed.\n"); + print_write_fail = true; + break; + } + if (!quiet) { + fprintf(stderr, "warning: Uninstall data index %zu failed to write, retrying...\n", i); + } + if (!device_flush_cache()) { + print_cache_flush_fail = true; + } + cache_state = CACHE_CLEAN; + cached_block = (uint64_t)-1; + retry = true; + } + } + + if (!device_flush_cache()) { + print_cache_flush_fail = true; + } + + if (print_write_fail) { + fprintf(stderr, "error: Some data failed to be uninstalled correctly.\n"); + ret = false; + } + + if (print_cache_flush_fail) { + fprintf(stderr, "error: Device cache flush failure. Uninstall may be incomplete.\n"); + ret = false; + } + + if (ret == true && !quiet && !quiet_arg) { + fprintf(stderr, "Uninstall data restored successfully.\n"); + } + + return ret; +} + +#define device_read(BUFFER, LOC, COUNT) \ + do { \ + if (!_device_read(BUFFER, LOC, COUNT)) \ + goto cleanup; \ + } while (0) + +#define device_write(BUFFER, LOC, COUNT) \ + do { \ + if (!_device_write(BUFFER, LOC, COUNT)) \ + goto cleanup; \ + } while (0) + +static void bios_install_usage(void) { + printf("usage: %s bios-install [GPT partition index]\n", program_name); + printf("\n"); + printf(" --force Force installation even if the safety checks fail\n"); + printf(" (DANGEROUS!)\n"); + printf("\n"); + printf(" --uninstall Reverse the entire install procedure\n"); + printf("\n"); + printf(" --uninstall-data-file=\n"); + printf(" Set the input (for --uninstall) or output file\n"); + printf(" name of the file which contains uninstall data\n"); + printf("\n"); + printf(" --no-gpt-to-mbr-isohybrid-conversion\n"); + printf(" Do not automatically convert a GUID partition table (GPT)\n"); + printf(" found on an ISOHYBRID image into an MBR partition table\n"); + printf(" (which is done for better hardware compatibility)\n"); + printf("\n"); + printf(" --quiet Do not print verbose diagnostic messages\n"); + printf("\n"); + printf(" --help | -h Display this help message\n"); + printf("\n"); +} + +static bool validate_or_force(uint64_t offset, bool force, bool *err) { + *err = false; + + char hintc[64]; + device_read(hintc, offset + 3, 4); + if (memcmp(hintc, "NTFS", 4) == 0) { + if (!force) { + return false; + } else { + memset(hintc, 0, 4); + device_write(hintc, offset + 3, 4); + } + } + device_read(hintc, offset + 54, 3); + if (memcmp(hintc, "FAT", 3) == 0) { + if (!force) { + return false; + } else { + memset(hintc, 0, 5); + device_write(hintc, offset + 54, 5); + } + } + device_read(hintc, offset + 82, 3); + if (memcmp(hintc, "FAT", 3) == 0) { + if (!force) { + return false; + } else { + memset(hintc, 0, 5); + device_write(hintc, offset + 82, 5); + } + } + device_read(hintc, offset + 3, 5); + if (memcmp(hintc, "FAT32", 5) == 0) { + if (!force) { + return false; + } else { + memset(hintc, 0, 5); + device_write(hintc, offset + 3, 5); + } + } + uint16_t hint16 = 0; + device_read(&hint16, offset + 1080, sizeof(uint16_t)); + hint16 = ENDSWAP(hint16); + if (hint16 == 0xef53) { + if (!force) { + return false; + } else { + hint16 = 0; + hint16 = ENDSWAP(hint16); + device_write(&hint16, offset + 1080, sizeof(uint16_t)); + } + } + + return true; + +cleanup: + *err = true; + return false; +} + +static int bios_install(int argc, char *argv[]) { + int ok = EXIT_FAILURE; + bool force = false; + bool gpt2mbr_allowed = true; + bool uninstall_mode = false; + const uint8_t *bootloader_img = binary_limine_hdd_bin_data; + size_t bootloader_file_size = sizeof(binary_limine_hdd_bin_data); + uint8_t orig_mbr[70], timestamp[6]; + const char *part_ndx = NULL; + +#ifndef __BYTE_ORDER__ + uint32_t endcheck = 0x12345678; + uint8_t endbyte = *((uint8_t *)&endcheck); + bigendian = endbyte == 0x12; +#endif + + if (argc < 2) { + bios_install_usage(); +#ifdef IS_WINDOWS + system("pause"); +#endif + return EXIT_FAILURE; + } + + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) { + bios_install_usage(); + return EXIT_SUCCESS; + } else if (strcmp(argv[i], "--quiet") == 0) { + quiet = true; + } else if (strcmp(argv[i], "--force") == 0) { + if (force && !quiet) { + fprintf(stderr, "warning: --force already set.\n"); + } + force = true; + } else if (strcmp(argv[i], "--no-gpt-to-mbr-isohybrid-conversion") == 0) { + gpt2mbr_allowed = false; + } else if (strcmp(argv[i], "--uninstall") == 0) { + if (uninstall_mode && !quiet) { + fprintf(stderr, "warning: --uninstall already set.\n"); + } + uninstall_mode = true; + } else if (memcmp(argv[i], "--uninstall-data-file=", 22) == 0) { + if (uninstall_file != NULL && !quiet) { + fprintf(stderr, "warning: --uninstall-data-file already set. Overriding...\n"); + } + uninstall_file = argv[i] + 22; + if (strlen(uninstall_file) == 0) { + fprintf(stderr, "error: Uninstall data file has a zero-length name!\n"); + return EXIT_FAILURE; + } + } else { + if (device != NULL) { // [GPT partition index] + part_ndx = argv[i]; // TODO: Make this non-positional? + } else if ((device = fopen(argv[i], "r+b")) == NULL) { // + perror_wrap("error: `%s`", argv[i]); + return EXIT_FAILURE; + } + } + } + + if (device == NULL) { + fprintf(stderr, "error: No device specified\n"); + bios_install_usage(); + return EXIT_FAILURE; + } + + if (!device_init()) { + goto uninstall_mode_cleanup; + } + + if (uninstall_mode) { + if (uninstall_file == NULL) { + fprintf(stderr, "error: Uninstall mode set but no --uninstall-data-file=... passed.\n"); + goto uninstall_mode_cleanup; + } + + if (!load_uninstall_data(uninstall_file)) { + goto uninstall_mode_cleanup; + } + + if (uninstall(false) == false) { + ok = EXIT_FAILURE; + } else { + ok = EXIT_SUCCESS; + } + goto uninstall_mode_cleanup; + } + + // Probe for GPT and logical block size + int gpt = 0; + struct gpt_table_header gpt_header; + uint64_t lb_guesses[] = { 512, 4096 }; + uint64_t lb_size = 0; + for (size_t i = 0; i < SIZEOF_ARRAY(lb_guesses); i++) { + device_read(&gpt_header, lb_guesses[i], sizeof(struct gpt_table_header)); + if (!strncmp(gpt_header.signature, "EFI PART", 8)) { + lb_size = lb_guesses[i]; + gpt = 1; + if (!quiet) { + fprintf(stderr, "Installing to GPT. Logical block size of %" PRIu64 " bytes.\n", + lb_guesses[i]); + } + break; + } + } + + struct gpt_table_header secondary_gpt_header; + if (gpt) { + if (!quiet) { + fprintf(stderr, "Secondary header at LBA 0x%" PRIx64 ".\n", + ENDSWAP(gpt_header.alternate_lba)); + } + device_read(&secondary_gpt_header, lb_size * ENDSWAP(gpt_header.alternate_lba), + sizeof(struct gpt_table_header)); + if (!strncmp(secondary_gpt_header.signature, "EFI PART", 8)) { + if (!quiet) { + fprintf(stderr, "Secondary header valid.\n"); + } + } else { + fprintf(stderr, "error: Secondary header not valid, aborting.\n"); + goto cleanup; + } + } + + // Check if this is an ISO w/ a GPT, in which case try converting it + // to MBR for improved compatibility with a whole range of hardware that + // does not like booting off of GPT in BIOS or CSM mode, and other + // broken hardware. + if (gpt && gpt2mbr_allowed == true) { + char iso_signature[5]; + device_read(iso_signature, 32769, 5); + + if (strncmp(iso_signature, "CD001", 5) != 0) { + goto no_mbr_conv; + } + + if (!quiet) { + fprintf(stderr, "Detected ISOHYBRID with a GUID partition table (GPT).\n"); + fprintf(stderr, "Converting to MBR for improved compatibility...\n"); + } + + // Gather the (up to 4) GPT partition to convert. + struct { + uint64_t lba_start; + uint64_t lba_end; + uint8_t chs_start[3]; + uint8_t chs_end[3]; + uint8_t type; + } part_to_conv[4]; + size_t part_to_conv_i = 0; + + uint64_t part_entry_base; + if (mul_u64_overflow(ENDSWAP(gpt_header.partition_entry_lba), lb_size, &part_entry_base)) { + goto no_mbr_conv; + } + + for (int64_t i = 0; i < (int64_t)ENDSWAP(gpt_header.number_of_partition_entries); i++) { + struct gpt_entry gpt_entry; + uint64_t entry_offset = (uint64_t)i * ENDSWAP(gpt_header.size_of_partition_entry); + if (add_u64_overflow(part_entry_base, entry_offset, &entry_offset)) { + goto no_mbr_conv; + } + device_read(&gpt_entry, entry_offset, sizeof(struct gpt_entry)); + + if (gpt_entry.unique_partition_guid[0] == 0 && + gpt_entry.unique_partition_guid[1] == 0) { + continue; + } + + if (part_to_conv_i == 4) { + if (!quiet) { + fprintf(stderr, "GPT contains more than 4 partitions, will not convert.\n"); + } + goto no_mbr_conv; + } + + if (ENDSWAP(gpt_entry.starting_lba) > UINT32_MAX) { + if (!quiet) { + fprintf(stderr, "Starting LBA of partition %" PRIi64 " is greater than UINT32_MAX, will not convert GPT.\n", i + 1); + } + goto no_mbr_conv; + } + part_to_conv[part_to_conv_i].lba_start = ENDSWAP(gpt_entry.starting_lba); + lba2chs(part_to_conv[part_to_conv_i].chs_start, part_to_conv[part_to_conv_i].lba_start); + + if (ENDSWAP(gpt_entry.ending_lba) > UINT32_MAX) { + if (!quiet) { + fprintf(stderr, "Ending LBA of partition %" PRIi64 " is greater than UINT32_MAX, will not convert GPT.\n", i + 1); + } + goto no_mbr_conv; + } + part_to_conv[part_to_conv_i].lba_end = ENDSWAP(gpt_entry.ending_lba); + lba2chs(part_to_conv[part_to_conv_i].chs_end, part_to_conv[part_to_conv_i].lba_end); + + if (part_to_conv[part_to_conv_i].lba_end - part_to_conv[part_to_conv_i].lba_start + 1 > UINT32_MAX) { + if (!quiet) { + fprintf(stderr, "Sector count of partition %" PRIi64 " is greater than UINT32_MAX, will not convert GPT.\n", i + 1); + } + goto no_mbr_conv; + } + + int type = gpt2mbr_type(ENDSWAP(gpt_entry.partition_type_guid[0]), + ENDSWAP(gpt_entry.partition_type_guid[1])); + if (type == -1) { + if (!quiet) { + fprintf(stderr, "Cannot convert partition type for partition %" PRIi64 ", will not convert GPT.\n", i + 1); + } + goto no_mbr_conv; + } + + part_to_conv[part_to_conv_i].type = type; + + part_to_conv_i++; + } + + // Nuke the GPTs. + void *empty_lba = calloc(1, lb_size); + if (empty_lba == NULL) { + perror_wrap("error: bios_install(): malloc()"); + goto cleanup; + } + + // ... nuke primary GPT + protective MBR. + for (size_t i = 0; i < 34; i++) { + device_write(empty_lba, i * lb_size, lb_size); + } + + // ... nuke secondary GPT. + uint64_t alt_lba = ENDSWAP(gpt_header.alternate_lba); + if (alt_lba >= 32) { + for (size_t i = 0; i < 33; i++) { + device_write(empty_lba, (alt_lba - 32 + i) * lb_size, lb_size); + } + } + + free(empty_lba); + + // We're no longer GPT. + gpt = 0; + + // Generate pseudorandom MBR disk ID. + srand(time(NULL)); + for (size_t i = 0; i < 4; i++) { + uint8_t r = rand(); + device_write(&r, 0x1b8 + i, 1); + } + + // Write out the partition entries. + for (size_t i = 0; i < part_to_conv_i; i++) { + device_write(&part_to_conv[i].type, 0x1be + i * 16 + 0x04, 1); + uint32_t lba_start = ENDSWAP((uint32_t)part_to_conv[i].lba_start); + device_write(&lba_start, 0x1be + i * 16 + 0x08, 4); + uint32_t sect_count = ENDSWAP((uint32_t)((part_to_conv[i].lba_end - part_to_conv[i].lba_start) + 1)); + device_write(§_count, 0x1be + i * 16 + 0x0c, 4); + + device_write(part_to_conv[i].chs_start, 0x1be + i * 16 + 1, 3); + device_write(part_to_conv[i].chs_end, 0x1be + i * 16 + 5, 3); + } + + if (!quiet) { + fprintf(stderr, "Conversion successful.\n"); + } + } + +no_mbr_conv:; + + int mbr = 0; + if (gpt == 0) { + // Do all sanity checks on MBR + mbr = 1; + + uint8_t hint8 = 0; + uint32_t hint32 = 0; + + bool any_active = false; + + device_read(&hint8, 446, sizeof(uint8_t)); + if (hint8 != 0x00 && hint8 != 0x80) { + if (!force) { + mbr = 0; + } else { + hint8 &= 0x80; + device_write(&hint8, 446, sizeof(uint8_t)); + } + } + any_active = any_active || (hint8 & 0x80) != 0; + device_read(&hint8, 446 + 4, sizeof(uint8_t)); + if (hint8 != 0x00) { + device_read(&hint32, 446 + 8, sizeof(uint32_t)); + hint32 = ENDSWAP(hint32); + if (hint32 < 63) { + goto part_too_low; + } + } + device_read(&hint8, 462, sizeof(uint8_t)); + if (hint8 != 0x00 && hint8 != 0x80) { + if (!force) { + mbr = 0; + } else { + hint8 &= 0x80; + device_write(&hint8, 462, sizeof(uint8_t)); + } + } + any_active = any_active || (hint8 & 0x80) != 0; + device_read(&hint8, 462 + 4, sizeof(uint8_t)); + if (hint8 != 0x00) { + device_read(&hint32, 462 + 8, sizeof(uint32_t)); + hint32 = ENDSWAP(hint32); + if (hint32 < 63) { + goto part_too_low; + } + } + device_read(&hint8, 478, sizeof(uint8_t)); + if (hint8 != 0x00 && hint8 != 0x80) { + if (!force) { + mbr = 0; + } else { + hint8 &= 0x80; + device_write(&hint8, 478, sizeof(uint8_t)); + } + } + any_active = any_active || (hint8 & 0x80) != 0; + device_read(&hint8, 478 + 4, sizeof(uint8_t)); + if (hint8 != 0x00) { + device_read(&hint32, 478 + 8, sizeof(uint32_t)); + hint32 = ENDSWAP(hint32); + if (hint32 < 63) { + goto part_too_low; + } + } + device_read(&hint8, 494, sizeof(uint8_t)); + if (hint8 != 0x00 && hint8 != 0x80) { + if (!force) { + mbr = 0; + } else { + hint8 &= 0x80; + device_write(&hint8, 494, sizeof(uint8_t)); + } + } + any_active = any_active || (hint8 & 0x80) != 0; + device_read(&hint8, 494 + 4, sizeof(uint8_t)); + if (hint8 != 0x00) { + device_read(&hint32, 494 + 8, sizeof(uint32_t)); + hint32 = ENDSWAP(hint32); + if (hint32 < 63) { + goto part_too_low; + } + } + + if (0) { +part_too_low: + fprintf(stderr, "error: A partition's start sector is less than 63, aborting.\n"); + goto cleanup; + } + + if (mbr) { + bool err; + mbr = validate_or_force(0, force, &err); + if (err) { + goto cleanup; + } + } + + if (mbr && !any_active) { + if (!quiet) { + fprintf(stderr, "No active partition found, some systems may not boot.\n"); + fprintf(stderr, "Setting partition 1 as active to work around the issue...\n"); + } + hint8 = 0x80; + device_write(&hint8, 446, sizeof(uint8_t)); + } + } + + if (gpt == 0 && mbr == 0) { + fprintf(stderr, "error: Could not determine if the device has a valid partition table.\n"); + fprintf(stderr, " Please ensure the device has a valid MBR or GPT.\n"); + fprintf(stderr, " Alternatively, pass `--force` to override these checks.\n"); + fprintf(stderr, " **ONLY DO THIS AT YOUR OWN RISK, DATA LOSS MAY OCCUR!**\n"); + goto cleanup; + } + + // Default location of stage2 for MBR (in post MBR gap) + uint64_t stage2_loc = 512; + + if (gpt) { + struct gpt_entry gpt_entry; + uint32_t partition_num; + + uint64_t gpt_part_entry_base; + if (mul_u64_overflow(ENDSWAP(gpt_header.partition_entry_lba), lb_size, &gpt_part_entry_base)) { + fprintf(stderr, "error: GPT partition entry LBA overflows.\n"); + goto cleanup; + } + + if (part_ndx != NULL) { + if (sscanf(part_ndx, "%" SCNu32, &partition_num) != 1) { + fprintf(stderr, "error: Invalid partition number format.\n"); + goto cleanup; + } + partition_num--; + if (partition_num >= ENDSWAP(gpt_header.number_of_partition_entries)) { + fprintf(stderr, "error: Partition number is too large.\n"); + goto cleanup; + } + + uint64_t entry_off = (uint64_t)partition_num * ENDSWAP(gpt_header.size_of_partition_entry); + if (add_u64_overflow(gpt_part_entry_base, entry_off, &entry_off)) { + fprintf(stderr, "error: GPT partition entry offset overflows.\n"); + goto cleanup; + } + device_read(&gpt_entry, entry_off, sizeof(struct gpt_entry)); + + if (gpt_entry.unique_partition_guid[0] == 0 && + gpt_entry.unique_partition_guid[1] == 0) { + fprintf(stderr, "error: No such partition: %" PRIu32 ".\n", partition_num + 1); + goto cleanup; + } + + if (!force && memcmp("Hah!IdontNeedEFI", &gpt_entry.partition_type_guid, 16) != 0) { + fprintf(stderr, "error: Chosen partition for BIOS boot code is not of BIOS boot partition type.\n"); + fprintf(stderr, " Pass `--force` to override this check.\n"); + fprintf(stderr, " **ONLY DO THIS AT YOUR OWN RISK, DATA LOSS MAY OCCUR!**\n"); + goto cleanup; + } + } else { + // Try to autodetect the BIOS boot partition + for (partition_num = 0; partition_num < ENDSWAP(gpt_header.number_of_partition_entries); partition_num++) { + uint64_t entry_off = (uint64_t)partition_num * ENDSWAP(gpt_header.size_of_partition_entry); + if (add_u64_overflow(gpt_part_entry_base, entry_off, &entry_off)) { + fprintf(stderr, "error: GPT partition entry offset overflows.\n"); + goto cleanup; + } + device_read(&gpt_entry, entry_off, sizeof(struct gpt_entry)); + + if (memcmp("Hah!IdontNeedEFI", &gpt_entry.partition_type_guid, 16) == 0) { + if (!quiet) { + fprintf(stderr, "Autodetected partition %" PRIu32 " as BIOS boot partition.\n", partition_num + 1); + } + goto bios_boot_autodetected; + } + } + + fprintf(stderr, "error: Installing to a GPT device, but no BIOS boot partition specified or\n"); + fprintf(stderr, " detected.\n"); + goto cleanup; + } + +bios_boot_autodetected:; + uint64_t starting_lba = ENDSWAP(gpt_entry.starting_lba); + uint64_t ending_lba = ENDSWAP(gpt_entry.ending_lba); + + if (ending_lba < starting_lba) { + fprintf(stderr, "error: Partition %" PRIu32 " has ending LBA less than starting LBA.\n", partition_num + 1); + goto cleanup; + } + + uint64_t part_size; + if (mul_u64_overflow(ending_lba - starting_lba + 1, lb_size, &part_size)) { + fprintf(stderr, "error: Partition %" PRIu32 " size overflows.\n", partition_num + 1); + goto cleanup; + } + + if (part_size < 32768) { + fprintf(stderr, "error: Partition %" PRIu32 " is smaller than 32KiB.\n", partition_num + 1); + goto cleanup; + } + + if (mul_u64_overflow(starting_lba, lb_size, &stage2_loc)) { + fprintf(stderr, "error: Partition %" PRIu32 " starting LBA overflows.\n", partition_num + 1); + goto cleanup; + } + + bool err; + bool valid = validate_or_force(stage2_loc, force, &err); + if (err) { + goto cleanup; + } + + if (!valid) { + fprintf(stderr, "error: The partition selected to install the BIOS boot code to contains\n"); + fprintf(stderr, " a recognised filesystem.\n"); + fprintf(stderr, " Pass `--force` to override these checks.\n"); + fprintf(stderr, " **ONLY DO THIS AT YOUR OWN RISK, DATA LOSS MAY OCCUR!**\n"); + goto cleanup; + } + + if (!quiet) { + fprintf(stderr, "Installing BIOS boot code to partition %" PRIu32 ".\n", partition_num + 1); + } + } else { + if (!quiet) { + fprintf(stderr, "Installing to MBR.\n"); + } + } + + if (!quiet) { + fprintf(stderr, "Stage 2 to be located at byte offset 0x%" PRIx64 ".\n", stage2_loc); + } + + // Save original timestamp + device_read(timestamp, 218, 6); + + // Save the original partition table of the device + device_read(orig_mbr, 440, 70); + + // Write the bootsector from the bootloader to the device + device_write(&bootloader_img[0], 0, 512); + + // Write the rest of stage 2 to the device + device_write(&bootloader_img[512], stage2_loc, bootloader_file_size - 512); + + // Hardcode in the bootsector the location of stage 2 + stage2_loc = ENDSWAP(stage2_loc); + device_write(&stage2_loc, 0x1a4, sizeof(uint64_t)); + + // Write back timestamp + device_write(timestamp, 218, 6); + + // Write back the saved partition table to the device + device_write(orig_mbr, 440, 70); + + if (!device_flush_cache()) + goto cleanup; + + if (!quiet) { + fprintf(stderr, "Reminder: Remember to copy the limine-bios.sys file in either\n" + " the root, /boot, /limine, or /boot/limine directories of\n" + " one of the partitions on the device, or boot will fail!\n"); + + fprintf(stderr, "ZOVboot BIOS stages installed successfully.\n"); + } + + ok = EXIT_SUCCESS; + +cleanup: + reverse_uninstall_data(); + if (ok != EXIT_SUCCESS) { + // If we failed, attempt to reverse install process + fprintf(stderr, "Install failed, undoing work...\n"); + uninstall(true); + } else if (uninstall_file != NULL) { + store_uninstall_data(uninstall_file); + } +uninstall_mode_cleanup: + free_uninstall_data(); + if (cache) + free(cache); + if (device != NULL) + fclose(device); + + return ok; +} +#endif + +#define CONFIG_B2SUM_SIGNATURE "++CONFIG_B2SUM_SIGNATURE++" + +static void enroll_config_usage(void) { + printf("usage: %s enroll-config \n", program_name); + printf("\n"); + printf(" --reset Remove enrolled BLAKE2B, will not check config integrity\n"); + printf("\n"); + printf(" --quiet Do not print verbose diagnostic messages\n"); + printf("\n"); + printf(" --help | -h Display this help message\n"); + printf("\n"); +} + +static int enroll_config(int argc, char *argv[]) { + int ret = EXIT_FAILURE; + + char *bootloader = NULL; + FILE *bootloader_file = NULL; + bool quiet = false; + bool reset = false; + + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) { + enroll_config_usage(); + return EXIT_SUCCESS; + } else if (strcmp(argv[i], "--quiet") == 0) { + remove_arg(&argc, argv, i--); + quiet = true; + } else if (strcmp(argv[i], "--reset") == 0) { + remove_arg(&argc, argv, i--); + reset = true; + } + } + + if (argc <= (reset ? 1 : 2)) { + enroll_config_usage(); +#ifdef IS_WINDOWS + system("pause"); +#endif + return EXIT_FAILURE; + } + + if (!reset && strlen(argv[2]) != 128) { + fprintf(stderr, "error: BLAKE2B specified is not 128 characters long.\n"); + goto cleanup; + } + + bootloader_file = fopen(argv[1], "r+b"); + if (bootloader_file == NULL) { + perror_wrap("error: `%s`", argv[1]); + goto cleanup; + } + + if (fseek(bootloader_file, 0, SEEK_END) != 0) { + perror_wrap("error: enroll_config(): fseek()"); + goto cleanup; + } + long ftell_result = ftell(bootloader_file); + if (ftell_result < 0) { + perror_wrap("error: enroll_config(): ftell()"); + goto cleanup; + } + size_t bootloader_size = (size_t)ftell_result; + rewind(bootloader_file); + + size_t min_size = (sizeof(CONFIG_B2SUM_SIGNATURE) - 1) + 128; + if (bootloader_size < min_size) { + fprintf(stderr, "error: Bootloader file too small (need at least %zu bytes)\n", min_size); + goto cleanup; + } + + bootloader = malloc(bootloader_size); + if (bootloader == NULL) { + perror_wrap("error: enroll_config(): malloc()"); + goto cleanup; + } + + if (fread(bootloader, bootloader_size, 1, bootloader_file) != 1) { + perror_wrap("error: enroll_config(): fread()"); + goto cleanup; + } + + char *checksum_loc = NULL; + size_t checked_count = 0; + const char *config_b2sum_sign = CONFIG_B2SUM_SIGNATURE; + for (size_t i = 0; i < bootloader_size - min_size + 1; i++) { + if (bootloader[i] != config_b2sum_sign[checked_count]) { + if (checked_count > 0) { + i -= checked_count; // restart after first byte of failed match + checked_count = 0; + } + continue; + } + + checked_count++; + + if (checked_count == sizeof(CONFIG_B2SUM_SIGNATURE) - 1) { + checksum_loc = &bootloader[i + 1]; + break; + } + } + + if (checksum_loc == NULL) { + fprintf(stderr, "error: Checksum location not found in provided executable.\n"); + goto cleanup; + } + + if (!reset) { + memcpy(checksum_loc, argv[2], 128); + } else { + memset(checksum_loc, '0', 128); + } + + if (fseek(bootloader_file, 0, SEEK_SET) != 0) { + perror_wrap("error: enroll_config(): fseek()"); + goto cleanup; + } + if (fwrite(bootloader, bootloader_size, 1, bootloader_file) != 1) { + perror_wrap("error: enroll_config(): fwrite()"); + goto cleanup; + } + + if (!quiet) { + fprintf(stderr, "Config file BLAKE2B successfully %s.\n", reset ? "reset" : "enrolled"); + } + ret = EXIT_SUCCESS; + +cleanup: + if (bootloader != NULL) { + free(bootloader); + } + if (bootloader_file != NULL) { + fclose(bootloader_file); + } + return ret; +} + +#define LIMINE_VERSION "UNVERSIONED" +#define LIMINE_COPYRIGHT "Copyright (C) 2019-2026 Mintsuki and contributors." + +static void version_usage(void) { + printf("usage: %s version [options...]\n", program_name); + printf("\n"); + printf(" --version-only Only print the version number without licensing info\n"); + printf(" and other distractions\n"); + printf("\n"); + printf(" --help | -h Display this help message\n"); + printf("\n"); +} + +static int version(int argc, char *argv[]) { + if (argc >= 2) { + if (strcmp(argv[1], "--help") == 0) { + version_usage(); + return EXIT_SUCCESS; + } else if (strcmp(argv[1], "--version-only") == 0) { + puts(LIMINE_VERSION); + return EXIT_SUCCESS; + } + } + + puts("ZOVboot " LIMINE_VERSION); + puts(LIMINE_COPYRIGHT); + puts("ZOVboot is distributed under the terms of the BSD-2-Clause license."); + puts("There is ABSOLUTELY NO WARRANTY, to the extent permitted by law."); + return EXIT_SUCCESS; +} + +static void general_usage(void) { + printf("usage: %s \n", program_name); + printf("\n"); + printf(" --print-datadir Print the directory containing the bootloader files\n"); + printf("\n"); + printf(" --version Print the ZOVboot version (like the `version` command)\n"); + printf("\n"); + printf(" --help | -h Display this help message\n"); + printf("\n"); + printf("Commands: `help`, `version`, `bios-install`, `enroll-config`\n"); + printf("Use `--help` after specifying the command for command-specific help.\n"); +} + +static int print_datadir(void) { +#ifdef LIMINE_DATADIR + puts(LIMINE_DATADIR); + return EXIT_SUCCESS; +#else + fprintf(stderr, "error: Cannot print datadir for standalone ZOVboot.\n"); + return EXIT_FAILURE; +#endif +} + +int main(int argc, char *argv[]) { + program_name = argv[0]; + + if (argc <= 1) { + general_usage(); + return EXIT_FAILURE; + } + + if (strcmp(argv[1], "help") == 0 + || strcmp(argv[1], "--help") == 0 + || strcmp(argv[1], "-h") == 0) { + general_usage(); + return EXIT_SUCCESS; + } else if (strcmp(argv[1], "bios-install") == 0) { +#ifndef LIMINE_NO_BIOS + return bios_install(argc - 1, &argv[1]); +#else + fprintf(stderr, "error: ZOVboot has been compiled without BIOS support.\n"); + return EXIT_FAILURE; +#endif + } else if (strcmp(argv[1], "enroll-config") == 0) { + return enroll_config(argc - 1, &argv[1]); + } else if (strcmp(argv[1], "--print-datadir") == 0) { + return print_datadir(); + } else if (strcmp(argv[1], "version") == 0 + || strcmp(argv[1], "--version") == 0) { + return version(argc - 1, &argv[1]); + } + + general_usage(); + return EXIT_FAILURE; +} diff --git a/limine/build-host/config.h b/limine/build-host/config.h new file mode 100644 index 0000000..43d2179 --- /dev/null +++ b/limine/build-host/config.h @@ -0,0 +1,7 @@ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#define LIMINE_VERSION "UNVERSIONED" +#define LIMINE_COPYRIGHT "Copyright (C) 2019-2026 Mintsuki and contributors." + +#endif diff --git a/limine/build-host/config.log b/limine/build-host/config.log new file mode 100644 index 0000000..eec1b82 --- /dev/null +++ b/limine/build-host/config.log @@ -0,0 +1,462 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by ZOVboot configure UNVERSIONED, which was +generated by GNU Autoconf 2.72. Invocation command line was + + $ ../configure LD_FOR_TARGET=ld OBJCOPY_FOR_TARGET=objcopy OBJDUMP_FOR_TARGET=objdump READELF_FOR_TARGET=readelf + +## --------- ## +## Platform. ## +## --------- ## + +hostname = archlinux +uname -m = x86_64 +uname -r = 6.19.6-arch1-1 +uname -s = Linux +uname -v = #1 SMP PREEMPT_DYNAMIC Wed, 04 Mar 2026 18:25:08 +0000 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = unknown +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /tmp/fakebin/ +PATH: /home/wpng1337/.codex/tmp/arg0/codex-arg0tf5Bxj/ +PATH: /usr/local/sbin/ +PATH: /usr/local/bin/ +PATH: /usr/bin/ +PATH: /var/lib/flatpak/exports/bin/ +PATH: /usr/bin/site_perl/ +PATH: /usr/bin/vendor_perl/ +PATH: /usr/bin/core_perl/ +PATH: /home/wpng1337/.vscode-oss/extensions/openai.chatgpt-26.311.21342-linux-x64/bin/linux-x86_64/ + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:2243: looking for aux files: install-sh config.guess config.sub +configure:2256: trying ../build-aux/ +configure:2267: ../build-aux/install-sh found +configure:2285: ../build-aux/config.guess found +configure:2285: ../build-aux/config.sub found +configure:2421: checking build system type +configure:2437: result: x86_64-pc-linux-gnu +configure:2457: checking host system type +configure:2472: result: x86_64-pc-linux-gnu +configure:2592: checking for gcc +configure:2613: found /usr/bin/gcc +configure:2625: result: gcc +configure:2984: checking for C compiler version +configure:2993: gcc --version >&5 +gcc (GCC) 15.2.1 20260209 +Copyright (C) 2025 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:3004: $? = 0 +configure:2993: gcc -v >&5 +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/15.2.1/lto-wrapper +Target: x86_64-pc-linux-gnu +Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 15.2.1 20260209 (GCC) +configure:3004: $? = 0 +configure:2993: gcc -V >&5 +gcc: error: unrecognized command-line option '-V' +gcc: fatal error: no input files +compilation terminated. +configure:3004: $? = 1 +configure:2993: gcc -qversion >&5 +gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'? +gcc: fatal error: no input files +compilation terminated. +configure:3004: $? = 1 +configure:2993: gcc -version >&5 +gcc: error: unrecognized command-line option '-version' +gcc: fatal error: no input files +compilation terminated. +configure:3004: $? = 1 +configure:3024: checking whether the C compiler works +configure:3046: gcc -g -O2 -pipe conftest.c >&5 +configure:3050: $? = 0 +configure:3101: result: yes +configure:3105: checking for C compiler default output file name +configure:3107: result: a.out +configure:3113: checking for suffix of executables +configure:3120: gcc -o conftest -g -O2 -pipe conftest.c >&5 +configure:3124: $? = 0 +configure:3148: result: +configure:3172: checking whether we are cross compiling +configure:3180: gcc -o conftest -g -O2 -pipe conftest.c >&5 +configure:3184: $? = 0 +configure:3191: ./conftest +configure:3195: $? = 0 +configure:3210: result: no +configure:3216: checking for suffix of object files +configure:3239: gcc -c -g -O2 -pipe conftest.c >&5 +configure:3243: $? = 0 +configure:3267: result: o +configure:3271: checking whether the compiler supports GNU C +configure:3291: gcc -c -g -O2 -pipe conftest.c >&5 +configure:3291: $? = 0 +configure:3303: result: yes +configure:3314: checking whether gcc accepts -g +configure:3335: gcc -c -g conftest.c >&5 +configure:3335: $? = 0 +configure:3382: result: yes +configure:3402: checking for gcc option to enable C11 features +configure:3417: gcc -c -g -O2 -pipe conftest.c >&5 +configure:3417: $? = 0 +configure:3436: result: none needed +configure:3572: checking for a race-free mkdir -p +configure:3615: result: /usr/bin/mkdir -p +configure:3634: checking for a BSD-compatible install +configure:3708: result: /usr/bin/install -c +configure:3720: checking for a sed that does not truncate output +configure:3792: result: /usr/bin/sed +configure:3798: checking for grep that handles long lines and -e +configure:3864: result: /usr/bin/grep +configure:3874: checking for gawk +configure:3895: found /usr/bin/gawk +configure:3907: result: gawk +configure:3922: checking for find +configure:3943: found /usr/bin/find +configure:3955: result: yes +configure:4085: checking for strip +configure:4106: found /usr/bin/strip +configure:4118: result: strip +configure:4213: checking for stdio.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for stdlib.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for string.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for inttypes.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for stdint.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for strings.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for sys/stat.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for sys/types.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for unistd.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4241: checking for stdio.h +configure:4241: result: yes +configure:4241: checking for stdlib.h +configure:4241: result: yes +configure:4241: checking for stdint.h +configure:4241: result: yes +configure:4241: checking for stddef.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for stdbool.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for stdarg.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for string.h +configure:4241: result: yes +configure:4241: checking for errno.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for inttypes.h +configure:4241: result: yes +configure:4241: checking for limits.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for time.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4302: checking for clang +configure:4323: found /usr/bin/clang +configure:4335: result: yes +configure:4538: checking for ld +configure:4559: found /usr/bin/ld +configure:4571: result: yes +configure:4774: checking for objcopy +configure:4795: found /usr/bin/objcopy +configure:4807: result: yes +configure:5010: checking for objdump +configure:5031: found /usr/bin/objdump +configure:5043: result: yes +configure:5246: checking for readelf +configure:5267: found /usr/bin/readelf +configure:5279: result: yes +configure:5949: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ZOVboot config.status UNVERSIONED, which was +generated by GNU Autoconf 2.72. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on archlinux + +config.status:777: creating man/man1/limine.1 +config.status:777: creating GNUmakefile +config.status:777: creating config.h + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_build=x86_64-pc-linux-gnu +ac_cv_c_compiler_gnu=yes +ac_cv_env_CC_FOR_TARGET_set= +ac_cv_env_CC_FOR_TARGET_value= +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_FOR_TARGET_set= +ac_cv_env_CFLAGS_FOR_TARGET_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_FOR_TARGET_set= +ac_cv_env_CPPFLAGS_FOR_TARGET_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_LDFLAGS_FOR_TARGET_set= +ac_cv_env_LDFLAGS_FOR_TARGET_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_LD_FOR_TARGET_set=set +ac_cv_env_LD_FOR_TARGET_value=ld +ac_cv_env_LIBS_set= +ac_cv_env_LIBS_value= +ac_cv_env_NASMFLAGS_FOR_TARGET_set= +ac_cv_env_NASMFLAGS_FOR_TARGET_value= +ac_cv_env_OBJCOPY_FOR_TARGET_set=set +ac_cv_env_OBJCOPY_FOR_TARGET_value=objcopy +ac_cv_env_OBJDUMP_FOR_TARGET_set=set +ac_cv_env_OBJDUMP_FOR_TARGET_value=objdump +ac_cv_env_READELF_FOR_TARGET_set=set +ac_cv_env_READELF_FOR_TARGET_value=readelf +ac_cv_env_STRIP_set= +ac_cv_env_STRIP_value= +ac_cv_env_TOOLCHAIN_FOR_TARGET_set= +ac_cv_env_TOOLCHAIN_FOR_TARGET_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_header_errno_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_limits_h=yes +ac_cv_header_stdarg_h=yes +ac_cv_header_stdbool_h=yes +ac_cv_header_stddef_h=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdio_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_time_h=yes +ac_cv_header_unistd_h=yes +ac_cv_host=x86_64-pc-linux-gnu +ac_cv_objext=o +ac_cv_path_GREP=/usr/bin/grep +ac_cv_path_SED=/usr/bin/sed +ac_cv_path_install='/usr/bin/install -c' +ac_cv_path_mkdir=/usr/bin/mkdir +ac_cv_prog_AWK=gawk +ac_cv_prog_CC_FOR_TARGET_FOUND=yes +ac_cv_prog_FIND_FOUND=yes +ac_cv_prog_LD_FOR_TARGET_FOUND=yes +ac_cv_prog_OBJCOPY_FOR_TARGET_FOUND=yes +ac_cv_prog_OBJDUMP_FOR_TARGET_FOUND=yes +ac_cv_prog_READELF_FOR_TARGET_FOUND=yes +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_STRIP_FOUND=strip +ac_cv_prog_cc_c11= +ac_cv_prog_cc_g=yes +ac_cv_prog_cc_stdc= + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +AWK='gawk' +BUILDDIR='/home/wpng1337/Zovboot/ZOVboot/limine/build-host' +BUILD_BIOS='' +BUILD_BIOS_CD='no' +BUILD_BIOS_PXE='no' +BUILD_UEFI_AARCH64='' +BUILD_UEFI_CD='no' +BUILD_UEFI_IA32='' +BUILD_UEFI_LOONGARCH64='' +BUILD_UEFI_RISCV64='' +BUILD_UEFI_X86_64='' +CC='gcc' +CC_FOR_TARGET='clang' +CC_FOR_TARGET_FOUND='yes' +CFLAGS='-g -O2 -pipe' +CFLAGS_FOR_TARGET=' -g -O2 -pipe' +CPPFLAGS='' +CPPFLAGS_FOR_TARGET='' +DEFS='-DPACKAGE_NAME=\"ZOVboot\" -DPACKAGE_TARNAME=\"zovboot\" -DPACKAGE_VERSION=\"UNVERSIONED\" -DPACKAGE_STRING=\"ZOVboot\ UNVERSIONED\" -DPACKAGE_BUGREPORT=\"https://git.bebrik.xyz/Zhirik1337/ZOVboot\" -DPACKAGE_URL=\"https://git.bebrik.xyz/Zhirik1337/ZOVboot\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STDBOOL_H=1 -DHAVE_STDARG_H=1 -DHAVE_STRING_H=1 -DHAVE_ERRNO_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_TIME_H=1' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EXEEXT='' +FIND_FOUND='yes' +GREP='/usr/bin/grep' +GZIP_FOUND='' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +LDFLAGS='' +LDFLAGS_FOR_TARGET='' +LD_FOR_TARGET='ld' +LD_FOR_TARGET_FOUND='yes' +LIBOBJS='' +LIBS='' +LIMINE_COPYRIGHT='Copyright (C) 2019-2026 Mintsuki and contributors.' +LTLIBOBJS='' +MKDIR_P='/usr/bin/mkdir -p' +MTOOLS_FOUND='' +NASMFLAGS_FOR_TARGET='-g' +NASM_FOUND='' +OBJCOPY_FOR_TARGET='objcopy' +OBJCOPY_FOR_TARGET_FOUND='yes' +OBJDUMP_FOR_TARGET='objdump' +OBJDUMP_FOR_TARGET_FOUND='yes' +OBJEXT='o' +PACKAGE_BUGREPORT='https://git.bebrik.xyz/Zhirik1337/ZOVboot' +PACKAGE_NAME='ZOVboot' +PACKAGE_STRING='ZOVboot UNVERSIONED' +PACKAGE_TARNAME='zovboot' +PACKAGE_URL='https://git.bebrik.xyz/Zhirik1337/ZOVboot' +PACKAGE_VERSION='UNVERSIONED' +PATH_SEPARATOR=':' +READELF_FOR_TARGET='readelf' +READELF_FOR_TARGET_FOUND='yes' +REGEN_DATE='UNVERSIONED' +SED='/usr/bin/sed' +SHELL='/bin/sh' +SOURCE_DATE_EPOCH='1546297200' +SOURCE_DATE_EPOCH_TOUCH='201901010000' +SRCDIR='/home/wpng1337/Zovboot/ZOVboot/limine' +STRIP='strip' +STRIP_FOUND='yes' +TOOLCHAIN_FOR_TARGET='llvm-' +WERROR_FLAG='-Wno-error' +ac_ct_CC='gcc' +bindir='${exec_prefix}/bin' +build='x86_64-pc-linux-gnu' +build_alias='' +build_cpu='x86_64' +build_os='linux-gnu' +build_vendor='pc' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +dvidir='${docdir}' +exec_prefix='${prefix}' +host='x86_64-pc-linux-gnu' +host_alias='' +host_cpu='x86_64' +host_os='linux-gnu' +host_vendor='pc' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='/usr/local' +program_transform_name='s,x,x,' +psdir='${docdir}' +runstatedir='${localstatedir}/run' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +/* confdefs.h */ +#define PACKAGE_NAME "ZOVboot" +#define PACKAGE_TARNAME "zovboot" +#define PACKAGE_VERSION "UNVERSIONED" +#define PACKAGE_STRING "ZOVboot UNVERSIONED" +#define PACKAGE_BUGREPORT "https://git.bebrik.xyz/Zhirik1337/ZOVboot" +#define PACKAGE_URL "https://git.bebrik.xyz/Zhirik1337/ZOVboot" +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_STDBOOL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STRING_H 1 +#define HAVE_ERRNO_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_TIME_H 1 + +configure: exit 0 diff --git a/limine/build-host/config.status b/limine/build-host/config.status new file mode 100755 index 0000000..f0b17e0 --- /dev/null +++ b/limine/build-host/config.status @@ -0,0 +1,940 @@ +#! /bin/sh +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by ZOVboot $as_me UNVERSIONED, which was +generated by GNU Autoconf 2.72. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +# Files that config.status was made for. +config_files=" man/man1/limine.1 GNUmakefile config.h" + +ac_cs_usage="\ +'$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to . +ZOVboot home page: ." + +ac_cs_config='LD_FOR_TARGET=ld OBJCOPY_FOR_TARGET=objcopy OBJDUMP_FOR_TARGET=objdump READELF_FOR_TARGET=readelf' +ac_cs_version="\ +ZOVboot config.status UNVERSIONED +configured by ../configure, generated by GNU Autoconf 2.72, + with options \"$ac_cs_config\" + +Copyright (C) 2023 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/home/wpng1337/Zovboot/ZOVboot/limine/build-host' +srcdir='..' +INSTALL='/usr/bin/install -c' +MKDIR_P='/usr/bin/mkdir -p' +AWK='gawk' +test -n "$AWK" || AWK=awk +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: '$1' +Try '$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + set X /bin/sh '../configure' 'LD_FOR_TARGET=ld' 'OBJCOPY_FOR_TARGET=objcopy' 'OBJDUMP_FOR_TARGET=objdump' 'READELF_FOR_TARGET=readelf' $ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=/bin/sh $*" >&6 + CONFIG_SHELL='/bin/sh' + export CONFIG_SHELL + exec "$@" +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "man/man1/limine.1") CONFIG_FILES="$CONFIG_FILES man/man1/limine.1" ;; + "GNUmakefile") CONFIG_FILES="$CONFIG_FILES GNUmakefile" ;; + "config.h") CONFIG_FILES="$CONFIG_FILES config.h" ;; + + *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to '$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with './config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +cat >>"$ac_tmp/subs1.awk" <<\_ACAWK && +S["LTLIBOBJS"]="" +S["LIBOBJS"]="" +S["LIMINE_COPYRIGHT"]="Copyright (C) 2019-2026 Mintsuki and contributors." +S["NASMFLAGS_FOR_TARGET"]="-g" +S["LDFLAGS_FOR_TARGET"]="" +S["CPPFLAGS_FOR_TARGET"]="" +S["CFLAGS_FOR_TARGET"]=" -g -O2 -pipe" +S["GZIP_FOUND"]="" +S["NASM_FOUND"]="" +S["BUILD_UEFI_CD"]="no" +S["MTOOLS_FOUND"]="" +S["BUILD_UEFI_LOONGARCH64"]="" +S["BUILD_UEFI_RISCV64"]="" +S["BUILD_UEFI_AARCH64"]="" +S["BUILD_UEFI_X86_64"]="" +S["BUILD_UEFI_IA32"]="" +S["BUILD_BIOS"]="" +S["BUILD_BIOS_PXE"]="no" +S["BUILD_BIOS_CD"]="no" +S["READELF_FOR_TARGET_FOUND"]="yes" +S["OBJDUMP_FOR_TARGET_FOUND"]="yes" +S["OBJCOPY_FOR_TARGET_FOUND"]="yes" +S["LD_FOR_TARGET_FOUND"]="yes" +S["CC_FOR_TARGET_FOUND"]="yes" +S["READELF_FOR_TARGET"]="readelf" +S["OBJDUMP_FOR_TARGET"]="objdump" +S["OBJCOPY_FOR_TARGET"]="objcopy" +S["LD_FOR_TARGET"]="ld" +S["CC_FOR_TARGET"]="clang" +S["TOOLCHAIN_FOR_TARGET"]="llvm-" +S["STRIP_FOUND"]="yes" +S["STRIP"]="strip" +S["FIND_FOUND"]="yes" +S["AWK"]="gawk" +S["GREP"]="/usr/bin/grep" +S["SED"]="/usr/bin/sed" +S["INSTALL_DATA"]="${INSTALL} -m 644" +S["INSTALL_SCRIPT"]="${INSTALL}" +S["INSTALL_PROGRAM"]="${INSTALL}" +S["MKDIR_P"]="/usr/bin/mkdir -p" +S["WERROR_FLAG"]="-Wno-error" +S["OBJEXT"]="o" +S["EXEEXT"]="" +S["ac_ct_CC"]="gcc" +S["CPPFLAGS"]="" +S["LDFLAGS"]="" +S["CFLAGS"]="-g -O2 -pipe" +S["CC"]="gcc" +S["host_os"]="linux-gnu" +S["host_vendor"]="pc" +S["host_cpu"]="x86_64" +S["host"]="x86_64-pc-linux-gnu" +S["build_os"]="linux-gnu" +S["build_vendor"]="pc" +S["build_cpu"]="x86_64" +S["build"]="x86_64-pc-linux-gnu" +S["SOURCE_DATE_EPOCH_TOUCH"]="201901010000" +S["SOURCE_DATE_EPOCH"]="1546297200" +S["REGEN_DATE"]="UNVERSIONED" +S["BUILDDIR"]="/home/wpng1337/Zovboot/ZOVboot/limine/build-host" +S["SRCDIR"]="/home/wpng1337/Zovboot/ZOVboot/limine" +S["target_alias"]="" +S["host_alias"]="" +S["build_alias"]="" +S["LIBS"]="" +S["ECHO_T"]="" +S["ECHO_N"]="-n" +S["ECHO_C"]="" +S["DEFS"]="-DPACKAGE_NAME=\\\"ZOVboot\\\" -DPACKAGE_TARNAME=\\\"zovboot\\\" -DPACKAGE_VERSION=\\\"UNVERSIONED\\\" -DPACKAGE_STRING=\\\"ZOVboot\\ UNVERSIONED\\\" -DPACKAGE_BUGRE"\ +"PORT=\\\"https://git.bebrik.xyz/Zhirik1337/ZOVboot\\\" -DPACKAGE_URL=\\\"https://git.bebrik.xyz/Zhirik1337/ZOVboot\\\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -D"\ +"HAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1"\ +" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STDBOOL_H=1 -DHAVE_STDARG_H=1 -DHAVE_STRING_H=1 -DHAVE_ERRNO_H=1 -DHA"\ +"VE_INTTYPES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_TIME_H=1" +S["mandir"]="${datarootdir}/man" +S["localedir"]="${datarootdir}/locale" +S["libdir"]="${exec_prefix}/lib" +S["psdir"]="${docdir}" +S["pdfdir"]="${docdir}" +S["dvidir"]="${docdir}" +S["htmldir"]="${docdir}" +S["infodir"]="${datarootdir}/info" +S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}" +S["oldincludedir"]="/usr/include" +S["includedir"]="${prefix}/include" +S["runstatedir"]="${localstatedir}/run" +S["localstatedir"]="${prefix}/var" +S["sharedstatedir"]="${prefix}/com" +S["sysconfdir"]="${prefix}/etc" +S["datadir"]="${datarootdir}" +S["datarootdir"]="${prefix}/share" +S["libexecdir"]="${exec_prefix}/libexec" +S["sbindir"]="${exec_prefix}/sbin" +S["bindir"]="${exec_prefix}/bin" +S["program_transform_name"]="s,x,x," +S["prefix"]="/usr/local" +S["exec_prefix"]="${prefix}" +S["PACKAGE_URL"]="https://git.bebrik.xyz/Zhirik1337/ZOVboot" +S["PACKAGE_BUGREPORT"]="https://git.bebrik.xyz/Zhirik1337/ZOVboot" +S["PACKAGE_STRING"]="ZOVboot UNVERSIONED" +S["PACKAGE_VERSION"]="UNVERSIONED" +S["PACKAGE_TARNAME"]="zovboot" +S["PACKAGE_NAME"]="ZOVboot" +S["PATH_SEPARATOR"]=":" +S["SHELL"]="/bin/sh" +_ACAWK +cat >>"$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain ':'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is 'configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac +ac_sed_extra=" + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 diff --git a/limine/build-host/man/man1/limine.1 b/limine/build-host/man/man1/limine.1 new file mode 100644 index 0000000..b1a08ee --- /dev/null +++ b/limine/build-host/man/man1/limine.1 @@ -0,0 +1,13 @@ +.TH LIMINE 1 "version UNVERSIONED" "UNVERSIONED" +.SH NAME +limine \- Multiplexer to several Limine-related utilities. +.SH SYNOPSIS +.B limine +.RI " " +.SH DESCRIPTION +\fBlimine\fR provides a series of Limine-related utilities condensed in a single executable. +.SH BUGS +Please report bugs via +.IR https://git.bebrik.xyz/Zhirik1337/ZOVboot . +.SH HOMEPAGE +.I https://git.bebrik.xyz/Zhirik1337/ZOVboot diff --git a/limine/build-test/GNUmakefile b/limine/build-test/GNUmakefile new file mode 100644 index 0000000..1334e8a --- /dev/null +++ b/limine/build-test/GNUmakefile @@ -0,0 +1,401 @@ +.SUFFIXES: + +override SOURCE_DATE_EPOCH := 1546297200 +export SOURCE_DATE_EPOCH + +override SOURCE_DATE_EPOCH_TOUCH := 201901010000 + +override PACKAGE_TARNAME := zovboot +override PACKAGE_VERSION := UNVERSIONED +override DIST_OUTPUT := $(PACKAGE_TARNAME)-$(PACKAGE_VERSION) + +override prefix := /usr/local +override exec_prefix := ${prefix} + +override bindir := ${exec_prefix}/bin +override datarootdir := ${prefix}/share +override mandir := ${datarootdir}/man +override docdir := ${datarootdir}/doc/${PACKAGE_TARNAME} + +override BUILDDIR := /home/wpng1337/Zovboot/ZOVboot/limine/build-test +override BINDIR := $(BUILDDIR)/bin + +override SRCDIR := /home/wpng1337/Zovboot/ZOVboot/limine + +override SPACE := $(subst ,, ) +override COMMA := , + +override MKESCAPE = $(subst $(SPACE),\ ,$(1)) +override SHESCAPE = $(subst ','\'',$(1)) +override NASMESCAPE = $(subst ','"'$(COMMA) \"'\"$(COMMA) '"',$(1)) + +override BUILD_BIOS := limine-bios +override BUILD_UEFI_X86_64 := limine-uefi-x86-64 +override BUILD_UEFI_IA32 := +override BUILD_UEFI_AARCH64 := +override BUILD_UEFI_RISCV64 := +override BUILD_UEFI_LOONGARCH64 := +override BUILD_UEFI_CD := no +override BUILD_BIOS_PXE := no +override BUILD_BIOS_CD := no + +INSTALL := /usr/bin/install -c +INSTALL_PROGRAM := ${INSTALL} +INSTALL_DATA := ${INSTALL} -m 644 +STRIP := strip + +MKDIR_P := /usr/bin/mkdir -p +export MKDIR_P +GREP := /usr/bin/grep +export GREP +SED := /usr/bin/sed +export SED +AWK := gawk +export AWK + +CC := gcc + +CPPFLAGS := +CFLAGS := -g -O2 -pipe +LDFLAGS := +LIBS := + +CC_FOR_TARGET := clang +export CC_FOR_TARGET +LD_FOR_TARGET := ld +export LD_FOR_TARGET +OBJCOPY_FOR_TARGET := objcopy +export OBJCOPY_FOR_TARGET +OBJDUMP_FOR_TARGET := objdump +export OBJDUMP_FOR_TARGET +READELF_FOR_TARGET := readelf +export READELF_FOR_TARGET + +override WERROR_FLAG := -Wno-error +export WERROR_FLAG + +CFLAGS_FOR_TARGET := -g -O2 -pipe +export CFLAGS_FOR_TARGET +CPPFLAGS_FOR_TARGET := +export CPPFLAGS_FOR_TARGET +LDFLAGS_FOR_TARGET := +export LDFLAGS_FOR_TARGET +NASMFLAGS_FOR_TARGET := -g +export NASMFLAGS_FOR_TARGET + +override STAGE1_FILES := $(shell find '$(call SHESCAPE,$(SRCDIR))/stage1' -type f -name '*.asm' | LC_ALL=C sort) + +.PHONY: all +all: $(call MKESCAPE,$(BINDIR))/Makefile + $(MAKE) all1 + +.PHONY: all1 +all1: $(BUILD_UEFI_X86_64) $(BUILD_UEFI_IA32) $(BUILD_UEFI_AARCH64) $(BUILD_UEFI_RISCV64) $(BUILD_UEFI_LOONGARCH64) $(BUILD_BIOS) + $(MAKE) '$(call SHESCAPE,$(BINDIR))/limine' + $(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' + +$(call MKESCAPE,$(BINDIR))/limine-bios-hdd.h: $(call MKESCAPE,$(BINDIR))/limine-bios-hdd.bin + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cd '$(call SHESCAPE,$(BINDIR))' && '$(call SHESCAPE,$(SRCDIR))/host/hgen.sh' >limine-bios-hdd.h + +override LIMINE_NO_BIOS := +ifneq ($(BUILD_BIOS),limine-bios) +override LIMINE_NO_BIOS := -DLIMINE_NO_BIOS +endif + +$(call MKESCAPE,$(BINDIR))/limine: $(call MKESCAPE,$(BINDIR))/Makefile $(call MKESCAPE,$(SRCDIR))/host/limine.c $(if $(filter $(BUILD_BIOS),limine-bios),$(call MKESCAPE,$(BINDIR))/limine-bios-hdd.h) + $(SED) 's/%VERSION%/UNVERSIONED/g;s/%COPYRIGHT%/Copyright (C) 2019-2026 Mintsuki and contributors./g' <'$(call SHESCAPE,$(SRCDIR))/host/limine.c' >'$(call SHESCAPE,$(BINDIR))/limine.c' + $(MAKE) -C '$(call SHESCAPE,$(BINDIR))' limine \ + CC="$(CC)" \ + CFLAGS="$(CFLAGS) -Wall -Wextra $(WERROR_FLAG)" \ + CPPFLAGS='$(CPPFLAGS) $(LIMINE_NO_BIOS) -DLIMINE_DATADIR=\"$(call SHESCAPE,$(datarootdir))/limine\"' \ + LDFLAGS="$(LDFLAGS)" \ + LIBS="$(LIBS)" + +$(call MKESCAPE,$(BINDIR))/Makefile: $(call MKESCAPE,$(SRCDIR))/host/host.mk $(call MKESCAPE,$(SRCDIR))/host/.gitignore + mkdir -p '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(SRCDIR))/host/host.mk' '$(call SHESCAPE,$(BINDIR))/Makefile' + cp '$(call SHESCAPE,$(SRCDIR))/host/.gitignore' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine +limine: + $(MAKE) '$(call SHESCAPE,$(BINDIR))/limine' + +.PHONY: clean +clean: limine-bios-clean limine-uefi-ia32-clean limine-uefi-x86-64-clean limine-uefi-aarch64-clean limine-uefi-riscv64-clean limine-uefi-loongarch64-clean + rm -rf '$(call SHESCAPE,$(BINDIR))' '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp' + +.PHONY: install +install: all + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(docdir))' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/COPYING' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(docdir))/LICENSES' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/LICENSES/LicenseRef-scancode-bsd-no-disclaimer-unmodified.txt' '$(call SHESCAPE,$(DESTDIR)$(docdir))/LICENSES/' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/3RDPARTY.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/CONFIG.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/FAQ.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL_DATA) '$(call SHESCAPE,$(SRCDIR))/USAGE.md' '$(call SHESCAPE,$(DESTDIR)$(docdir))/' + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1' + $(INSTALL_DATA) '$(call SHESCAPE,$(BUILDDIR))/man/man1/limine.1' '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/' + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(datarootdir))' + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine' +ifeq ($(BUILD_BIOS),limine-bios) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-bios.sys' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifneq ($(BUILD_BIOS_CD),no) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-bios-cd.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifneq ($(BUILD_UEFI_CD),no) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifneq ($(BUILD_BIOS_PXE),no) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/limine-bios-pxe.bin' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_AARCH64),limine-uefi-aarch64) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTAA64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_RISCV64),limine-uefi-riscv64) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTRISCV64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_LOONGARCH64),limine-uefi-loongarch64) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTLOONGARCH64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_X86_64),limine-uefi-x86-64) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTX64.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif +ifeq ($(BUILD_UEFI_IA32),limine-uefi-ia32) + $(INSTALL_DATA) '$(call SHESCAPE,$(BINDIR))/BOOTIA32.EFI' '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine/' +endif + $(INSTALL) -d '$(call SHESCAPE,$(DESTDIR)$(bindir))' + $(INSTALL_PROGRAM) '$(call SHESCAPE,$(BINDIR))/limine' '$(call SHESCAPE,$(DESTDIR)$(bindir))/' + +.PHONY: install-strip +install-strip: install + $(STRIP) '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine' + +.PHONY: uninstall +uninstall: + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/COPYING' + rm -rf '$(call SHESCAPE,$(DESTDIR)$(docdir))/LICENSES' + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/3RDPARTY.md' + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/CONFIG.md' + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/FAQ.md' + rm -f '$(call SHESCAPE,$(DESTDIR)$(docdir))/USAGE.md' + rm -f '$(call SHESCAPE,$(DESTDIR)$(mandir))/man1/limine.1' + rm -f '$(call SHESCAPE,$(DESTDIR)$(bindir))/limine' + rm -rf '$(call SHESCAPE,$(DESTDIR)$(datarootdir))/limine' + +$(call MKESCAPE,$(BUILDDIR))/stage1.stamp: $(STAGE1_FILES) $(call MKESCAPE,$(BUILDDIR))/decompressor-build/decompressor.bin $(call MKESCAPE,$(BUILDDIR))/common-bios/stage2.bin.gz + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cd '$(call SHESCAPE,$(SRCDIR))/stage1/hdd' && nasm bootsect.asm -Wall -w-unknown-warning -w-reloc $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-bios-hdd.bin' +ifneq ($(BUILD_BIOS_CD),no) + cd '$(call SHESCAPE,$(SRCDIR))/stage1/cd' && nasm bootsect.asm -Wall -w-unknown-warning -w-reloc $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-bios-cd.bin' +endif +ifneq ($(BUILD_BIOS_PXE),no) + cd '$(call SHESCAPE,$(SRCDIR))/stage1/pxe' && nasm bootsect.asm -Wall -w-unknown-warning -w-reloc $(WERROR_FLAG) -fbin -DBUILDDIR="'"'$(call NASMESCAPE,$(BUILDDIR))'"'" -o '$(call SHESCAPE,$(BINDIR))/limine-bios-pxe.bin' +endif + cp '$(call SHESCAPE,$(BUILDDIR))/common-bios/limine-bios.sys' '$(call SHESCAPE,$(BINDIR))/' + touch '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp' + +.PHONY: limine-bios +limine-bios: common-bios decompressor + $(MAKE) '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp' + +$(call MKESCAPE,$(BINDIR))/limine-uefi-cd.bin: $(if $(BUILD_UEFI_IA32),$(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI) $(if $(BUILD_UEFI_X86_64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI) $(if $(BUILD_UEFI_AARCH64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI) $(if $(BUILD_UEFI_RISCV64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI) $(if $(BUILD_UEFI_LOONGARCH64),$(call MKESCAPE,$(BUILDDIR))/common-uefi-loongarch64/BOOTLOONGARCH64.EFI) +ifneq ($(BUILD_UEFI_CD),no) + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + rm -f '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' + dd if=/dev/zero of='$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' bs=512 count=5760 2>/dev/null + mformat -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' -f 2880 -N 12345678 :: + LIMINE_UEFI_CD_TMP="$$(mktemp -d)"; \ + mkdir -p "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-loongarch64/BOOTLOONGARCH64.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' "$$LIMINE_UEFI_CD_TMP"/EFI/BOOT/ 2>/dev/null; \ + find "$$LIMINE_UEFI_CD_TMP" -exec touch -t $(SOURCE_DATE_EPOCH_TOUCH) '{}' + && \ + mcopy -D o -s -m -i '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' "$$LIMINE_UEFI_CD_TMP"/EFI :: && \ + rm -rf "$$LIMINE_UEFI_CD_TMP" +endif + +.PHONY: limine-uefi-cd +limine-uefi-cd: + $(MAKE) '$(call SHESCAPE,$(BINDIR))/limine-uefi-cd.bin' + +$(call MKESCAPE,$(BINDIR))/BOOTX64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64/BOOTX64.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-x86-64 +limine-uefi-x86-64: + $(MAKE) common-uefi-x86-64 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTX64.EFI' + +$(call MKESCAPE,$(BINDIR))/BOOTIA32.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32/BOOTIA32.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-ia32 +limine-uefi-ia32: + $(MAKE) common-uefi-ia32 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTIA32.EFI' + +$(call MKESCAPE,$(BINDIR))/BOOTAA64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64/BOOTAA64.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-aarch64 +limine-uefi-aarch64: + $(MAKE) common-uefi-aarch64 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTAA64.EFI' + +$(call MKESCAPE,$(BINDIR))/BOOTRISCV64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64/BOOTRISCV64.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-riscv64 +limine-uefi-riscv64: + $(MAKE) common-uefi-riscv64 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTRISCV64.EFI' + +$(call MKESCAPE,$(BINDIR))/BOOTLOONGARCH64.EFI: $(call MKESCAPE,$(BUILDDIR))/common-uefi-loongarch64/BOOTLOONGARCH64.EFI + $(MKDIR_P) '$(call SHESCAPE,$(BINDIR))' + cp '$(call SHESCAPE,$(BUILDDIR))/common-uefi-loongarch64/BOOTLOONGARCH64.EFI' '$(call SHESCAPE,$(BINDIR))/' + +.PHONY: limine-uefi-loongarch64 +limine-uefi-loongarch64: + $(MAKE) common-uefi-loongarch64 + $(MAKE) '$(call SHESCAPE,$(BINDIR))/BOOTLOONGARCH64.EFI' + +.PHONY: limine-bios-clean +limine-bios-clean: common-bios-clean decompressor-clean + +.PHONY: limine-uefi-x86-64-clean +limine-uefi-x86-64-clean: common-uefi-x86-64-clean + +.PHONY: limine-uefi-ia32-clean +limine-uefi-ia32-clean: common-uefi-ia32-clean + +.PHONY: limine-uefi-aarch64-clean +limine-uefi-aarch64-clean: common-uefi-aarch64-clean + +.PHONY: limine-uefi-riscv64-clean +limine-uefi-riscv64-clean: common-uefi-riscv64-clean + +.PHONY: limine-uefi-loongarch64-clean +limine-uefi-loongarch64-clean: common-uefi-loongarch64-clean + +.PHONY: dist +dist: + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" + $(MKDIR_P) '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" + cp -r '$(call SHESCAPE,$(SRCDIR))'/.git '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)"/ + cd '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" && git checkout . + cd '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" && ./bootstrap + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/flanterm/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/flanterm/.gitignore" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/freestnd-c-hdrs/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/limine-protocol/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/picoefi/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/picoefi/.gitignore" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/cc-runtime" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/libfdt/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/tinf" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/common/lib/stb_image.h.nopatch" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/.git" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/.gitignore" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/.forgejo" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/README.md" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/autom4te.cache" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/test" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/test.mk" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/logo.png" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/screenshot.png" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/bochsrc" + echo "$(PACKAGE_VERSION)" > '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/version" + cd '$(call SHESCAPE,$(BUILDDIR))' && tar -cf "$(DIST_OUTPUT).tar" "$(DIST_OUTPUT)" + cd '$(call SHESCAPE,$(BUILDDIR))' && gzip < "$(DIST_OUTPUT).tar" > "$(DIST_OUTPUT).tar.gz" + cd '$(call SHESCAPE,$(BUILDDIR))' && ( bzip2 < "$(DIST_OUTPUT).tar" > "$(DIST_OUTPUT).tar.bz2" || rm -f "$(DIST_OUTPUT).tar.bz2" ) + cd '$(call SHESCAPE,$(BUILDDIR))' && ( xz < "$(DIST_OUTPUT).tar" > "$(DIST_OUTPUT).tar.xz" || rm -f "$(DIST_OUTPUT).tar.xz" ) + cd '$(call SHESCAPE,$(BUILDDIR))' && rm "$(DIST_OUTPUT).tar" + rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" + +.PHONY: distclean +distclean: clean + rm -rf edk2-ovmf config.log config.status GNUmakefile config.h man/man1/limine.1 + +.PHONY: maintainer-clean +maintainer-clean: distclean + cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf flanterm common/lib/stb_image.h.nopatch common/lib/stb_image.h decompressor/tinf tinf libfdt freestnd-c-hdrs cc-runtime common/cc-runtime.s2.c decompressor/cc-runtime.c limine-protocol picoefi configure timestamps build-aux *'~' autom4te.cache aclocal.m4 *.tar* + +.PHONY: common-uefi-x86-64 +common-uefi-x86-64: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-x86-64 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64' + +.PHONY: common-uefi-x86-64-clean +common-uefi-x86-64-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-x86-64' + +.PHONY: common-uefi-aarch64 +common-uefi-aarch64: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-aarch64 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64' + +.PHONY: common-uefi-aarch64-clean +common-uefi-aarch64-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-aarch64' + +.PHONY: common-uefi-riscv64 +common-uefi-riscv64: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-riscv64 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64' + +.PHONY: common-uefi-riscv64-clean +common-uefi-riscv64-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-riscv64' + +.PHONY: common-uefi-loongarch64 +common-uefi-loongarch64: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-loongarch64 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-loongarch64' + +.PHONY: common-uefi-loongarch64-clean +common-uefi-loongarch64-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-loongarch64' + +.PHONY: common-uefi-ia32 +common-uefi-ia32: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=uefi-ia32 \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32' + +.PHONY: common-uefi-ia32-clean +common-uefi-ia32-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-uefi-ia32' + +.PHONY: common-bios +common-bios: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/common' -f common.mk \ + TARGET=bios \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/common-bios' + +.PHONY: common-bios-clean +common-bios-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/common-bios' + +.PHONY: decompressor +decompressor: + $(MAKE) -C '$(call SHESCAPE,$(SRCDIR))/decompressor' -f decompressor.mk \ + BUILDDIR='$(call SHESCAPE,$(BUILDDIR))/decompressor-build' + +.PHONY: decompressor-clean +decompressor-clean: + rm -rf '$(call SHESCAPE,$(BUILDDIR))/decompressor-build' + +-include test.mk diff --git a/limine/build-test/bin/.gitignore b/limine/build-test/bin/.gitignore new file mode 100644 index 0000000..a1492fd --- /dev/null +++ b/limine/build-test/bin/.gitignore @@ -0,0 +1,2 @@ +limine +limine.exe diff --git a/limine/build-test/bin/Makefile b/limine/build-test/bin/Makefile new file mode 100644 index 0000000..4962735 --- /dev/null +++ b/limine/build-test/bin/Makefile @@ -0,0 +1,19 @@ +.POSIX: + +SHELL=/bin/sh + +CC=cc +CFLAGS=-g -O2 -pipe +CPPFLAGS= +LDFLAGS= +LIBS= + +.PHONY: all +all: limine + +.PHONY: clean +clean: + rm -f limine limine.exe + +limine: limine.c + $(CC) $(CFLAGS) -std=c99 $(CPPFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ diff --git a/limine/build-test/common-uefi-x86-64/linker_nomap.ld b/limine/build-test/common-uefi-x86-64/linker_nomap.ld new file mode 100644 index 0000000..eaaa4ff --- /dev/null +++ b/limine/build-test/common-uefi-x86-64/linker_nomap.ld @@ -0,0 +1,58 @@ +OUTPUT_FORMAT(elf64-x86-64) +ENTRY(_start) +PHDRS +{ + text PT_LOAD FLAGS(0x05); + rodata PT_LOAD FLAGS(0x04); + data PT_LOAD FLAGS(0x06); + dynamic PT_DYNAMIC FLAGS(0x06); +} +SECTIONS +{ + . = 0; + __slide = .; + __image_base = ABSOLUTE(.); + __image_size = ABSOLUTE(__image_end - __image_base); + .text : { + KEEP(*(.pe_header)) + . = ALIGN(0x1000); + __text_start = ABSOLUTE(.); + *(.text .text.*) + } :text + . = ALIGN(0x1000); + __text_end = ABSOLUTE(.); + __text_size = ABSOLUTE(__text_end - __text_start); + .rodata : { + __reloc_start = ABSOLUTE(.); + *(.dummy_reloc) + . = ALIGN(0x1000); + __reloc_end = ABSOLUTE(.); + __reloc_size = ABSOLUTE(__reloc_end - __reloc_start); + __data_start = ABSOLUTE(.); + *(.rodata .rodata.*) + full_map = .; + } :rodata + .data : { + data_begin = .; + *(.data .data.*) + } :data + .bss : { + *(.bss .bss.*) + *(COMMON) + data_end = .; + } :data + .no_unwind : { + *(.no_unwind) + } :data + .dynamic : { + *(.dynamic) + } :data :dynamic + __data_end = ABSOLUTE(ALIGN(0x1000)); + __data_size = ABSOLUTE(__data_end - __data_start); + __image_end = ABSOLUTE(ALIGN(0x1000)); + /DISCARD/ : { + *(.eh_frame*) + *(.note .note.*) + *(.interp) + } +} diff --git a/limine/build-test/config.h b/limine/build-test/config.h new file mode 100644 index 0000000..43d2179 --- /dev/null +++ b/limine/build-test/config.h @@ -0,0 +1,7 @@ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#define LIMINE_VERSION "UNVERSIONED" +#define LIMINE_COPYRIGHT "Copyright (C) 2019-2026 Mintsuki and contributors." + +#endif diff --git a/limine/build-test/config.log b/limine/build-test/config.log new file mode 100644 index 0000000..49be0e4 --- /dev/null +++ b/limine/build-test/config.log @@ -0,0 +1,470 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by ZOVboot configure UNVERSIONED, which was +generated by GNU Autoconf 2.72. Invocation command line was + + $ ../configure --enable-bios --enable-uefi-x86-64 LD_FOR_TARGET=ld OBJCOPY_FOR_TARGET=objcopy OBJDUMP_FOR_TARGET=objdump READELF_FOR_TARGET=readelf + +## --------- ## +## Platform. ## +## --------- ## + +hostname = archlinux +uname -m = x86_64 +uname -r = 6.19.6-arch1-1 +uname -s = Linux +uname -v = #1 SMP PREEMPT_DYNAMIC Wed, 04 Mar 2026 18:25:08 +0000 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = unknown +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +/usr/bin/hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /tmp/fakebin/ +PATH: /home/wpng1337/.codex/tmp/arg0/codex-arg0tf5Bxj/ +PATH: /usr/local/sbin/ +PATH: /usr/local/bin/ +PATH: /usr/bin/ +PATH: /var/lib/flatpak/exports/bin/ +PATH: /usr/bin/site_perl/ +PATH: /usr/bin/vendor_perl/ +PATH: /usr/bin/core_perl/ +PATH: /home/wpng1337/.vscode-oss/extensions/openai.chatgpt-26.311.21342-linux-x64/bin/linux-x86_64/ + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:2243: looking for aux files: install-sh config.guess config.sub +configure:2256: trying ../build-aux/ +configure:2267: ../build-aux/install-sh found +configure:2285: ../build-aux/config.guess found +configure:2285: ../build-aux/config.sub found +configure:2421: checking build system type +configure:2437: result: x86_64-pc-linux-gnu +configure:2457: checking host system type +configure:2472: result: x86_64-pc-linux-gnu +configure:2592: checking for gcc +configure:2613: found /usr/bin/gcc +configure:2625: result: gcc +configure:2984: checking for C compiler version +configure:2993: gcc --version >&5 +gcc (GCC) 15.2.1 20260209 +Copyright (C) 2025 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:3004: $? = 0 +configure:2993: gcc -v >&5 +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/15.2.1/lto-wrapper +Target: x86_64-pc-linux-gnu +Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 15.2.1 20260209 (GCC) +configure:3004: $? = 0 +configure:2993: gcc -V >&5 +gcc: error: unrecognized command-line option '-V' +gcc: fatal error: no input files +compilation terminated. +configure:3004: $? = 1 +configure:2993: gcc -qversion >&5 +gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'? +gcc: fatal error: no input files +compilation terminated. +configure:3004: $? = 1 +configure:2993: gcc -version >&5 +gcc: error: unrecognized command-line option '-version' +gcc: fatal error: no input files +compilation terminated. +configure:3004: $? = 1 +configure:3024: checking whether the C compiler works +configure:3046: gcc -g -O2 -pipe conftest.c >&5 +configure:3050: $? = 0 +configure:3101: result: yes +configure:3105: checking for C compiler default output file name +configure:3107: result: a.out +configure:3113: checking for suffix of executables +configure:3120: gcc -o conftest -g -O2 -pipe conftest.c >&5 +configure:3124: $? = 0 +configure:3148: result: +configure:3172: checking whether we are cross compiling +configure:3180: gcc -o conftest -g -O2 -pipe conftest.c >&5 +configure:3184: $? = 0 +configure:3191: ./conftest +configure:3195: $? = 0 +configure:3210: result: no +configure:3216: checking for suffix of object files +configure:3239: gcc -c -g -O2 -pipe conftest.c >&5 +configure:3243: $? = 0 +configure:3267: result: o +configure:3271: checking whether the compiler supports GNU C +configure:3291: gcc -c -g -O2 -pipe conftest.c >&5 +configure:3291: $? = 0 +configure:3303: result: yes +configure:3314: checking whether gcc accepts -g +configure:3335: gcc -c -g conftest.c >&5 +configure:3335: $? = 0 +configure:3382: result: yes +configure:3402: checking for gcc option to enable C11 features +configure:3417: gcc -c -g -O2 -pipe conftest.c >&5 +configure:3417: $? = 0 +configure:3436: result: none needed +configure:3572: checking for a race-free mkdir -p +configure:3615: result: /usr/bin/mkdir -p +configure:3634: checking for a BSD-compatible install +configure:3708: result: /usr/bin/install -c +configure:3720: checking for a sed that does not truncate output +configure:3792: result: /usr/bin/sed +configure:3798: checking for grep that handles long lines and -e +configure:3864: result: /usr/bin/grep +configure:3874: checking for gawk +configure:3895: found /usr/bin/gawk +configure:3907: result: gawk +configure:3922: checking for find +configure:3943: found /usr/bin/find +configure:3955: result: yes +configure:4085: checking for strip +configure:4106: found /usr/bin/strip +configure:4118: result: strip +configure:4213: checking for stdio.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for stdlib.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for string.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for inttypes.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for stdint.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for strings.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for sys/stat.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for sys/types.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4213: checking for unistd.h +configure:4213: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4213: $? = 0 +configure:4213: result: yes +configure:4241: checking for stdio.h +configure:4241: result: yes +configure:4241: checking for stdlib.h +configure:4241: result: yes +configure:4241: checking for stdint.h +configure:4241: result: yes +configure:4241: checking for stddef.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for stdbool.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for stdarg.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for string.h +configure:4241: result: yes +configure:4241: checking for errno.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for inttypes.h +configure:4241: result: yes +configure:4241: checking for limits.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4241: checking for time.h +configure:4241: gcc -c -g -O2 -pipe conftest.c >&5 +configure:4241: $? = 0 +configure:4241: result: yes +configure:4302: checking for clang +configure:4323: found /usr/bin/clang +configure:4335: result: yes +configure:4538: checking for ld +configure:4559: found /usr/bin/ld +configure:4571: result: yes +configure:4774: checking for objcopy +configure:4795: found /usr/bin/objcopy +configure:4807: result: yes +configure:5010: checking for objdump +configure:5031: found /usr/bin/objdump +configure:5043: result: yes +configure:5246: checking for readelf +configure:5267: found /usr/bin/readelf +configure:5279: result: yes +configure:5678: checking for nasm +configure:5699: found /tmp/fakebin/nasm +configure:5711: result: yes +configure:5727: checking for gzip +configure:5748: found /usr/bin/gzip +configure:5760: result: yes +configure:5949: creating ./config.status + +## ---------------------- ## +## Running config.status. ## +## ---------------------- ## + +This file was extended by ZOVboot config.status UNVERSIONED, which was +generated by GNU Autoconf 2.72. Invocation command line was + + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + $ ./config.status + +on archlinux + +config.status:777: creating man/man1/limine.1 +config.status:777: creating GNUmakefile +config.status:777: creating config.h + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_build=x86_64-pc-linux-gnu +ac_cv_c_compiler_gnu=yes +ac_cv_env_CC_FOR_TARGET_set= +ac_cv_env_CC_FOR_TARGET_value= +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_FOR_TARGET_set= +ac_cv_env_CFLAGS_FOR_TARGET_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_FOR_TARGET_set= +ac_cv_env_CPPFLAGS_FOR_TARGET_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_LDFLAGS_FOR_TARGET_set= +ac_cv_env_LDFLAGS_FOR_TARGET_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_LD_FOR_TARGET_set=set +ac_cv_env_LD_FOR_TARGET_value=ld +ac_cv_env_LIBS_set= +ac_cv_env_LIBS_value= +ac_cv_env_NASMFLAGS_FOR_TARGET_set= +ac_cv_env_NASMFLAGS_FOR_TARGET_value= +ac_cv_env_OBJCOPY_FOR_TARGET_set=set +ac_cv_env_OBJCOPY_FOR_TARGET_value=objcopy +ac_cv_env_OBJDUMP_FOR_TARGET_set=set +ac_cv_env_OBJDUMP_FOR_TARGET_value=objdump +ac_cv_env_READELF_FOR_TARGET_set=set +ac_cv_env_READELF_FOR_TARGET_value=readelf +ac_cv_env_STRIP_set= +ac_cv_env_STRIP_value= +ac_cv_env_TOOLCHAIN_FOR_TARGET_set= +ac_cv_env_TOOLCHAIN_FOR_TARGET_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_header_errno_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_limits_h=yes +ac_cv_header_stdarg_h=yes +ac_cv_header_stdbool_h=yes +ac_cv_header_stddef_h=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdio_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_time_h=yes +ac_cv_header_unistd_h=yes +ac_cv_host=x86_64-pc-linux-gnu +ac_cv_objext=o +ac_cv_path_GREP=/usr/bin/grep +ac_cv_path_SED=/usr/bin/sed +ac_cv_path_install='/usr/bin/install -c' +ac_cv_path_mkdir=/usr/bin/mkdir +ac_cv_prog_AWK=gawk +ac_cv_prog_CC_FOR_TARGET_FOUND=yes +ac_cv_prog_FIND_FOUND=yes +ac_cv_prog_GZIP_FOUND=yes +ac_cv_prog_LD_FOR_TARGET_FOUND=yes +ac_cv_prog_NASM_FOUND=yes +ac_cv_prog_OBJCOPY_FOR_TARGET_FOUND=yes +ac_cv_prog_OBJDUMP_FOR_TARGET_FOUND=yes +ac_cv_prog_READELF_FOR_TARGET_FOUND=yes +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_ac_ct_STRIP_FOUND=strip +ac_cv_prog_cc_c11= +ac_cv_prog_cc_g=yes +ac_cv_prog_cc_stdc= + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +AWK='gawk' +BUILDDIR='/home/wpng1337/Zovboot/ZOVboot/limine/build-test' +BUILD_BIOS='limine-bios' +BUILD_BIOS_CD='no' +BUILD_BIOS_PXE='no' +BUILD_UEFI_AARCH64='' +BUILD_UEFI_CD='no' +BUILD_UEFI_IA32='' +BUILD_UEFI_LOONGARCH64='' +BUILD_UEFI_RISCV64='' +BUILD_UEFI_X86_64='limine-uefi-x86-64' +CC='gcc' +CC_FOR_TARGET='clang' +CC_FOR_TARGET_FOUND='yes' +CFLAGS='-g -O2 -pipe' +CFLAGS_FOR_TARGET=' -g -O2 -pipe' +CPPFLAGS='' +CPPFLAGS_FOR_TARGET='' +DEFS='-DPACKAGE_NAME=\"ZOVboot\" -DPACKAGE_TARNAME=\"zovboot\" -DPACKAGE_VERSION=\"UNVERSIONED\" -DPACKAGE_STRING=\"ZOVboot\ UNVERSIONED\" -DPACKAGE_BUGREPORT=\"https://git.bebrik.xyz/Zhirik1337/ZOVboot\" -DPACKAGE_URL=\"https://git.bebrik.xyz/Zhirik1337/ZOVboot\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STDBOOL_H=1 -DHAVE_STDARG_H=1 -DHAVE_STRING_H=1 -DHAVE_ERRNO_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_TIME_H=1' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EXEEXT='' +FIND_FOUND='yes' +GREP='/usr/bin/grep' +GZIP_FOUND='yes' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +LDFLAGS='' +LDFLAGS_FOR_TARGET='' +LD_FOR_TARGET='ld' +LD_FOR_TARGET_FOUND='yes' +LIBOBJS='' +LIBS='' +LIMINE_COPYRIGHT='Copyright (C) 2019-2026 Mintsuki and contributors.' +LTLIBOBJS='' +MKDIR_P='/usr/bin/mkdir -p' +MTOOLS_FOUND='' +NASMFLAGS_FOR_TARGET='-g' +NASM_FOUND='yes' +OBJCOPY_FOR_TARGET='objcopy' +OBJCOPY_FOR_TARGET_FOUND='yes' +OBJDUMP_FOR_TARGET='objdump' +OBJDUMP_FOR_TARGET_FOUND='yes' +OBJEXT='o' +PACKAGE_BUGREPORT='https://git.bebrik.xyz/Zhirik1337/ZOVboot' +PACKAGE_NAME='ZOVboot' +PACKAGE_STRING='ZOVboot UNVERSIONED' +PACKAGE_TARNAME='zovboot' +PACKAGE_URL='https://git.bebrik.xyz/Zhirik1337/ZOVboot' +PACKAGE_VERSION='UNVERSIONED' +PATH_SEPARATOR=':' +READELF_FOR_TARGET='readelf' +READELF_FOR_TARGET_FOUND='yes' +REGEN_DATE='UNVERSIONED' +SED='/usr/bin/sed' +SHELL='/bin/sh' +SOURCE_DATE_EPOCH='1546297200' +SOURCE_DATE_EPOCH_TOUCH='201901010000' +SRCDIR='/home/wpng1337/Zovboot/ZOVboot/limine' +STRIP='strip' +STRIP_FOUND='yes' +TOOLCHAIN_FOR_TARGET='llvm-' +WERROR_FLAG='-Wno-error' +ac_ct_CC='gcc' +bindir='${exec_prefix}/bin' +build='x86_64-pc-linux-gnu' +build_alias='' +build_cpu='x86_64' +build_os='linux-gnu' +build_vendor='pc' +datadir='${datarootdir}' +datarootdir='${prefix}/share' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +dvidir='${docdir}' +exec_prefix='${prefix}' +host='x86_64-pc-linux-gnu' +host_alias='' +host_cpu='x86_64' +host_os='linux-gnu' +host_vendor='pc' +htmldir='${docdir}' +includedir='${prefix}/include' +infodir='${datarootdir}/info' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localedir='${datarootdir}/locale' +localstatedir='${prefix}/var' +mandir='${datarootdir}/man' +oldincludedir='/usr/include' +pdfdir='${docdir}' +prefix='/usr/local' +program_transform_name='s,x,x,' +psdir='${docdir}' +runstatedir='${localstatedir}/run' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +/* confdefs.h */ +#define PACKAGE_NAME "ZOVboot" +#define PACKAGE_TARNAME "zovboot" +#define PACKAGE_VERSION "UNVERSIONED" +#define PACKAGE_STRING "ZOVboot UNVERSIONED" +#define PACKAGE_BUGREPORT "https://git.bebrik.xyz/Zhirik1337/ZOVboot" +#define PACKAGE_URL "https://git.bebrik.xyz/Zhirik1337/ZOVboot" +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_STDBOOL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STRING_H 1 +#define HAVE_ERRNO_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_TIME_H 1 + +configure: exit 0 diff --git a/limine/build-test/config.status b/limine/build-test/config.status new file mode 100755 index 0000000..37f3db9 --- /dev/null +++ b/limine/build-test/config.status @@ -0,0 +1,940 @@ +#! /bin/sh +# Generated by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by ZOVboot $as_me UNVERSIONED, which was +generated by GNU Autoconf 2.72. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +# Files that config.status was made for. +config_files=" man/man1/limine.1 GNUmakefile config.h" + +ac_cs_usage="\ +'$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to . +ZOVboot home page: ." + +ac_cs_config='--enable-bios --enable-uefi-x86-64 LD_FOR_TARGET=ld OBJCOPY_FOR_TARGET=objcopy OBJDUMP_FOR_TARGET=objdump READELF_FOR_TARGET=readelf' +ac_cs_version="\ +ZOVboot config.status UNVERSIONED +configured by ../configure, generated by GNU Autoconf 2.72, + with options \"$ac_cs_config\" + +Copyright (C) 2023 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='/home/wpng1337/Zovboot/ZOVboot/limine/build-test' +srcdir='..' +INSTALL='/usr/bin/install -c' +MKDIR_P='/usr/bin/mkdir -p' +AWK='gawk' +test -n "$AWK" || AWK=awk +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: '$1' +Try '$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +if $ac_cs_recheck; then + set X /bin/sh '../configure' '--enable-bios' '--enable-uefi-x86-64' 'LD_FOR_TARGET=ld' 'OBJCOPY_FOR_TARGET=objcopy' 'OBJDUMP_FOR_TARGET=objdump' 'READELF_FOR_TARGET=readelf' $ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=/bin/sh $*" >&6 + CONFIG_SHELL='/bin/sh' + export CONFIG_SHELL + exec "$@" +fi + +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "man/man1/limine.1") CONFIG_FILES="$CONFIG_FILES man/man1/limine.1" ;; + "GNUmakefile") CONFIG_FILES="$CONFIG_FILES GNUmakefile" ;; + "config.h") CONFIG_FILES="$CONFIG_FILES config.h" ;; + + *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to '$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with './config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +cat >>"$ac_tmp/subs1.awk" <<\_ACAWK && +S["LTLIBOBJS"]="" +S["LIBOBJS"]="" +S["LIMINE_COPYRIGHT"]="Copyright (C) 2019-2026 Mintsuki and contributors." +S["NASMFLAGS_FOR_TARGET"]="-g" +S["LDFLAGS_FOR_TARGET"]="" +S["CPPFLAGS_FOR_TARGET"]="" +S["CFLAGS_FOR_TARGET"]=" -g -O2 -pipe" +S["GZIP_FOUND"]="yes" +S["NASM_FOUND"]="yes" +S["BUILD_UEFI_CD"]="no" +S["MTOOLS_FOUND"]="" +S["BUILD_UEFI_LOONGARCH64"]="" +S["BUILD_UEFI_RISCV64"]="" +S["BUILD_UEFI_AARCH64"]="" +S["BUILD_UEFI_X86_64"]="limine-uefi-x86-64" +S["BUILD_UEFI_IA32"]="" +S["BUILD_BIOS"]="limine-bios" +S["BUILD_BIOS_PXE"]="no" +S["BUILD_BIOS_CD"]="no" +S["READELF_FOR_TARGET_FOUND"]="yes" +S["OBJDUMP_FOR_TARGET_FOUND"]="yes" +S["OBJCOPY_FOR_TARGET_FOUND"]="yes" +S["LD_FOR_TARGET_FOUND"]="yes" +S["CC_FOR_TARGET_FOUND"]="yes" +S["READELF_FOR_TARGET"]="readelf" +S["OBJDUMP_FOR_TARGET"]="objdump" +S["OBJCOPY_FOR_TARGET"]="objcopy" +S["LD_FOR_TARGET"]="ld" +S["CC_FOR_TARGET"]="clang" +S["TOOLCHAIN_FOR_TARGET"]="llvm-" +S["STRIP_FOUND"]="yes" +S["STRIP"]="strip" +S["FIND_FOUND"]="yes" +S["AWK"]="gawk" +S["GREP"]="/usr/bin/grep" +S["SED"]="/usr/bin/sed" +S["INSTALL_DATA"]="${INSTALL} -m 644" +S["INSTALL_SCRIPT"]="${INSTALL}" +S["INSTALL_PROGRAM"]="${INSTALL}" +S["MKDIR_P"]="/usr/bin/mkdir -p" +S["WERROR_FLAG"]="-Wno-error" +S["OBJEXT"]="o" +S["EXEEXT"]="" +S["ac_ct_CC"]="gcc" +S["CPPFLAGS"]="" +S["LDFLAGS"]="" +S["CFLAGS"]="-g -O2 -pipe" +S["CC"]="gcc" +S["host_os"]="linux-gnu" +S["host_vendor"]="pc" +S["host_cpu"]="x86_64" +S["host"]="x86_64-pc-linux-gnu" +S["build_os"]="linux-gnu" +S["build_vendor"]="pc" +S["build_cpu"]="x86_64" +S["build"]="x86_64-pc-linux-gnu" +S["SOURCE_DATE_EPOCH_TOUCH"]="201901010000" +S["SOURCE_DATE_EPOCH"]="1546297200" +S["REGEN_DATE"]="UNVERSIONED" +S["BUILDDIR"]="/home/wpng1337/Zovboot/ZOVboot/limine/build-test" +S["SRCDIR"]="/home/wpng1337/Zovboot/ZOVboot/limine" +S["target_alias"]="" +S["host_alias"]="" +S["build_alias"]="" +S["LIBS"]="" +S["ECHO_T"]="" +S["ECHO_N"]="-n" +S["ECHO_C"]="" +S["DEFS"]="-DPACKAGE_NAME=\\\"ZOVboot\\\" -DPACKAGE_TARNAME=\\\"zovboot\\\" -DPACKAGE_VERSION=\\\"UNVERSIONED\\\" -DPACKAGE_STRING=\\\"ZOVboot\\ UNVERSIONED\\\" -DPACKAGE_BUGRE"\ +"PORT=\\\"https://git.bebrik.xyz/Zhirik1337/ZOVboot\\\" -DPACKAGE_URL=\\\"https://git.bebrik.xyz/Zhirik1337/ZOVboot\\\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -D"\ +"HAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1"\ +" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STDINT_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STDBOOL_H=1 -DHAVE_STDARG_H=1 -DHAVE_STRING_H=1 -DHAVE_ERRNO_H=1 -DHA"\ +"VE_INTTYPES_H=1 -DHAVE_LIMITS_H=1 -DHAVE_TIME_H=1" +S["mandir"]="${datarootdir}/man" +S["localedir"]="${datarootdir}/locale" +S["libdir"]="${exec_prefix}/lib" +S["psdir"]="${docdir}" +S["pdfdir"]="${docdir}" +S["dvidir"]="${docdir}" +S["htmldir"]="${docdir}" +S["infodir"]="${datarootdir}/info" +S["docdir"]="${datarootdir}/doc/${PACKAGE_TARNAME}" +S["oldincludedir"]="/usr/include" +S["includedir"]="${prefix}/include" +S["runstatedir"]="${localstatedir}/run" +S["localstatedir"]="${prefix}/var" +S["sharedstatedir"]="${prefix}/com" +S["sysconfdir"]="${prefix}/etc" +S["datadir"]="${datarootdir}" +S["datarootdir"]="${prefix}/share" +S["libexecdir"]="${exec_prefix}/libexec" +S["sbindir"]="${exec_prefix}/sbin" +S["bindir"]="${exec_prefix}/bin" +S["program_transform_name"]="s,x,x," +S["prefix"]="/usr/local" +S["exec_prefix"]="${prefix}" +S["PACKAGE_URL"]="https://git.bebrik.xyz/Zhirik1337/ZOVboot" +S["PACKAGE_BUGREPORT"]="https://git.bebrik.xyz/Zhirik1337/ZOVboot" +S["PACKAGE_STRING"]="ZOVboot UNVERSIONED" +S["PACKAGE_VERSION"]="UNVERSIONED" +S["PACKAGE_TARNAME"]="zovboot" +S["PACKAGE_NAME"]="ZOVboot" +S["PATH_SEPARATOR"]=":" +S["SHELL"]="/bin/sh" +_ACAWK +cat >>"$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain ':'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is 'configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + ac_datarootdir_hack=' + s&@datadir@&${datarootdir}&g + s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g + s&@infodir@&${datarootdir}/info&g + s&@localedir@&${datarootdir}/locale&g + s&@mandir@&${datarootdir}/man&g + s&\${datarootdir}&${prefix}/share&g' ;; +esac +ac_sed_extra=" + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 diff --git a/limine/build-test/man/man1/limine.1 b/limine/build-test/man/man1/limine.1 new file mode 100644 index 0000000..b1a08ee --- /dev/null +++ b/limine/build-test/man/man1/limine.1 @@ -0,0 +1,13 @@ +.TH LIMINE 1 "version UNVERSIONED" "UNVERSIONED" +.SH NAME +limine \- Multiplexer to several Limine-related utilities. +.SH SYNOPSIS +.B limine +.RI " " +.SH DESCRIPTION +\fBlimine\fR provides a series of Limine-related utilities condensed in a single executable. +.SH BUGS +Please report bugs via +.IR https://git.bebrik.xyz/Zhirik1337/ZOVboot . +.SH HOMEPAGE +.I https://git.bebrik.xyz/Zhirik1337/ZOVboot diff --git a/limine/common/drivers/disk.s2.c b/limine/common/drivers/disk.s2.c index eba8e24..b3cedc9 100644 --- a/limine/common/drivers/disk.s2.c +++ b/limine/common/drivers/disk.s2.c @@ -737,7 +737,7 @@ void disk_create_index(void) { if (status != EFI_SUCCESS) { fail: - panic(false, "LocateHandle for BLOCK_IO_PROTOCOL failed. Machine not supported by Limine UEFI."); + panic(false, "LocateHandle for BLOCK_IO_PROTOCOL failed. Machine not supported by ZOVboot UEFI."); } int optical_indices = 1, hdd_indices = 1; diff --git a/limine/common/entry.s3.c b/limine/common/entry.s3.c index 520232f..000abb4 100644 --- a/limine/common/entry.s3.c +++ b/limine/common/entry.s3.c @@ -56,7 +56,7 @@ noreturn void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) goto new_base_gotten; } } - deferred_error = "Limine does not support being loaded above 4GiB and no alternative loading spot found"; + deferred_error = "ZOVboot does not support being loaded above 4GiB and no alternative loading spot found"; goto defer_error; new_base_gotten: memcpy((void *)new_base, __slide, (size_t)image_size); @@ -98,7 +98,7 @@ defer_error: if (current_handle == NULL) { could_not_match: print("WARNING: Could not meaningfully match the boot device handle with a volume.\n"); - print(" Using the first volume containing a Limine configuration!\n"); + print(" Using the first volume containing a ZOVboot configuration!\n"); print("\n"); print("THIS IS A BUG! Please report this issue upstream.\n"); print("Press any key to continue...\n"); @@ -149,7 +149,7 @@ opened: stage3_common(); } - panic(false, "No volume contained a Limine configuration file"); + panic(false, "No volume contained a ZOVboot configuration file"); } EFI_GUID loaded_img_prot_guid = EFI_LOADED_IMAGE_PROTOCOL_GUID; diff --git a/limine/common/lib/bli.c b/limine/common/lib/bli.c index 4aee0f2..5dd6459 100644 --- a/limine/common/lib/bli.c +++ b/limine/common/lib/bli.c @@ -9,7 +9,7 @@ #include #include -#define LIMINE_BRAND L"Limine " LIMINE_VERSION +#define LIMINE_BRAND L"ZOVboot " LIMINE_VERSION static EFI_GUID bli_vendor_guid = { 0x4a67b082, 0x0a4c, 0x41cf, { 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f } }; diff --git a/limine/common/menu.c b/limine/common/menu.c index 22a89eb..462260c 100644 --- a/limine/common/menu.c +++ b/limine/common/menu.c @@ -867,9 +867,9 @@ noreturn void _menu(bool first_run) { { uint32_t eax, ebx, ecx, edx; if (!cpuid(0x80000001, 0, &eax, &ebx, &ecx, &edx) || !(edx & (1 << 29))) { - menu_branding = "Limine " LIMINE_VERSION " (ia-32, BIOS)"; + menu_branding = "ZOVboot " LIMINE_VERSION " (ia-32, BIOS)"; } else { - menu_branding = "Limine " LIMINE_VERSION " (x86-64, BIOS)"; + menu_branding = "ZOVboot " LIMINE_VERSION " (x86-64, BIOS)"; } } #elif defined (UEFI) @@ -877,13 +877,13 @@ noreturn void _menu(bool first_run) { { uint32_t eax, ebx, ecx, edx; if (!cpuid(0x80000001, 0, &eax, &ebx, &ecx, &edx) || !(edx & (1 << 29))) { - menu_branding = "Limine " LIMINE_VERSION " (ia-32, UEFI32)"; + menu_branding = "ZOVboot " LIMINE_VERSION " (ia-32, UEFI32)"; } else { - menu_branding = "Limine " LIMINE_VERSION " (x86-64, UEFI32)"; + menu_branding = "ZOVboot " LIMINE_VERSION " (x86-64, UEFI32)"; } } #else - menu_branding = "Limine " LIMINE_VERSION " (" + menu_branding = "ZOVboot " LIMINE_VERSION " (" #if defined (__x86_64__) "x86-64" #elif defined (__riscv) diff --git a/limine/common/protos/limine.c b/limine/common/protos/limine.c index fc2a220..2a316e4 100644 --- a/limine/common/protos/limine.c +++ b/limine/common/protos/limine.c @@ -932,7 +932,7 @@ FEAT_START struct limine_bootloader_info_response *bootloader_info_response = ext_mem_alloc(sizeof(struct limine_bootloader_info_response)); - bootloader_info_response->name = reported_addr("Limine"); + bootloader_info_response->name = reported_addr("ZOVboot"); bootloader_info_response->version = reported_addr(LIMINE_VERSION); bootloader_info_request->response = reported_addr(bootloader_info_response); diff --git a/limine/common/protos/multiboot1.c b/limine/common/protos/multiboot1.c index d7c5c20..24d4299 100644 --- a/limine/common/protos/multiboot1.c +++ b/limine/common/protos/multiboot1.c @@ -25,7 +25,7 @@ #include #include -#define LIMINE_BRAND "Limine " LIMINE_VERSION +#define LIMINE_BRAND "ZOVboot " LIMINE_VERSION #define MEMMAP_MAX 256 diff --git a/limine/common/protos/multiboot2.c b/limine/common/protos/multiboot2.c index 3acbdba..1947ae6 100644 --- a/limine/common/protos/multiboot2.c +++ b/limine/common/protos/multiboot2.c @@ -28,7 +28,7 @@ #include #include -#define LIMINE_BRAND "Limine " LIMINE_VERSION +#define LIMINE_BRAND "ZOVboot " LIMINE_VERSION #define MEMMAP_MAX 256 #define EFI_MEMMAP_MAX 1024 diff --git a/limine/configure.ac b/limine/configure.ac index 312a0d1..27448d1 100644 --- a/limine/configure.ac +++ b/limine/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Limine], [m4_esyscmd([./version.sh])], [https://codeberg.org/Limine/Limine/issues], [limine], [https://limine-bootloader.org/]) +AC_INIT([ZOVboot], [m4_esyscmd([./version.sh])], [https://git.bebrik.xyz/Zhirik1337/ZOVboot], [zovboot], [https://git.bebrik.xyz/Zhirik1337/ZOVboot]) AC_PREREQ([2.69]) @@ -132,9 +132,9 @@ GET_PROG([STRIP], [strip], [tool]) AC_CHECK_HEADERS([stdio.h stdlib.h stdint.h stddef.h stdbool.h stdarg.h string.h errno.h inttypes.h limits.h time.h], [], [AC_MSG_ERROR([required header not found])]) -AC_ARG_VAR([TOOLCHAIN_FOR_TARGET], [alternative toolchain prefix for Limine]) +AC_ARG_VAR([TOOLCHAIN_FOR_TARGET], [alternative toolchain prefix for ZOVboot]) -AC_ARG_VAR([CC_FOR_TARGET], [C compiler command for Limine]) +AC_ARG_VAR([CC_FOR_TARGET], [C compiler command for ZOVboot]) if test "x${CC_FOR_TARGET+set}" = "x"; then if test "x${TOOLCHAIN_FOR_TARGET+set}" = "x"; then CC_FOR_TARGET="clang" @@ -142,7 +142,7 @@ if test "x${CC_FOR_TARGET+set}" = "x"; then CC_FOR_TARGET="${TOOLCHAIN_FOR_TARGET}gcc" fi fi -AC_ARG_VAR([LD_FOR_TARGET], [linker command for Limine]) +AC_ARG_VAR([LD_FOR_TARGET], [linker command for ZOVboot]) if test "x${LD_FOR_TARGET+set}" = "x"; then if test "x${TOOLCHAIN_FOR_TARGET+set}" = "x"; then LD_FOR_TARGET="ld.lld" @@ -153,11 +153,11 @@ fi test "x${TOOLCHAIN_FOR_TARGET+set}" = "x" && TOOLCHAIN_FOR_TARGET=llvm- -AC_ARG_VAR([OBJCOPY_FOR_TARGET], [objcopy command for Limine]) +AC_ARG_VAR([OBJCOPY_FOR_TARGET], [objcopy command for ZOVboot]) test "x${OBJCOPY_FOR_TARGET+set}" = "x" && OBJCOPY_FOR_TARGET="${TOOLCHAIN_FOR_TARGET}objcopy" -AC_ARG_VAR([OBJDUMP_FOR_TARGET], [objdump command for Limine]) +AC_ARG_VAR([OBJDUMP_FOR_TARGET], [objdump command for ZOVboot]) test "x${OBJDUMP_FOR_TARGET+set}" = "x" && OBJDUMP_FOR_TARGET="${TOOLCHAIN_FOR_TARGET}objdump" -AC_ARG_VAR([READELF_FOR_TARGET], [readelf command for Limine]) +AC_ARG_VAR([READELF_FOR_TARGET], [readelf command for ZOVboot]) test "x${READELF_FOR_TARGET+set}" = "x" && READELF_FOR_TARGET="${TOOLCHAIN_FOR_TARGET}readelf" GET_PROG([CC_FOR_TARGET]) @@ -327,16 +327,16 @@ for cflag in $CFLAGS; do esac done -AC_ARG_VAR([CFLAGS_FOR_TARGET], [C flags for Limine]) +AC_ARG_VAR([CFLAGS_FOR_TARGET], [C flags for ZOVboot]) test "x${CFLAGS_FOR_TARGET+set}" = "x" && CFLAGS_FOR_TARGET="$BORROWED_CFLAGS" -AC_ARG_VAR([CPPFLAGS_FOR_TARGET], [C preprocessor flags for Limine]) +AC_ARG_VAR([CPPFLAGS_FOR_TARGET], [C preprocessor flags for ZOVboot]) test "x${CPPFLAGS_FOR_TARGET+set}" = "x" && CPPFLAGS_FOR_TARGET="" -AC_ARG_VAR([LDFLAGS_FOR_TARGET], [linker flags for Limine]) +AC_ARG_VAR([LDFLAGS_FOR_TARGET], [linker flags for ZOVboot]) test "x${LDFLAGS_FOR_TARGET+set}" = "x" && LDFLAGS_FOR_TARGET="" -AC_ARG_VAR([NASMFLAGS_FOR_TARGET], [nasm flags for Limine]) +AC_ARG_VAR([NASMFLAGS_FOR_TARGET], [nasm flags for ZOVboot]) test "x${NASMFLAGS_FOR_TARGET+set}" = "x" && NASMFLAGS_FOR_TARGET="-g" LIMINE_COPYRIGHT=$($GREP Copyright "$SRCDIR/COPYING") diff --git a/limine/host/limine.c b/limine/host/limine.c index f50ccc0..6b67f82 100644 --- a/limine/host/limine.c +++ b/limine/host/limine.c @@ -1194,7 +1194,7 @@ bios_boot_autodetected:; " the root, /boot, /limine, or /boot/limine directories of\n" " one of the partitions on the device, or boot will fail!\n"); - fprintf(stderr, "Limine BIOS stages installed successfully.\n"); + fprintf(stderr, "ZOVboot BIOS stages installed successfully.\n"); } ok = EXIT_SUCCESS; @@ -1222,7 +1222,7 @@ uninstall_mode_cleanup: #define CONFIG_B2SUM_SIGNATURE "++CONFIG_B2SUM_SIGNATURE++" static void enroll_config_usage(void) { - printf("usage: %s enroll-config \n", program_name); + printf("usage: %s enroll-config \n", program_name); printf("\n"); printf(" --reset Remove enrolled BLAKE2B, will not check config integrity\n"); printf("\n"); @@ -1380,9 +1380,9 @@ static int version(int argc, char *argv[]) { } } - puts("Limine " LIMINE_VERSION); + puts("ZOVboot " LIMINE_VERSION); puts(LIMINE_COPYRIGHT); - puts("Limine is distributed under the terms of the BSD-2-Clause license."); + puts("ZOVboot is distributed under the terms of the BSD-2-Clause license."); puts("There is ABSOLUTELY NO WARRANTY, to the extent permitted by law."); return EXIT_SUCCESS; } @@ -1392,7 +1392,7 @@ static void general_usage(void) { printf("\n"); printf(" --print-datadir Print the directory containing the bootloader files\n"); printf("\n"); - printf(" --version Print the Limine version (like the `version` command)\n"); + printf(" --version Print the ZOVboot version (like the `version` command)\n"); printf("\n"); printf(" --help | -h Display this help message\n"); printf("\n"); @@ -1405,7 +1405,7 @@ static int print_datadir(void) { puts(LIMINE_DATADIR); return EXIT_SUCCESS; #else - fprintf(stderr, "error: Cannot print datadir for `limine` built standalone.\n"); + fprintf(stderr, "error: Cannot print datadir for standalone ZOVboot.\n"); return EXIT_FAILURE; #endif } @@ -1427,7 +1427,7 @@ int main(int argc, char *argv[]) { #ifndef LIMINE_NO_BIOS return bios_install(argc - 1, &argv[1]); #else - fprintf(stderr, "error: Limine has been compiled without BIOS support.\n"); + fprintf(stderr, "error: ZOVboot has been compiled without BIOS support.\n"); return EXIT_FAILURE; #endif } else if (strcmp(argv[1], "enroll-config") == 0) {