My question is, when there are multiple bootloaders (.efi) reside in ESP, are they identical? since they are all grub2. Can all of them discover all the kernel in the system?
If there are multiple UEFI Linux installations on a disk, they normally use the same EFI System Partition (ESP), but their respective EFI executables live in different subdirectories of the ESP, of the form
EFI/bootloader-id. The EFI executables have the same name; for 64 bit installations it is
grubx64.efi. So the EFI variables would be located at
These executables are installed by
grub-install running on their respective systems, though you might have to point
grub-install to that partition using
--efi-directory. And you may also have to choose the
--bootloader-id. Different Linux distributions have different defaults for
bootloader-id. For example, Debian defaults to
debian. For more information about
grub-install options, see
grub-install hard-wires the name of the boot/root devices into those executables using UUIDs.
These EFI executables are executed by the EFI firmware on the motherboard. Since the EFI executable knows the boot/root devices for its Linux installation, and since, by definition,
grub.cfg has a fixed location relative to the boot/root devices, the EFI executable can execute the
/boot/grub/grub.cfg corresponding to that installation. And
grub.cfg of course has all the information needed to do a boot, including the names of the kernels installed on the system.
The Arch Wiki GRUB page has good coverage of these matters.
See also the Debian Wiki UEFI page.