Don't ship 32-bit UEFI firmware on x86
Shipping a UEFI-bootable Linux distribution is a touch awkward[1], with the main sticking point being the necessity to produce boot media with multiple El-Torito images. An El-Torito image is either an image of a floppy disk or a small hard drive, embedded into the ISO. This allows BIOS systems to look for an El Torito image, hook some interrupts and then boot without the BIOS having to care about the fact that the image is embedded in an ISO-9660 filesystem. UEFI systems will look for an El-Torito image with a special tag - if they find it they'll mount it as a FAT filesystem and look for a bootloader, and if not they'll fall back to BIOS compatibility.
So, if you want a CD that'll boot on both BIOS and UEFI systems, you need two El-Torito images - one for BIOS, one for UEFI. Unfortunately, various BIOSes deal exceptionally badly with CD images that contain more than one El-Torito image. The most common failure case is to print a menu asking you to choose an option without labelling the options, but some will just fail outright. Thankfully, this is pretty much exclusively limited to 32-bit systems.
Things get irritatingly more complicated due to a quirk of UEFI. UEFI is based on executing code in native mode. That means that 32-bit UEFI systems can't execute 64-bit code in firmware, even if the CPU is capable of it. A 64-bit OS can only boot on 32-bit UEFI if it has very ugly compatibility hacks, including having to rewrite structures and register state every time it makes a UEFI call. The only OS I'm aware of that implements this is MacOS X. Having looked into what it'd take to implement it in Linux, I decided that hammering rusty nails through my feet would be a preferable use of time. Thankfully, I went drinking instead.
So distributions have a choice. They can either produce UEFI-bootable CD images for 32-bit x86 and risk failures on actual 32-bit systems, or they can ignore UEFI entirely on 32-bit and succeed in booting on all the hardware that people actually own[2]. Unsurprisingly, they tend to choose the second option.
So, if you're building an x86 hardware platform, don't ship with 32-bit UEFI. If you're stuck with a 32-bit CPU then just ship BIOS. If you have a 64-bit CPU then ship a 64-bit UEFI. If you ship with 32-bit UEFI, no significant existing Linux distribution will support you, and you'll face an uphill battle to convince them to do so.
32-bit UEFI. Just say what on earth were you thinking, please, no, can't you find a solution that doesn't involve me getting tetanus jabs.
(If you're worried about the extra memory consumption of 64-bit OSes, just encourage 32-bit userspace on a 64-bit kernel. Or just boot via BIOS)
[1] See the number that still don't manage it despite having had several years to adapt
[2] Until recently, the only vendor to ship 32-bit UEFI firmware on volume hardware was Apple. This was fine on their 32-bit systems, but on their 64-bit systems with 32-bit UEFI booting a 64-bit version of Windows would result in boot failure. Apple rectified this by stating that 64-bit Windows wasn't supported on platforms with 32-bit UEFI, which is a neat trick if you can manage it. 32-bit Windows (and Linux) was fine because it didn't include a UEFI boot image and so didn't trigger the bug.
So, if you want a CD that'll boot on both BIOS and UEFI systems, you need two El-Torito images - one for BIOS, one for UEFI. Unfortunately, various BIOSes deal exceptionally badly with CD images that contain more than one El-Torito image. The most common failure case is to print a menu asking you to choose an option without labelling the options, but some will just fail outright. Thankfully, this is pretty much exclusively limited to 32-bit systems.
Things get irritatingly more complicated due to a quirk of UEFI. UEFI is based on executing code in native mode. That means that 32-bit UEFI systems can't execute 64-bit code in firmware, even if the CPU is capable of it. A 64-bit OS can only boot on 32-bit UEFI if it has very ugly compatibility hacks, including having to rewrite structures and register state every time it makes a UEFI call. The only OS I'm aware of that implements this is MacOS X. Having looked into what it'd take to implement it in Linux, I decided that hammering rusty nails through my feet would be a preferable use of time. Thankfully, I went drinking instead.
So distributions have a choice. They can either produce UEFI-bootable CD images for 32-bit x86 and risk failures on actual 32-bit systems, or they can ignore UEFI entirely on 32-bit and succeed in booting on all the hardware that people actually own[2]. Unsurprisingly, they tend to choose the second option.
So, if you're building an x86 hardware platform, don't ship with 32-bit UEFI. If you're stuck with a 32-bit CPU then just ship BIOS. If you have a 64-bit CPU then ship a 64-bit UEFI. If you ship with 32-bit UEFI, no significant existing Linux distribution will support you, and you'll face an uphill battle to convince them to do so.
32-bit UEFI. Just say what on earth were you thinking, please, no, can't you find a solution that doesn't involve me getting tetanus jabs.
(If you're worried about the extra memory consumption of 64-bit OSes, just encourage 32-bit userspace on a 64-bit kernel. Or just boot via BIOS)
[1] See the number that still don't manage it despite having had several years to adapt
[2] Until recently, the only vendor to ship 32-bit UEFI firmware on volume hardware was Apple. This was fine on their 32-bit systems, but on their 64-bit systems with 32-bit UEFI booting a 64-bit version of Windows would result in boot failure. Apple rectified this by stating that 64-bit Windows wasn't supported on platforms with 32-bit UEFI, which is a neat trick if you can manage it. 32-bit Windows (and Linux) was fine because it didn't include a UEFI boot image and so didn't trigger the bug.
Tetanus
(Anonymous) 2013-08-01 08:25 am (UTC)(link)no subject
(Anonymous) 2013-08-01 02:13 pm (UTC)(link)no subject
(Anonymous) 2013-08-07 06:26 pm (UTC)(link)Can't agree with you on this one
(Anonymous) 2013-08-01 03:17 pm (UTC)(link)Re: Can't agree with you on this one
Re: Can't agree with you on this one
Clover Trail uses 32-bit UEFI
Re: Clover Trail uses 32-bit UEFI
Re: Clover Trail uses 32-bit UEFI
(Anonymous) 2013-08-29 03:43 pm (UTC)(link)Presumably none of this El Torito / ISO9660 stuff applies to thumb-drives and SD cards (when those are bootable), correct?
But don't you have the same problems with the BIOS sometimes not being willing to boot from a usb key that has been formatted with multiple partitions? Most usbkeys are 'supposed' to be formatted like floppies, with no partition table. Some multiboot tools format them like ZIP drives, with a partition table that is mostly empty. Other multiboot utils let you format your usbkey with HDD-style (non-GPT) partitions, so e.g. parttn#1 can be a 2gb fat32, and parttn#2 can be 6gb ext4 with a bootable 64bit Linux distro. Some BIOSes will "just work" with that config, and at least some distros will see both partitions on the usbkey, but when you put the same usbkey into winXP you only see the first fat32 partition (since XP doesn't grok ext4 by default).
I've heard that multi-partition usbkeys can conflict with some older BIOSes. If I want to build a multiboot portable usbkey-based image for a distro, which gives me the option of sticking the usbkey into these four types of machines:
1. 32-bit i686 cpu with legacy BIOS
2. 32-bit i686 cpu with UEFI BIOS
3. 64-bit x86_64 cpu with legacy BIOS
4. 64-bit x86_64 cpu with UEFI BIOS
Can it be done? Or do you run into similar problems as when you try to boot from CD in machines of type#2 in the list?
For extra credit, what if my distro also supports ARM, and I want to have a multiboot usbkey which also supports these:
5. 32-bit ARM cpu with whatever BIOS
6. 64-bit ARM cpu with whatever BIOS
I could go on, talking about booting different versions or spins of the distro, or other distros, and so on, but you get the point.
On a related note...
So what's the problem?
(Anonymous) 2013-08-04 05:33 pm (UTC)(link)Re: So what's the problem?
Re: So what's the problem?
(Anonymous) 2013-08-06 01:39 pm (UTC)(link)Re: So what's the problem?
Re: So what's the problem?
(Anonymous) 2013-08-07 02:48 am (UTC)(link)whose code in in this uefi?
(Anonymous) 2013-08-07 08:47 pm (UTC)(link)Thanks,
James
Re: whose code in in this uefi?
(Anonymous) 2013-08-07 08:49 pm (UTC)(link)James.
Re: whose code in in this uefi?
Re: whose code in in this uefi?
(Anonymous) 2013-08-07 09:11 pm (UTC)(link)Re: whose code in in this uefi?
no subject
(Anonymous) 2014-02-14 06:33 am (UTC)(link)no subject
(Anonymous) 2014-05-02 02:28 am (UTC)(link)I share your pain. Writing a UEFI32 bootloader to try and fire up a 64-bit Linux kernel right now.
no subject
no subject
(Anonymous) 2014-06-15 03:22 am (UTC)(link)no subject
no subject
(Anonymous) 2015-01-31 07:50 am (UTC)(link)However what doesn't work is any driver which requires access the device's ROM, such as the AMD Radeon graphics. The access to that ends when the boot loader ends the EFI boot services stage. By then either the bootloader (or the kernel started in EFI stub mode) needs to have copied out the ROM into RAM.
At the time of writing it's simply impossible to get to that point. Grub's linuxefi command conflates secure boot and a EFI stub boot, so if you are booting on a EFI with no support for secure boot it fails with a checksum error. Both Refind and Gummiboot currently have issues booting Linux in EFI stub mode. The radeon driver people NAKed a patch to take the ROM in a file, which would have at least been a work-around.
The result is no way to run Linux from EFI beyond text mode on 2006-era MacBooks. Note that you may not be able to easily run Linux from BIOS emulation mode either: only Bootcamp v4 lets you install non-Windows BIOS-using operating systems, so if you upgraded MacOS beyond that you'll need to reinstall MacOS.
All in all trying to get Linux working as an alternative to an out-of-support MacOS has been two months of continuing disappointment.
yeah umm
(Anonymous) 2015-10-12 01:52 am (UTC)(link)