Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
uefi install
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Tue Jun 02, 2015 6:43 am    Post subject: uefi install Reply with quote

Hi guys, i'm waiting a new m/b that is uefi, i've try to read some docs about it, but they all think you must use uefi because you use Windows. I'm tired of this Windows doc (shrinking/expending ntfs partition...), i don't care about Windows i want use my gentoo on uefi ; but i want kept a bootloader because i don't use just one kernel.

So i wonder how could i achieve this simply? What i expect is:
- no initrd (no, no, just no, i never use one, don't need one, and really don't want one)
- grub2 (i prefer grub legacy, but well, i could agree to switch) ; no other solve is good for me, i want keep a) the grub simplicity: add a kernel to its config, and boot b) the grub flexibility: edit in shell, and boot.
- no secureboot or shitty stuff, i will just disable this.
- can it be done without gpt disks, i have no 2tb disks, i don't need gpt (nor i care about partitions limitations...), so the same disks will be use with the new config.

That's it, is there a doc somewhere that show how i can just make the eufi boot to boot grub2 and never care about uefi anymore?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7130
Location: almost Mile High in the USA

PostPosted: Tue Jun 02, 2015 12:46 pm    Post subject: Reply with quote

UEFI is weird.

- Initramfs... The only reason for initramfs is to setup/identify disks. If you can identify disk partitions uniquely and the kernel can setup automatically, you don't need it. Generally partition identification was a problem in the past but GPT was first to have partition unique identification. But recent kernels should have PART_UUID that you can use to identify disks. Either way, UEFI won't change this aspect and you still need the kernel to identify and prepare the root partition.

- grub2 - If you still need grub, you'll have to stick with grub2 as it supports EFI and legacy does not (without hacks). There are other boot managers available of course. You could technically install EFI shell and use that instead - like my ia64 box uses that, and it's built into the firmware. I still use elilo on my ia64 box as the EFI stub didn't exist when I first used it. Either way, the trick is getting it or any bootloader or the stub to run, and supposedly all you need to do is have it on the EFI system partition in /EFI/BOOT/BOOTX64.efi (default for x86_64). However an EFI menu editor can change that. This modifies EFI configuration, and if it has been modified, you'll need to either change it or put it where the EFI config points to.

- secureboot. yes on x86 machines you can disable it. It is possible to satisfy it as RH got it working somehow. Probably as arcane as initramfs but initramfs isn't that arcane to me anymore.

- GPT - no you do not need GPT, MBR is OK, but if you don't want initramfs you may need it anyway.

I've only tried using UEFI due to necessity - two of my machines do not support MBR boot. My other UEFI capable machines are simply using legacy mode just because it's the same as it had always been...no need to change, just carry on...
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Tue Jun 02, 2015 6:48 pm    Post subject: Reply with quote

Thanks eccerr0r for the reply
eccerr0r wrote:

- grub2 - If you still need grub, you'll have to stick with grub2 as it supports EFI and legacy does not (without hacks). There are other boot managers available of course. You could technically install EFI shell and use that instead - like my ia64 box uses that, and it's built into the firmware. I still use elilo on my ia64 box as the EFI stub didn't exist when I first used it. Either way, the trick is getting it or any bootloader or the stub to run, and supposedly all you need to do is have it on the EFI system partition in /EFI/BOOT/BOOTX64.efi (default for x86_64). However an EFI menu editor can change that. This modifies EFI configuration, and if it has been modified, you'll need to either change it or put it where the EFI config points to.

By "EFI menu editor can change that", do you mean some kind of tool may change it by itself, crushing my previous changes?
I've read about the EFI boot partition, however nobody put any limit to it (except FAT32), i mean can i just swap my /boot partition to EFI and install grub in it (i see no conflict if the EFI is install in /(bootpart)/EFI/BOOT/whatevername.efi and i'm sure grub2 could boot a kernel from a FAT32 partition too. What do think?

Quote:
I've only tried using UEFI due to necessity - two of my machines do not support MBR boot. My other UEFI capable machines are simply using legacy mode just because it's the same as it had always been...no need to change, just carry on...

Crossing fingers if only the bios have that legacy mode, i could avoid all this.
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2152
Location: Berlin, Germany

