* Questions regarding bzr Install Branch
@ 2010-09-04 9:27 KESHAV P.R.
2010-09-04 17:59 ` Seth Goldberg
2010-09-09 7:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 2 replies; 5+ messages in thread
From: KESHAV P.R. @ 2010-09-04 9:27 UTC (permalink / raw)
To: grub-devel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Questions regarding bzr Install Branch
2010-09-04 9:27 Questions regarding bzr Install Branch KESHAV P.R.
@ 2010-09-04 17:59 ` Seth Goldberg
2010-09-08 12:49 ` KESHAV P.R.
2010-09-09 7:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
1 sibling, 1 reply; 5+ messages in thread
From: Seth Goldberg @ 2010-09-04 17:59 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: grub-devel
Hi,
Great question-- the answer is: this will be very OS-specific.
--S
On Sep 4, 2010, at 2:27 AM, "KESHAV P.R." <skodabenz@gmail.com> 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
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Questions regarding bzr Install Branch
2010-09-04 17:59 ` Seth Goldberg
@ 2010-09-08 12:49 ` KESHAV P.R.
0 siblings, 0 replies; 5+ messages in thread
From: KESHAV P.R. @ 2010-09-08 12:49 UTC (permalink / raw)
To: The development of GNU GRUB
Sorry for the late reply. How about implementing grub-probe support
for efisys atleast in linux systems. Linux has fairly mature UEFI
support, while FreeBSD and OpenSolaris are set to implement efi
support (in which case grub2 will be their default boot manager). A
new "parttype-guid" search option in grub-probe will allow accurate
search of efisys partition (atleast in a linux system) if possible.
Regarding /proc/efi or /sys/firmware/efi dirs for detecting efi boot
in configure, these dirs exist in case of linux only. I do not know
how FreeBSD or Solaris (or any other *unix OSes) respond to efi boot.
Also a custom grubprefix in grub-install will be great for efi systems
as multiple grub2 folders can coexist in the ESP using grub-install
(although it is not much difficult to manually copy *.mod and *.lst
files to a custom dir in ESP and generating a grub.efi from the BUILD
dir itself).
Regards.
Keshav
On Sat, Sep 4, 2010 at 23:29, Seth Goldberg <seth.goldberg@oracle.com> wrote:
> Hi,
>
> Great question-- the answer is: this will be very OS-specific.
>
> --S
>
> On Sep 4, 2010, at 2:27 AM, "KESHAV P.R." <skodabenz@gmail.com> 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
>> Grub-devel@gnu.org
>> http://lists.gnu.org/mailman/listinfo/grub-devel
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Questions regarding bzr Install Branch
2010-09-04 9:27 Questions regarding bzr Install Branch KESHAV P.R.
2010-09-04 17:59 ` Seth Goldberg
@ 2010-09-09 7:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-09-12 8:40 ` KESHAV P.R.
1 sibling, 1 reply; 5+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-09-09 7:31 UTC (permalink / raw)
To: grub-devel
On 09/04/10 11:27, KESHAV P.R. 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.
>
>
Most of systems supporting EFI also support BIOS. Also some users like
me have an annoying custom to moving HDDs from one computer to another.
The HDD which is in this machine right now is even bootable on 2
different ISAs (mipsel, i386 and x86_64). So the default behaviour
should be to install every available platform (we have a task on
savannah for this).
> 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.
It feels like such kind of check is outside of the scope of configure.
Also most of the users obtain their binaries from package manager in
which case the firmware of build machine is 100% irrelevant.
> 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.
>
>
I recommend in such case to build and install both variants and let the
firmware take whatever it needs.
> If the user runs ./configure in a non-Apple Pure UEFI system it should
> automatically setup
>
>
AFAIK most of "pure"-EFI systems are actualy servers. I expect server
admins to have a smallest clue what system they are running
> ./configure --with-platform=efi --target=(detected efi arch)
>
> instead of
>
> ./configure --with-platform=pc --target-i386
>
> which is what happens currently.
It's an idea to make --with-platform a comma-separated list and have
aliases efi64 and efi32, however the amount of work for it compared to
benefits is way too big, you're better of with a simple build script
like I have.
> 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.
>
>
"noefi" is specifically to ignore any possible EFI. If you're able to
distinguish efi and non-efi system both booted with noefi parameter it's
a bug.
> 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.
>
>
Right now it doesn't do anything fancy, it just relies on user to mount
it at the right place.
> 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 implemented --bootloader-id in install branch.
> 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
>
>
You shouldn't ever use --modules.
> 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.
>
--grub-prefix is a bad idea because you'll always find users who'll do
--grub-prefix= and have their root filled with modules.
> Regards.
>
> Keshav
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Questions regarding bzr Install Branch
2010-09-09 7:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2010-09-12 8:40 ` KESHAV P.R.
0 siblings, 0 replies; 5+ messages in thread
From: KESHAV P.R. @ 2010-09-12 8:40 UTC (permalink / raw)
To: The development of GNU GRUB
>
> I implemented --bootloader-id in install branch.
>
I tried the updated install branch (branch rev 2045). There is a
problem with the --bootloader-id option
lines 193 and 194 of util/grub-install.in
--bootloader_id=*)
bootloader_id=`echo "$option" | sed 's/--bootloader_id=//'` ;;
It should be
--bootloader-id=*)
bootloader_id=`echo "$option" | sed 's/--bootloader-id=//'` ;;
The --bootloader-id option provides the --grub-prefix functionality
that I wanted. However the default --prefix="" option for grub-mkimage
for efi has been removed with a common core.$imgext in grub-install
(line 552) in which the prefix is hard coded.
The grub.efi generated using --prefix="" (in line 560 of grub-install)
is replaced by core.efi being copied as grub.efi (in line 611).
Also since --boot-directory is set to replace --root-directory, how to
pass the efisys part mount point directly using --boot-directory
instead of --root-directory ( Eg:- efisys mounted at /media/efisys
instead of /boot/efi or /efi). Which is the standard efisys mount
point that grub2 assumes - /boot/efi or /efi or some other dir?
My efisys partition is currently mounted at /boot/efi (this is the
standard efisys mount point fedora/redhat uses - some systems may use
/efi ) , this is the grub-install command I used (x86_64-efi)
sudo grub-install --boot-directory=/boot/efi
--bootloader-id=grub2_install --no-floppy --recheck --debug /dev/sda
This command setup the grub efi along with the modules at
/boot/efi/grub2_install/ instead of the expected
/boot/efi/efi/grub2_install/
using --boot-directory=/boot/efi/efi setup grub2 at
/boot/efi/efi/grub2_install/ correctly.
Using --root-directory=/boot/efi also setup grub2 at
/boot/efi/efi/grub2_install/. So to directly pass the efisys part
mount point what should I use --root-directory or --boot-directory.
Also why is it compulsory to provide a install_device at the end of
grub-install command, in case of efi systems it is meaningless. There
was no need for passing /dev/sda or /dev/sdb etc to the old
grub-install command for efi that is present in the mainline.
Regards.
Keshav
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-12 8:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-04 9:27 Questions regarding bzr Install Branch KESHAV P.R.
2010-09-04 17:59 ` Seth Goldberg
2010-09-08 12:49 ` KESHAV P.R.
2010-09-09 7:31 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-09-12 8:40 ` KESHAV P.R.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.