Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Yes, I know it's a kernel ;)

I saw this file when I was looking through the 64-bit ISO's of 13.04. I'm working on remixing them onto my flash drive. However, I want my remix to have an updated kernel compared to that of the CD. This means that I will have to make a vmlinux.efi.

Of course, to be able to make one means I have to know what it is.

Is it simply a plain old 64-bit kernel? Is it, perhaps, an EFI boot stub?

The boot stub aspect doesn't make sense because it's loaded from GRUB in EFI, and isn't even located in EFI/BOOT. Maybe it's just future-proofing if it is an EFI boot stub? An article I found on the community wiki said something along the lines of "it's called vmlinuz.efi" because it's 64-bit. That, too, seem a little weird. I mean, it helps to differentiate but a better name could have been chosen if it's not EFI bootable.

One thing that I find odd is that Isolinux and GRUB both load it in the same way as if it were just a kernel... so its actual purpose is a little mysterious. Can EFI boot stubs be loaded as normal kernels as well?

Well, the fact of the matter is that I can find no discussion about why this filename was chosen and what exactly it is. So, here's hoping that someone here knows what this is and how it works.

EDIT:

Info/MD5's of all kernels from Ubuntu, Kubuntu, Xubuntu, and Lubuntu CD's:

DISTRO: lubuntu
vmlinuz: Linux kernel x86 boot executable bzImage, version 3.8.0-19-generic (buildd@allspice) #29-Ubuntu SMP Wed Apr 17 18, RO-rootFS, swap_dev 0x5, Normal VGA
deacc3c3a21beb4913c43a00bb6d5e01  vmlinuz
DISTRO: kubuntu
vmlinuz: Linux kernel x86 boot executable bzImage, version 3.8.0-19-generic (buildd@allspice) #29-Ubuntu SMP Wed Apr 17 18, RO-rootFS, swap_dev 0x5, Normal VGA
deacc3c3a21beb4913c43a00bb6d5e01  vmlinuz
DISTRO: xubuntu
vmlinuz: Linux kernel x86 boot executable bzImage, version 3.8.0-19-generic (buildd@allspice) #29-Ubuntu SMP Wed Apr 17 18, RO-rootFS, swap_dev 0x5, Normal VGA
deacc3c3a21beb4913c43a00bb6d5e01  vmlinuz
DISTRO: ubuntu
vmlinuz.efi: Linux kernel x86 boot executable bzImage, version 3.8.0-19-generic (buildd@allspice) #29-Ubuntu SMP Wed Apr 17 18, RO-rootFS, swap_dev 0x5, Normal VGA
1919b5acd184538ecb978f6361f98bf1  vmlinuz.efi

The one from the Ubuntu ISO is clearly different. I'm beginning to think it must be an EFI boot stub kernel... but still haven't found anything to confirm or deny it.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The EFI stub loader is a component of the kernel, not a separate program. When the EFI stub loader is included in the kernel, that kernel file looks like a normal EFI program to the EFI, but it's still a normal kernel that can be loaded by the usual Linux boot loaders -- GRUB, LILO, ELILO, SYSLINUX, etc. The EFI stub has been available since kernel 3.3.0, and AFAIK, all Ubuntu kernels built since then have included this feature.

There's no law that says that kernels with EFI stub loaders have to have filenames that end in .efi. In fact, the kernels installed to the hard disk lack the .efi filename extension; this seems to be unique to the kernel on the installation disc, at least in Ubuntu. The EFI shell won't run a program unless it has a .efi extension, though. Thus, giving the kernel that filename provides one means of recovery and testing for advanced users that might otherwise be unavailable to them -- namely, manually launching the kernel from an EFI shell. I can't be sure, but I suspect that the Ubuntu developers are now naming their kernels in this way to provide this backup means of launching the kernel, or perhaps just to signify that it does contain EFI stub support. OTOH, the 32-bit Ubuntu installation disc's kernel lacks the .efi extension, but it does include EFI stub support. My suspicion is that the Ubuntu developers just aren't naming their kernels consistently.

It's possible to launch an EFI application (such as a Linux kernel with EFI stub support) from any location on the disk. The "casper" subdirectory is not a location where boot loaders normally reside, but it is possible to launch EFI programs from there.

Whatever source you read that says the 64-bit kernel has a .efi extension because it's a 64-bit kernel is wrong. In practice, the 32-bit version of Ubuntu has a kernel that lacks this extension, so there is a correlation in the Ubuntu world, but there's no causation involved. In Linux generally, a .efi extension does not indicate a 64-bit kernel -- there are plenty of 64-bit kernels that lack this extension, and it may be desirable to name a 32-bit kernel with that extension on a 32-bit UEFI-based computer (although Ubuntu doesn't do so). That filename extension simply identifies an EFI application, which can be 32-bit (x86/IA-32), 64-bit (x86-64/AMD64), or some other architecture (ARM or Itanium).

share|improve this answer
    
Thanks for the concise answer! I think all I really wanted to know was whether or not having stub loader code within the kernel would prevent it from being booted in some circumstances. But after looking at the menus and such it appears you're right... it's just a plain old kernel. The only reason that it would have an EFI extension is so that you can boot it from the firmware manager. I'm just confused as to why only the official installer did it this way and not the other variants. Is that kernel perhaps one that's signed with Canonical's SecureBoot key? –  Githlar Aug 9 '13 at 20:58
    
The answer to the question of why only some Ubuntu kernels have that extension is probably hidden deep in the minds of whoever decided on those details. Certainly I don't know (although I can speculate, as I did in my answer), and I don't know of any site where this detail is explained. –  Rod Smith Aug 9 '13 at 21:13
    
Guess I should contact the Live CD team ;) It's kind of weird though. You would think that being EFI executable would make it invalid for BIOS and vice versa (with the BIOS compatibility module most EFI has at the moment). –  Githlar Aug 10 '13 at 17:08
    
The EFI stub loader works because there were unused gaps in the kernel's file format that happened to correspond to the locations needed to define an EFI executable. This makes the change backwards-compatible. My impression is that this was a lucky coincidence. More generally, the kernel format has nothing to do with BIOS or EFI; with or without the EFI stub loader, Linux kernels can load with either firmware type with the help of a boot loader like LILO (BIOS), ELILO (EFI), or GRUB (BIOS or EFI). –  Rod Smith Aug 11 '13 at 3:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.