Hi, Great question-- the answer is: this will be very OS-specific.
--S On Sep 4, 2010, at 2:27 AM, "KESHAV P.R." <[email protected]> wrote: > How to detect whether a system has booted using (U)EFI and if so what > is the efi processor arch? This is not only for the grub-install > script but also the configure script. > > If configure is run in a non-Apple UEFI system (mostly x86_64-efi and > without bios compatibility) configure still sets up the makefiles as > i386-pc. My suggestion would be to test for existence of either > /proc/efi dir or /sys/firmware/efi dir to confirm that the kernel has > booted in efi. Even if the dir(s) exist(s), I do not know of any way > how to detect the booted efi arch (which can be independent of linux > kernel arch). My question is if a linux system is booted using grub2 > efi (arch unknown to the user) and he/she runs configure in that > system, is it possible for the configure system to detect the platform > (efi) and the efi arch (whatever it is) correctly. > > If the user runs ./configure in a non-Apple Pure UEFI system it should > automatically setup > > ./configure --with-platform=efi --target=(detected efi arch) > > instead of > > ./configure --with-platform=pc --target-i386 > > which is what happens currently. Another question would be detecting > efi boot when "noefi" kernel parameter is used (in which case the > /rpoc/efi or /sys/firmware/efi dirs will not exist). In such a cease > dmesg output may be useful. > > Regarding grub-install in install branch, does it detect the efisys > partition by checking the partition guids of the device (in case of > GPT) or checking for 0xEF type code (in case of MBR) or does it use > parted to check for existence of "boot" flag on any partition of a GPT > disk and then checking for FAT16/32 FS? I suggest adding guid > detection functionality in grub-probe for this purpose as that would > be the most accurate way of detecting efisys part (atleast in a GPT > disk). Also UEFI spec does not enforce any "only 1 efisys partition > per disk" rule. So if there are multiple FAT32 efisys partitions in a > disk, it is better to use the first such partition in the disk for > setting grub2 efi. > > Finally since efi allows multiple bootloaders, apart from the > <EFISYS_PART>/EFI/BOOT or <EFISYS_PART>/EFI/GRUB or > <EFISYS_PART>/EFI/<VENDOR or DISTRIBUTOR>, I would like to setupgrub2 > in the following way :- > > <EFISYS_PART>/EFI/GRUB2 and <EFISYS_PART>/EFI/GRUB2_EXP and such. > > I suggest a slight modification in grub-install script like below - > > grub-install --modules="<My list of modules for grub2 efi app>" > --root-directory="<EFISYS_PART_MountPoint>" > --grub-prefix="/EFI/grub2_Keshav" /dev/sda > > such that --grub-prefix overrides all grubprefix env variables in the > grub-install script and allow the user to specify in which folder in > the efisys should grub2 be installed. I may want to install grub2 > mainline in <EFISYS_PART>/EFI/grub2 and grub2 experimental branch in > <EFISYS_PART>/EFI/grub2_exp and the install branch in > <EFISYS_PART>/EFI/grub2_ins etc. > > The current grub-install script sets up grub2 in /boot/grub or > /boot/<program_transformed_name>. This --grub-prefix parameter in grub > install will enable the grub2 dir naming independent of the renaming > if the grub utils according to program_transform_name parameter passed > to configure. > > Regards. > > Keshav > > _______________________________________________ > Grub-devel mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/grub-devel _______________________________________________ Grub-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/grub-devel
