From: Michael Tremer Date: Thu, 31 May 2018 12:46:56 +0000 (+0100) Subject: cdrom: Install GRUB into EFI image X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49e4dc21c34c1449588ac413d9baf137d6ccc134;p=people%2Fms%2Fipfire-2.x.git cdrom: Install GRUB into EFI image This will start GRUB on EFI systems when booting from CD Signed-off-by: Michael Tremer --- diff --git a/config/cdrom/grub-efi.cfg b/config/cdrom/grub-efi.cfg new file mode 100644 index 0000000000..6dd9511c45 --- /dev/null +++ b/config/cdrom/grub-efi.cfg @@ -0,0 +1,2 @@ +search --file --no-floppy --set=root /EFI/BOOT/grub.cfg +set prefix=($root)/EFI/BOOT/ diff --git a/lfs/Config b/lfs/Config index 8db3215709..d21623cb64 100644 --- a/lfs/Config +++ b/lfs/Config @@ -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 ############################################################################### diff --git a/lfs/cdrom b/lfs/cdrom index 3b6d0d390d..d21f69c7de 100644 --- 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" \