help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a way to get the architecture of the machine just booted up


From: Andrei Borzenkov
Subject: Re: Is there a way to get the architecture of the machine just booted up by GRUB2: [32|64]-[amd|arm]? ...
Date: Mon, 18 Dec 2023 10:55:15 +0300

On Mon, Dec 18, 2023 at 9:51 AM Pascal Hambourg <pascal@plouf.fr.eu.org> wrote:
>
> On 18/12/2023 at 04:26, Andrei Borzenkov wrote:
> > On 17.12.2023 23:50, Pascal Hambourg wrote:
> > ...
> >>
> >> Note 2: there have been a few lightweight PC with 32-bit UEFI firmware
> >> and 64-bit x86 CPU around. To boot on these you need to install an x86
> >> 32-bit EFI image as bootia32.efi. It can boot i386 and amd64 kernels.
> >>
> > ...
> >>
> >> if [ $grub_cpu = x86_64 ]; then
> >>     # instructions to boot with amd64 kernel
> >> elif [ $grub_cpu = i386 ]; then
> >>     # instructions to boot with i386 kernel
> >
> > This obviously will not work for such systems as you mentioned earlier.
>
> 64-bit CPUs can run 32-bit kernels, so it will work but be sub-optimal.
> Or you can drop support for 32-bit CPUs and load a 64-bit kernel even
> with 32-bit UEFI.

Of course you can. You can also probably load a 32 bit kernel from a
64 bit grub. But it means that you cannot assume kernel architecture
is always equal to grub architecture and the simplistic code above is
too simple. We are back to the same question - what are criteria for
choosing the "right" kernel that grub needs to implement?

 > It seems that only early Intel Mac had 32-bit CPU and
> UEFI.
>

There are quite some boards. E.g. Intel BayTrail.

> > Besides, distributions may require additional CPU features beyond mere
> > "supports 64 bit".
>
> Do you mean 32-bit CPU features such as PAE ?
>

https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels



reply via email to

[Prev in Thread] Current Thread [Next in Thread]