PostPosted: Tue Jun 02, 2015 7:09 pm    Post subject: Reply with quote

I think he means efibootmgr, which you can use to edit your UEFI boot menu.

Booting in UEFI mode actually means that you don't need any separate boot loader like grub. You can enable CONFIG_EFI_STUB in your kernel config and tell UEFI to boot this executable directly.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7130
Location: almost Mile High in the USA

PostPosted: Tue Jun 02, 2015 7:12 pm    Post subject: Reply with quote

The EFI System Partition ("ESP", same as "boot partition") must be FAT, and typically FAT32. Normally you install system EFI binaries there and yes, if you have a boot partition for an MBR disk you can just reformat it for FAT32. I don't recall even requiring that you flag any specific partition type in MBR, I've been booting a 1GB SD card in a USB SD reader on a system that's EFI32 only.

This 1GB SD card was not partitioned and I have Grub2 installed on it, and the kernels I install on it as well. After you get the grub.efi image, installing is simply copying it onto the partition to the right name. Other than telling my tablet to not boot the onboard eMMC it autodetected the efi boot image that was simply "cp"'ed onto the fat32 partition.

As for the EFI menu editor, sys-boot/efibootmgr will muck with the EFI boot subsystem. Since it can change paths to the boot EFI image, hence the warning. Normally you can just put the image wherever EFI is already configured to ( \efi\boot\bootx64.efi typically, but if Windows was installed I'm not sure what Windows does, you should be able to replace Windows' EFI boot image) and you don't need to muck with the firmware menus.

Yes I'm glad I have two machines that support legacy boot, though the laptop I had to use Windows boot manager to chainload grub2 to boot Linux - just to make sure Windows can still hibernate properly.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Wed Jun 03, 2015 6:29 am    Post subject: Reply with quote

chithanh wrote:
I think he means efibootmgr, which you can use to edit your UEFI boot menu.

Booting in UEFI mode actually means that you don't need any separate boot loader like grub. You can enable CONFIG_EFI_STUB in your kernel config and tell UEFI to boot this executable directly.

Thank you chithanh
The kernel stub looks like an ok solution but have two limits:
The link doc (that is clear for one time), tells you to copy an CONFIG_EFI_STUB enable kernel as bootx64.efi : fine but this one name limitation is not going to help with multi-kernel, and i will loose the "trouble->shell->edit->boot grub recovery i love.
It looks like efibootmgr can indeed add additional kernels, but i will see how this works, as this time doing so you name the file vmlinuz.efi (that seems counter intuitive a bit, i would use a vmlinuz-3.6.11.efi from the example to do so), anyway, looks like efibootmgr can manage multi-kernel, but i'm unsure how it do that, it appears like some dirty hack and anytime you want boot another kernel, you must re-run efibootmgr that will simply rename the kernel you want boot to bootx64.efi... Or does you need to install efibootmgr as bootx64.efi to let the firmware load it (that would do like grub then)
But i will enable CONFIG_EFI_STUB in my kernels as a possible recovery usage.

It's pretty impressive how no docs speak about the bootx64.efi file content itself, or what files an efi bios will try loading (looks like at least bootx64.efi or bootx32.efi).
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7130
Location: almost Mile High in the USA

PostPosted: Wed Jun 03, 2015 6:54 am    Post subject: Reply with quote

There is a menu system in all EFI firmware hence efibootmgr can modify them, but not all EFI firmware will let you select arbitrary images before the OS is booted. Only if grub2 or EFI shell is installed (not sure about CLI of rEFInd). I only know of one machine that has EFI shell in firmware and that's my ia64 box - it's a full msdos-like shell (has commands like type, copy, cd, etc.) that can be scripted (.bat BATCH FILES oh the horrors!) to run EFI programs from diagnostics to OS images.

Incidentally,
\efi\boot\bootx64.efi - x86_64 (most common UEFI implementation)
\efi\boot\bootia32.efi - x86 "i386" (32-bit UEFI mainly seen in tablets and Apple hardware)
\efi\boot\bootia64.efi - ia64 "itanium EFI"

I don't know if bootx32 is used anywhere.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?


