📜 ⬆️ ⬇️

Proper linux kernel booting from EFI to Macbook

I propose a somewhat free translation of the Gentoo programmer about the correct way to load on laptops with EFI instead of BIOC on board.
I recently bought a Macbook Pro 13.3 inch and I decided to put Gentoo Linux on it.

No sooner said than done. In general, the installation was successful, not counting small misunderstandings like a broken keyboard from under LiveCD, the kernel sees the console only with vesafb .

The only thing that bothered me a bit was the BIOS emulation. Macs use Intel's EFI for loading, and for the rest of the operating systems Apple added a BIOS emulation level. This is how Ubuntu is loaded on Macs.
')
It seemed to me wrong technically and in principle. I podnaprygsya a bit and I managed to run the Linux kernel from under EFI without any emulations . Documentation is not enough, so I want to share my way.

  1. EFI starts at boot.
  2. Runs rEFIt , a program that extends the capabilities of the default loader by adding a normal boot menu, command line, etc.
  3. It scans FAT/HFS partitions (ext * is not supported) looking for a boot that would contain the /efi/ directory; and boot images.
  4. Runs a Grub2 EFI image with a FAT partition.
  5. Boot the Linux kernel with /boot (+ initrd/initramfs if specified).
  6. The kernel, as usual, is loaded from the root partition, you can select any file system.

You can use elilo , but Grub2 (more precisely, Grub 1.97.1 ) does better, or rather, this is the only thing that at least works with minor modifications (add the efi flag to ebuild USE via --with-platform=efi ). I managed to configure the /boot partition on the FAT file system, but this installkernel script to run from the kernel source directory, which creates symbolic links to the new and previous kernel images.

Instructions for installing the EFI Grub2 image here . Install an EFI image in a directory, something like /efi/grub (there must be a path /efi ). You can skip the bless commands, they are for OS X. You can create a simple config file with the grub-mkconfig and then modify it. However, in order to make According to Mind ™ manually edit the files from /etc/grub.d/ .

Of course, you need to put EFI support in the kernel, but that's all. Now you realize with some manic-obsessive satisfaction that you don't need to connect an extra link to support another proprietary interface beyond your scope and control.

Source: https://habr.com/ru/post/85713/


All Articles