The Extensible Firmware Interface - an introduction
The Extensible Firmware Interface - an introduction
Posted Aug 12, 2011 20:11 UTC (Fri) by mturquette (subscriber, #54268)Parent article: The Extensible Firmware Interface - an introduction
It goes to show that we should jump to the Linux kernel much much earlier in the boot process. Modern SoCs like TI's OMAP have a configuration header that you can append to your binary (Linux kernel) to skip the whole boot loader issue entirely.
There have been real implementations of this on OMAP where the usual U-boot has been removed entirely; at power on ROM code parses the CH, then *boom* kernel decompression and party time.
I know other platforms can do similar stuff, and I also know that x86 is a world away from ARM SoCs... but still I can't help but think that BIOS, EFI, OpenFirmware, etc are all starting to sound a bit archaic.
Posted Aug 14, 2011 21:33 UTC (Sun)
by giraffedata (guest, #1954)
[Link] (13 responses)
It doesn't have to be the same Linux that will ultimately run on the machine; just something to load the real OS.
That's probably naive, but what's the problem? Is Linux too big? Too slow?
Reflecting on the fact that one often has to get a new motherboard or at least risk an in-situ BIOS upgrade in order to boot from a new type of device, I've often thought that motherboards should be able to do one thing at boot time: read bytes from USB storage device plugged into a particular socket inside the box and branch to them.
I'd put a Linux boot image on there, configured to load and bring up the real system. If I got a new kind of boot device, I'd just build a new Linux system with a driver for it and store it on that USB stick. If I accidentally bricked the system that way, I'd just plug in a different USB stick and recover.
Posted Aug 15, 2011 9:25 UTC (Mon)
by marcH (subscriber, #57642)
[Link] (6 responses)
> I think it goes to show it would be simpler just to use Linux in place of DXE.
Isn't there any actual "LinuxBIOS" project out there?
> That's probably naive, but what's the problem? Is Linux too big? Too slow?
Not in the right place at the right time? GPLed?
Maybe a bit of all these.
Posted Aug 15, 2011 14:23 UTC (Mon)
by giraffedata (guest, #1954)
[Link] (5 responses)
It doesn't matter to me if it's USB, and I'm not aware of anyone proposing anything else.
The essential element of the concept is a separate removable storage device just for the bootloader. I can't think of anything other than a USB memory stick that would be practical for that, but if there is something, I'm all for it.
Posted Aug 15, 2011 22:08 UTC (Mon)
by marcH (subscriber, #57642)
[Link] (4 responses)
Posted Aug 18, 2011 19:36 UTC (Thu)
by giraffedata (guest, #1954)
[Link] (3 responses)
Posted Aug 22, 2011 12:41 UTC (Mon)
by marcH (subscriber, #57642)
[Link] (2 responses)
Granted, you can imagine dream and modular firmware code that can be selectively trimmed down on a per-platform basis. EFI might get there but why would you do this for (expensive) PC motherboards? A development effort to lose some of your customers?!
By the way USB + managed flash is among the most expensive solutions; this matters for low cost embedded systems.
Posted Aug 22, 2011 19:53 UTC (Mon)
by giraffedata (guest, #1954)
[Link] (1 responses)
I think you're pointing out the dilemma of standardization. You pick one of many paths in order to reap the benefits of uniformity, but at the cost of going down a path that isn't ideal for some, or even all, particular cases. Of course, we standardize all the time and companies that were relying on the protocol that didn't get chosen suck it up and switch.
Unless you're talking about losing customers because it costs more, you've misunderstood the proposal, because customers can still use all of those boot protocols -- the ROM loads from the USB device the bootloader that knows how to load Windows from a SATA drive.
I agree my scheme is not appropriate for embedded systems. It would add very little and cost a lot.
Posted Aug 22, 2011 22:35 UTC (Mon)
by marcH (subscriber, #57642)
[Link]
Yes something like that.
> you've misunderstood the proposal, because customers can still use all of those boot protocols -- the ROM loads from the USB device the bootloader that knows how to load Windows from a SATA drive.
I think I understood the proposal; it looks like we have different customers in mind. I am considering the "ROM loads from X" part while you are considering the "bootloader that knows..." part.
Posted Aug 19, 2011 9:53 UTC (Fri)
by etienne (guest, #25256)
[Link] (5 responses)
Well, they have first to recognise that the USB disk first sector contains executable code, else they will often jump to a lot of zero instructions.
But what I wanted to say is that at the bootloader level you do not have USB, you have OHCI, UHCI, EHCI or xHCI - and more in the embedded world.
Posted Aug 19, 2011 16:10 UTC (Fri)
by giraffedata (guest, #1954)
[Link] (4 responses)
I think I'd prefer that it not do that check. It's an opportunity for something to become incompatible.
But that is just between the bootstrap ROM and the USB host controller, both of which are permanently attached to the same piece of hardware in my scheme. So there's no chance of incompatibility.
The standardness of USB that I'm interested in is between the host controller/hub and the USB stick, such that you can 1) easily get media; and 2) easily write the media using pretty much any computer.
Posted Aug 22, 2011 14:39 UTC (Mon)
by etienne (guest, #25256)
[Link] (3 responses)
Well, they could have trusted that if the device contains a partition which is marked bootable, the device is itself bootable, but most BIOS manufacturer did not do so.
Note that in your scheme, you still want to simply write you Linux kernel to the USB disk (and not do "cat kernel > /dev/sdb") so you need a bootloader which will analyse the partitions and the filesystem inside it - so once the bootloader is running it still need access to the underlying device to access that file (using BIOS/EFI disk services), the BIOS/EFI still need to respond to USB interrupts.
Posted Aug 22, 2011 20:13 UTC (Mon)
by giraffedata (guest, #1954)
[Link] (2 responses)
I think you've misunderstood what the ROM bootloader does in this scheme. It is intentionally too dumb to choose a boot device. It always loads the next stage from the same physical place (a particular USB socket inside the box). The code loaded can use fancy intelligence that evolves with technology to choose a boot device from which to load the OS.
I don't know what you're saying because there are at least 3 things that can be called "bootloader" here. One is in ROM, one is in the first block of the USB first-level boot device, and one is the complete Linux system that resides on the first-level boot device.
The ROM boot loader doesn't know anything about partition tables or filesystems. It knows how to read the first block of a USB storage volume, plugged into a socket/hub/controller permanently married to that ROM. The contents of the USB volume is much like we once put on floppy disks: not "cat kernel >/dev/sdb", but "cat bootstrap loader2 kernel >/dev/sdb". Maybe the volume actually has a partition table and the kernel thus loaded knows how to find filesystems on the volume.
Posted Aug 23, 2011 9:36 UTC (Tue)
by etienne (guest, #25256)
[Link] (1 responses)
I wish it worked that way in the real world.
Posted Aug 23, 2011 18:05 UTC (Tue)
by giraffedata (guest, #1954)
[Link]
And in case it wasn't clear, this is exactly the point I opened the thread with, if BIOS means "the code fixed to the motherboard that boots the OS."
I would like to see that intelligence moved into a physically changeable, easily creatable storage device and suggest that a Linux system on a USB disk is the best choice for that.
I think it goes to show it would be simpler just to use Linux in place of DXE.
The Extensible Firmware Interface vs early Linux
The Extensible Firmware Interface vs early Linux
The Extensible Firmware Interface vs early Linux
You favor USB but other people/platforms favor something else. Anything else.
The Extensible Firmware Interface vs early Linux
I can't tell what point posting the URL listing lots of serial communication protocols is supposed to make. Is this perhaps a response to my saying I don't know of anyone proposing a protocol other than USB for talking to a bootstrap-only device? Has someone proposed some other serial communications protocol for that? Is there one you would recommend?
The Extensible Firmware Interface vs early Linux
The Extensible Firmware Interface vs early Linux
The Extensible Firmware Interface vs early Linux
A significant number of the interfaces in this list are used for booting. If you "simplify" your firmware design by hardcoding to any of these you will make users of the others unhappy.
A development effort to lose some of your customers?!
By the way USB + managed flash is among the most expensive solutions; this matters for low cost embedded systems.
The Extensible Firmware Interface vs early Linux
The Extensible Firmware Interface vs early Linux
How some do it is a little bit boring; in my experience with Gujin few BIOS will check that the Windows MBR is present by checking bytes at offset 0x0c to be identical to the Windows MBR ones.
IHMO checking the first byte would be better (either jmp or cli) when the 0xAA55 signature is present.
The complexity for the boot sequence is that you may be on a BIOS/EFI which only handle a previous generation (only USB1 on USB2 hardware, only USB2 on USB3 PCIe card) so you know where (PCI address) is the device you are booting from, but in Linux this PCI address do not exists because the full USB chipset is supported.
Handling these corner cases (as I tried in Gujin) is not really easy.
The Extensible Firmware Interface vs early Linux
Well, they have first to recognise that the USB disk first sector contains executable code, else they will often jump to a lot of zero instructions.
at the bootloader level you do not have USB, you have OHCI, UHCI, EHCI or xHCI - and more in the embedded world.
The Extensible Firmware Interface vs early Linux
I would say, checking that the beginning of the MBR is not completely blank is still acceptable, to allow someone to boot without removing all USB stick plugged-in - but checking Windows MBR assembly crosses the limit.
The Extensible Firmware Interface vs early Linux
I would say, checking that the beginning of the MBR is not completely blank is still acceptable, to allow someone to boot without removing all USB stick plugged-in - but checking Windows MBR assembly crosses the limit.
Note that in your scheme, you still want to simply write your Linux kernel to the USB disk (and not do "cat kernel > /dev/sdb") so you need a bootloader which will analyse the partitions and the filesystem inside it - so once the bootloader is running it still need access to the underlying device to access that file
The Extensible Firmware Interface vs early Linux
> It is intentionally too dumb to choose a boot device.
In real PC you buy today, the BIOS is doing a lot more than that, that is why people have so much problems booting off USB.
After a lot of debugging Gujin, I can tell you that (for instance) the EEEPc 900 BIOS will not report it has an extended BIOS disk service interface if it detect the 0x29 signature at offset 38. Also, the "HP Compaq 8000 Elite" PC will crash if it is booted with a USB device which do not contains 0x1F 0xFC 0xBE signature at 0xB (the windows MBR opcodes).
There is a reason why Grub has now the Windows MBR opcodes at its MBR beginning...
Also, I do not know of a single BIOS which will not test the 0xAA55 signature at the end of the MBR, and I have found BIOSes which will only boot if there is only a single partition on the device, and it is the 4th one - else the ROM code decides (without meaningful message displayed) that the device is not bootable, and the next device has to be tried.
(I think that was the test for ATAPI 100 Mbytes floppies).
The BIOS should be dumb, but in practice it does look at the MBR content, and because "there is no more floppies" the only test case is: does Windows boot.
The Extensible Firmware Interface vs early Linux
The BIOS should be dumb, but in practice it [isn't].