diff options
-rw-r--r-- | doc/grub.md | 39 | ||||
-rw-r--r-- | grub/makefile | 26 | ||||
-rw-r--r-- | makefile | 8 | ||||
-rw-r--r-- | toolchain.makefile | 5 |
4 files changed, 73 insertions, 5 deletions
diff --git a/doc/grub.md b/doc/grub.md new file mode 100644 index 0000000..f112212 --- /dev/null +++ b/doc/grub.md @@ -0,0 +1,39 @@ +## Building with clang +There are three different build types: + + env | used for +-------|-----------------------|------------------- +build | building grub | CC, CFLAGS, etc. +host | running the utilities | BUILD +target | running grub | TARGET + +- set ``CC``, ``BUILD_CC`` and ``TARGET_CC`` to clang +`` +./configure --disable-werror --prefix=/ +make -j6 +make DESTDIR=../grub-tools/ install +`` + +### list of configure flags + flag | +-----------------------|--------------------------------------- +--enable-efiemu | efiemu runtimes +--enable-mm-debug | include memory manager debugging +--enable-cache-stats | enable disk cache stat collection +--enable-boot-time | enable boot time stat collection +--enable-grub-emu-sdl | build grub-emu with SDL support +--enable-grub-emu-pci | build grub-emu with PCI support +--enable-grub-mkfont | grub-mkfont +--enable-grub-themes | grub themes +--enable-grub-mount | grub mount +--enable-device-mapper | enable linux device-mapper support +--enable-liblzma | lzma compression +--enable-libzfs | libzfs +--disable-werror | do not use -Werror when building + +## grub tools +grub-file | check if file is of specified type +grub-script-check | check config for syntax errors + +## links +[tarballs](https://ftp.gnu.org/gnu/grub/) diff --git a/grub/makefile b/grub/makefile new file mode 100644 index 0000000..014b061 --- /dev/null +++ b/grub/makefile @@ -0,0 +1,26 @@ +CURL := curl -OL +GPG := gpg + +F := grub-2.04.tar.xz +srcdir := $(F:%.tar.xz=%) +dstdir := $(F:%.tar.xz=%-tools) + +default: + @echo $(SRCDIR) + +$(F): + $(CURL) https://ftp.gnu.org/gnu/grub/$(F) + +$(F).sig: + $(CURL) https://ftp.gnu.org/gnu/grub/$(F).sig + +verify: $(F) $(F).sig + $(GPG) --verify $(F).sig + +build: $(F) + tar -xf $(F) + cd $(srcdir) && CC=clang BUILD_CC=clang TARGET_CC=clang ./configure --disable-werror --prefix=/ + make -C $(srcdir) -j6 DESTDIR=$(CURDIR)/$(dstdir) install + +clean: + rm $(F) $(F).sig @@ -34,16 +34,16 @@ clean: @rm -rf $(AS_OBJ) $(CXX_OBJ) $(CXX_DEP) $(CXX_TEST_OBJ) glitch.elf isodir # testing -test: $(CXX_TEST_OBJ) check-grub -check-grub: glitch.elf - grub-file --is-x86-multiboot2 glitch.elf +test: $(CXX_TEST_OBJ) # disk image glitch.iso: glitch.elf grub/grub.cfg @mkdir -p isodir/boot/grub + $(GRUB_FILE) --is-x86-multiboot2 glitch.elf @cp glitch.elf isodir/boot/glitch.elf + $(GRUB_SCRIPT) grub/grub.cfg @cp grub/grub.cfg isodir/boot/grub/grub.cfg - @$(BOOT) -o $@ isodir + @$(GRUB_MKRESCUE) -o $@ isodir run: glitch.iso @$(EMU) $< diff --git a/toolchain.makefile b/toolchain.makefile index 9dc5b17..aa64c5b 100644 --- a/toolchain.makefile +++ b/toolchain.makefile @@ -19,6 +19,9 @@ CXX_INCLUDE := $(CURDIR)/libk $(CURDIR)/drivers CXX_SYSTEM_INCLUDE := $(CURDIR)/grub # -BOOT := grub-mkrescue +GRUB_MKRESCUE := grub-mkrescue +GRUB_FILE := grub-file +GRUB_SCRIPT := grub-script-check + EMU := qemu-system-i386 -cdrom |