Last edited by eccerr0r on Wed Jun 03, 2015 6:59 am; edited 1 time in total
Back to top
View user's profile Send private message
s4e8
Guru
Guru


Joined: 29 Jul 2006
Posts: 309

PostPosted: Wed Jun 03, 2015 6:58 am    Post subject: Reply with quote

install rEFInd, it will scan all linux kernel and build a dynamic menu
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Wed Jun 03, 2015 7:28 am    Post subject: Reply with quote

after looking at sysrecuecd here's what i find:
- the bootx64.efi is able to boot 32 or 64bits kernel, no problem as long as you have a 64bits hw that can run that file.
- bootx64.efi is a Windows like content ; so i suppose more a windows console kindof file (omg the "This program cannot be run in DOS mode" message in it)
bootx64.efi: PE32+ executable (EFI application) x86-64 (stripped to external PDB), for MS Windows
- that file is in fact a grub part on sysrecuecd (that is using grub)

So that's it, grub (or other bootmanager) install its own starter as bootx64.efi, the uefi just run it, and your done, next depend on your bootloader (but at this point you have reach the point where bios as run what is in your MBR).
What is boring is that grub (even by telling it the platform is uefi) doesn't install that file itself as long as no uefi boot was done, preventing an easy migration (hence why i have built that sysrecuecd usb).
So i must wait to boot in uefi mode to configure everything. Yeah, boring...
This uefi isn't bad (it's the same if you compare booting bootx64.efi is like booting what is in your MBR), but how this is implement is.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7130
Location: almost Mile High in the USA

PostPosted: Wed Jun 03, 2015 7:36 am    Post subject: Reply with quote

The "magic" file in "file" is not good enough to tell the difference between an EFI binary and a Windows EXE binary. They share the same magic for some odd reason but they are not compatible. If you open an EFI file, you'll see the first two byte are "MZ" just like an EXE file but EFI binaries cannot be run under windows.

Code:
mikuru /uefi/Hewlett-Packard/SystemDiags $ file *.efi
CryptRSA32.efi:    MS-DOS executable
CryptRSA.efi:      MS-DOS executable
SystemDiags32.efi: MS-DOS executable
SystemDiags.efi:   MS-DOS executable


At least the grub image 'file' knows more about...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Wed Jun 03, 2015 8:32 am    Post subject: Reply with quote

Or maybe you are testing wrong files no?
if efi stub must be in /efi/boot (and still unsure about names possibilities, but at least bootx64.efi), doing file on this one will answer efi file, but you are doing it on files from /uefi/Hewlett-Packard/SystemDiags that could just really be ms/windows file in real (rename .efi because they are plain stupid), just like if you use grub, i don't think the next program grub stub will load is efi type, but linux type (elf).
I think you are looking at files that are loaded by your HP stub, some kind of recovery tools (like diag suggest) and in real you get the bootx64.efi (efi hp) -> running CryptRSA.efi (ms exe), just like bootx64.efi (efi grub) -> grub (elf) no?
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Wed Jun 03, 2015 8:45 am    Post subject: Reply with quote

delivery is here, lol i do think i'll be offline for a long long time :)
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7130
Location: almost Mile High in the USA

PostPosted: Wed Jun 03, 2015 1:44 pm    Post subject: Reply with quote

No, these are all EFI applications meant to be run under EFI. To EFI, any EFI application can be the "boot" application, and grub2/efishell/refind/etc. are basically just running another EFI application under another.

The "EFI stub" is just a bit of EFI stub code to make a kernel into an EFI application. And once it's an EFI application it can either be the boot application or a chainloaded boot application from some other EFI application.

EFI is a full blown OS really. Just that without the EFI shell, it doesn't look like it.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Wed Jun 03, 2015 2:40 pm    Post subject: Reply with quote

Ok, the good news, i'm able to boot legacy! Second good news my dirty hack on grub2 has work and so it boot
Bad news, my kernel 3.4.107 fail to recognize the ethernet device (hell, LTS mean long time, not frozen to shitty state!), but the 3.14 kernel from sysrescue see it (must explain why i could write this).
Pfff, i'll look at what e1000e version my kernel is using
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum