]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
cdrom: Install GRUB into EFI image
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 31 May 2018 12:46:56 +0000 (13:46 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 14 Jul 2018 12:43:50 +0000 (13:43 +0100)
This will start GRUB on EFI systems when booting from CD

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cdrom/grub-efi.cfg [new file with mode: 0644]
lfs/Config
lfs/cdrom

diff --git a/config/cdrom/grub-efi.cfg b/config/cdrom/grub-efi.cfg
new file mode 100644 (file)
index 0000000..6dd9511
--- /dev/null
@@ -0,0 +1,2 @@
+search --file --no-floppy --set=root /EFI/BOOT/grub.cfg
+set prefix=($root)/EFI/BOOT/
index 8db3215709eb98624d87f018948d87b9a1cea56e..d21623cb64d17035a31c5563bbf7ac06af6a1af6 100644 (file)
@@ -82,8 +82,63 @@ CCACHE_COMPILERCHECK += $(shell gcc -dumpspecs 2>/dev/null | md5sum | cut -d ' '
 # We support EFI on x86_64
 ifeq "$(BUILD_ARCH)" "x86_64"
        EFI = 1
+       EFI_ARCH = x64
 endif
 
+# Basic modules
+GRUB_EFI_MODULES = \
+       configfile \
+       efi_gop \
+       efi_uga \
+       gzio \
+       linux \
+       loadbios \
+       loadenv \
+       normal \
+       regexp
+
+# Stuff for accessing file systems
+GRUB_EFI_MODULES += \
+       ahci \
+       ext2 \
+       fat \
+       iso9660 \
+       part_gpt \
+       part_msdos \
+       udf
+
+# Graphics & IO
+GRUB_EFI_MODULES += \
+       all_video \
+       at_keyboard \
+       bitmap_scale \
+       font \
+       gfxmenu \
+       gfxterm \
+       jpeg \
+       png \
+       tga \
+       usb_keyboard
+
+# Commands
+GRUB_EFI_MODULES += \
+       boot \
+       cat \
+       chain \
+       echo \
+       halt \
+       help \
+       ls \
+       minicmd \
+       probe \
+       reboot \
+       search \
+       search_fs_file \
+       search_fs_uuid \
+       search_label \
+       test \
+       true
+
 ###############################################################################
 # Common Macro Definitions
 ###############################################################################
index 3b6d0d390d230f2e4a3a76eb358097436dd12a7d..d21f69c7de61e09531916ee286907c1e990bf956 100644 (file)
--- a/lfs/cdrom
+++ b/lfs/cdrom
@@ -119,12 +119,34 @@ ifneq "$(BUILD_PLATFORM)" "arm"
        cp /usr/lib/memtest86+/memtest.bin          /install/cdrom/boot/isolinux/memtest
        cp /usr/share/ipfire-netboot/ipxe.lkrn      /install/cdrom/boot/isolinux/netboot
        cp /usr/share/syslinux/isolinux.bin         /install/cdrom/boot/isolinux/isolinux.bin
+
 ifeq "$(EFI)" "1"
+       # Create the EFI Eltorito image
        dd if=/dev/zero of=/install/cdrom/boot/isolinux/efiboot.img bs=1k count=1440
        mkdosfs -F 12 -n "IPFIRE_EFI" /install/cdrom/boot/isolinux/efiboot.img
 
-       # XXX Some bootloader needs to be put in this image
+       # Build a GRUB EFI image
+       grub-mkimage \
+               --format=$(BUILD_ARCH)-efi \
+               --output=/tmp/boot$(EFI_ARCH).efi \
+               --config=$(DIR_SRC)/config/cdrom/grub-efi.cfg \
+               --compression=xz \
+               --prefix=/EFI/BOOT \
+               $(GRUB_EFI_MODULES)
+
+       # Mount the EFI image
+       mkdir -pv /install/efiboot.img
+       mount -o loop /install/cdrom/boot/isolinux/efiboot.img /install/efiboot.img
+
+       # Copy the bootloader into the image
+       mkdir -pv /install/efiboot.img/EFI/BOOT
+       cp -a /tmp/boot$(EFI_ARCH).efi /install/efiboot.img/EFI/BOOT/boot$(EFI_ARCH).efi
+
+       # Cleanup
+       umount /install/efiboot.img
+       rm -rf /install/efiboot.img /tmp/boot$(EFI_ARCH).efi
 endif
+
        cp /usr/share/hwdata/pci.ids                /install/cdrom/boot/isolinux/pci.ids
        cp -vf /usr/share/syslinux/*.c32            /install/cdrom/boot/isolinux/
        sed -e "s/VERSION/$(VERSION) - Core $(CORE)/g" \