0

I'm creating a bootable USB with grub bootloader. The goal is to realize something with the highest possible compatibility both for BIOS and UEFI. So, first step, i normally installed grub bootloader for BIOS and copied a EFI bootloader compatible with both 32 and 64 bit EFI systems (copied the clonezilla one!). All boot-related files are in a ext4 partition.

Second step: the most important thing is that I want a unique grub.cfg file to edit instead of two (one for BIOS, other for EFI). My idea was to create two symbolic links with same target grub.cfg file. The idea worked well excpet for EFI Windows systems. That because they only support EFI bootable files in FAT32 partition, while I use an ext4 partition!

Now the problem: how to create something similar and equally useful in a FAT32 partition, which doesn't support symbolic links?

1

I don't understand what you actually did different and where your problem is, but may be we can figure it out.

Did you know that you can not only chainload other bootloaders like Windowx or OS X but other grub.cfg files?

search.fs_uuid 7bd6ae5a-b02b-4acf-b5f5-0d7c6b435d5b root hd0,gpt2
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

This code looks for the root filesystem with the specified UUID on the first hdd in the second partition. It sets a variable named prefix and finally boots grub.cfg from /boot/grub of the root filesystem. You may find this code in every FAT32 EFI system partition on Ubuntu. (The Fedora setup is ab bit different and stores kernels on the ESP and has a symlink of grub.cfg in /etc that links to the ESP IIRC, the Ubuntu configuration is as close to a symbolic link as possible in my opinion.) By default every grub EFI loader runs such a grub.cfg when no configuration is included into the the binary itself. (Yep, you may find a configuration file tacked to the end of the binary and some certificates if the binary is singed when you view the file in a hex editor.) So just modify this code to your needs that it loads the grub.cfg you want and place it on your ESP next to your bootx64.efi and bootia32.efi files. Package grub-efi-ia32-bin is available in Ubuntu 16.04 so you should be able to also install a 32-bit EFI loader. The only thing left is to configure the MBR loader.

What do you need to get your puzzle pieces together the way you want?

  • I think your answer could help me! Thanks. Let me try... – WD_SeaSerpent Jul 31 '16 at 16:54
  • Wait..I have to boot that code in a menu entry, didn't I? – WD_SeaSerpent Jul 31 '16 at 17:00
  • No you don't have to create a menu, it's a very simple configuration for a grub.cfg to place next to your bootx64.efi grub image. But it depends on what your current setup looks like e.g. which file is where. – LiveWireBT Jul 31 '16 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.