Slashdot Mirror


CoreBoot (LinuxBIOS) Can Boot Windows 7 Beta

billybob2 writes "CoreBoot (formerly LinuxBIOS), the free and open source BIOS replacement, can now boot Windows 7 Beta. Videos and screenshots of this demonstration, which was performed on an ASUS M2V-MX SE motherboard equipped with a 2GHz AMD Sempron CPU, can be viewed on the CoreBoot website. AMD engineers have also been submitting code to allow CoreBoot to run on the company's latest chipsets, such as the RS690 and 780G."

20 of 207 comments (clear)

  1. What Benefit Does C Have Over Assembly? by eldavojohn · · Score: 4, Interesting
    On CoreBoot's benefits page, it lists:

    Written in C, contains virtually no assembly code

    What is the benefit of writing a BIOS in C over assembly code? Is it for transparency? Easier to catch bugs? Does compiling from C to machine assembly protect you from obvious errors in assembly? Is it for reusability of procedures, modules & packages?

    Oftentimes I have wished I knew more assembly so I could rewrite often used or expensive procedures to fit the target machine and try to optimize it. I don't know assembly well, however, and therefore don't mess with this. Doesn't handwritten assembly have the potential to be much faster than assembly compiled from C? I thought often run pieces of the Linux kernel were being rewritten into common architecture assembly languages because of this?

    I'm confused why mainboard companies don't write their BIOS in C if this is an obvious benefit--or is it that they do and all we ever get to see of it is the assembly that results from it?

    Can anyone more knowledgeable in this department answer these questions?

    --
    My work here is dung.
    1. Re:What Benefit Does C Have Over Assembly? by eldavojohn · · Score: 5, Interesting

      One word: agnostic. It becomes agnostic in C as opposed to ASM.

      Alright, at the risk of further revealing my stupidity--what does this matter? I mean, isn't the BIOS tied to the architecture of the chipset anyway? It's not like I'm going to write a C program that compiles into the BIOS for an x86 chipset and--oh, by the way--thank god I can also compile that down to a PowerPC binary! I don't think that any piece of that integrated circuit is going to be developed in a mirror fashion on a PPC architecture ... or is that common practice?

      Doesn't each BIOS target one particular machine assembly language anyway?

      --
      My work here is dung.
    2. Re:What Benefit Does C Have Over Assembly? by sprag · · Score: 4, Insightful

      Being in C, it is easier to see what the person writing it was doing, compared to assembly.

      Consider if you had to do some nasty computation such as finding what address is used for a given row and column on the screen:
      (in bad assembly)

      mov ax, row
      mov bx, col
      shl col,#1
      xor dx,dx
      mul ax,#80
      add ax,bx
      mov pos,ax

      Whereas in C it is:

      pos=(row*80)+(col*2);

      and much more readable.

    3. Re:What Benefit Does C Have Over Assembly? by Just+Some+Guy · · Score: 5, Informative

      Doesn't handwritten assembly have the potential to be much faster than assembly compiled from C?

      Short answer: no.

      Long answer: rarely. Optimizing compilers are so good these days that very few humans would be capable of writing better assembler, and I contend that no humans are capable of maintaining and updating such highly-tuned code.

      Embedded assembler makes a lot of sense when you're embedding small snippets inside inner loops of computationally expensive function. Outside that one specific case (and disregarding embedded development on tiny systems), there's not much need to mess with it. Note that need is not the same as reason. Learning assembler is good and valuable on its own, even if there are few practical applications for it. If nothing else, it'll cause you to write better C.

      --
      Dewey, what part of this looks like authorities should be involved?
    4. Re:What Benefit Does C Have Over Assembly? by richlv · · Score: 5, Insightful

      as coreboot targets many bioses and platforms, i'd expect portability to become so much more important.
      btw, i found an interview with coreboot developer at http://www.heise-online.co.uk/open/The-Open-Source-BIOS-is-Ten-An-interview-with-the-coreboot-developers--/features/112353/2. from there :

      "The real accomplishment was to be able to write memory and other early initialization code in C. Which is much easier to write and maintain then assembler. Assembly code is fragile when you change it, especially when you don't have a stack. C is much more robust â" the code is easier to change without breaking everything. This makes coreboot easier to work on, to contribute to and to maintain."

      --
      Rich
    5. Re:What Benefit Does C Have Over Assembly? by .tom. · · Score: 5, Informative

      Easier to maintain, more portable accross platforms, easier to do more complex stuff, easier to integrate/reuse existing librairies/code, etc.... ?

    6. Re:What Benefit Does C Have Over Assembly? by Anonymous Coward · · Score: 5, Informative

      Turns out that the amount of bugs in a given amount of lines of code is fairly constant, regardless of language. Thus, it takes fewer lines in C code = fewer bugs.

      Also, it is extremely rare that the compiler cannot emit more optimal code than what is hand-written - compilers are extremely good at optimizing these days. The more common trend is to provide hints & use intrinsics so that you get all the benefits of writing in C code (type checking, more readable code), but the compiler is better able to generate the assembly you want.

      You will almost never write better assembly than what the compiler outputs - remember, the compiler takes a "whole program" approach in that it makes optimizations across a larger section of code so that everything is fast. It is highly unlikely that you will be able to match this - your micro-optimization is more likely to slow things down.

      There is actually very little in the Linux kernel that is written in assembly (relatively compared to the amount of C code) - the only time it is, is because it is the only way of doing it to support multiple architectures, not performance. For performance, by far, the kernel code is written in C and relies on working with the compiler people to make sure that the code is optimal.

    7. Re:What Benefit Does C Have Over Assembly? by Anonymous Coward · · Score: 5, Informative

      It's easier to write structured programs in C than assembly.

      Well, it's much easier to write anything in C than assembly, but assembly lends itself to small pieces of self-contained code that do one thing only.

      The idea is that assembly is only used where is needs to be, because you have to do something that you can't do in C, such as fiddling around with the CPU's internal state. The rest is written as a collection of modules in C. To build a BIOS for a particular board, you just link the required modules together.

      That suggests the question "why not write the BIOS in C++, or Java, or whatever". Anything higher-level than C tends to require more complex runtime environments (which are usually written in C), while C requires nothing more than assembly. It's the highest level language commonly available that can run with absolutely no OS support at all.

    8. Re:What Benefit Does C Have Over Assembly? by salimma · · Score: 4, Insightful

      Doesn't handwritten assembly have the potential to be much faster than assembly compiled from C?

      For a piece of software that gets run once per boot, speed is probably not very critical. A typical BIOS completes its run in a couple of seconds.

      Using an optimizing C compiler also has a further potential benefit -- given that motherboards specifically target certain CPUs, you can optimize the BIOS code for that CPU family. Not sure how much improvement this will yield, though.

      --
      Michel
      Fedora Project Contribut
    9. Re:What Benefit Does C Have Over Assembly? by Hordeking · · Score: 4, Insightful

      My best guess is there are parts of a BIOS that are tied to the hardware architecture, and there are parts that aren't.

      For instance, what if you want to write a BIOS that can read an EXT3 partition?

      Actually, a BIOS that can read EXT would be kickass. My bios can only read FAT12 (and maybe FAT32 for a hdd) off the floppy. If I wanted EXT3 (or 2), I'd have to put that stuff in the "kernel" that gets loaded by the boot sector. That kernel, however is on a FAT12 partition =P As for TCP/IP, that would be nice to allow diskless boots. PXE anyone?

      --
      Disclaimer: The opinions and actions of the US Gov't are in no way representative of those held by this author or its ci
    10. Re:What Benefit Does C Have Over Assembly? by agbinfo · · Score: 4, Interesting

      Doesn't handwritten assembly have the potential to be much faster than assembly compiled from C?

      Short answer: no.

      Long answer: ...

      I don't know how good compilers have become but I've had to optimize generated code (for space and speed) a long time ago.

      To do this, I would write the best possible code in C first, then compile it and then optimize the generated assembler code.

      My point is that if you already start with the best code the compiler will provide, you can only improve from there.

      Also, in some situations, looking at the generated assembler code helped identify clues as to how writing the original C code could result in better performance.

      This was a long time ago, for an embedded application with very limited CPU and memory. I haven't had to do that since.

    11. Re:What Benefit Does C Have Over Assembly? by FrankSchwab · · Score: 4, Informative

      Writing in 'C' is an order of magnitude faster than writing in assembler; if you're building a system with 10 man-years of coding in it, that becomes really, really important.

      Imagine writing a host-side USB stack in assembler; a BIOS has to have that. Or writing an Ethernet driver and TCP/IP stack in assembler. Or any of the other large subsystems of a BIOS; the task would be daunting to me, a 20 year veteran of embedded systems (yes, my 'C' and Assembly mojo is strong).

      Assembler has proven its worth when sprinkled through embedded systems. When profiling finds the routines that are bottlenecks for time-critical functions, a good assembly programmer can often speed up the 'C' code by a factor of 2 to 10. But, this generally involves very small chunks of code - 10 to 50 lines of assembly.

      In most real systems, the vast majority of the code is executed rarely, and rarely has a performance impact. For example, on a modern dual-core, 2 GHz processor with a GB of RAM, the code used to the display the BIOS setup UI and handle user input will execute faster than human percepption in almost any language you could imagine (say, a PERL interpreter written in VB which generates interpreted LISP). There is no reason in the world to try to optimize performance here. Even in things like Disk I/O, the BIOS' job is mostly to boot the OS, then get the hell out of the way.

      --
      And the worms ate into his brain.
    12. Re:What Benefit Does C Have Over Assembly? by Kadin2048 · · Score: 4, Interesting

      As for TCP/IP, that would be nice to allow diskless boots. PXE anyone?

      Not only that, but a minimal TCP/IP stack in the BIOS would remove much of the reason for purchasing expensive remote-management add-in cards (and sacrificing PCI slots as a result) in order to perform hard reboots and view the boot console over a network. (Those cards are in themselves an alternative to even more expensive out-of-band management systems, using either the serial port or proprietary hardware interfaces.)

      Although there would be some obvious security concerns with such a system -- you wouldn't want to enable it by default on non-headless systems, clearly -- it would be a pretty neat feature and would go a long way towards making commodity servers (built up from semi-generic components, like Rackspace's) feature competitive with the big names. And it'd be nice, just in general, to get a standardized approach to true headless operation that was vendor-agnostic and didn't require the purchase of additional addon parts.

      --
      "Ladies and gentlemen, my killbot features Lotus Notes and a machine gun. It is the finest available."
  2. Most of the BIOS is probably generic by Giant+Electronic+Bra · · Score: 5, Insightful

    There may be SOME architecture specific code, even a lot of that can probably be written in C. 99% of the Linux kernel is C and that has to interact with hardware too.

    As far as efficiency goes, in the old days it was true that a coder with an intimate knowledge of the architecture could usually hand code more efficient assembly. Modern C compilers however can do a LOT of optimization and generally the resulting code is faster than anything that could be coded by hand, or at least AS fast. Even if it is microscopically slower it is still a LOT easier to use C. Plus if hardware abstraction is done properly even a low level driver back end should be portable for the most part.

    Manufacturer BIOS may be written in Assembly since they are A) targeting a specific board which is going to obviously only run that one family of chip and B) probably have a lot of legacy assembly code they would rather not bother to port to C. Neither of those would apply to Coreboot.

    --
    "Malo periculosam, libertatem quam quietam servitutem." -- Jefferson
  3. Re:Help! I'm conflicted! by KasperMeerts · · Score: 5, Insightful

    What's more important to you? OSS graphics drivers or OSS BIOS? And by the way, if you need a decent graphics card, you're gonna need ATI or nVidia anyways, Intel doesn't make really high performance cards.

    --
    As long as there are slaughterhouses, there will be battlefields.
  4. Re:Help! I'm conflicted! by 77Punker · · Score: 5, Informative

    Also, ATI has open source 2D drivers and just yesterday released specs that should allow for good open source 3D drivers. Sometime in the next 6 months, their graphics cards should support OpenCL, too. ATI is the way to go for open hardware support at the moment.

  5. Re:Boot Windows 7? So what? by Anonymous Coward · · Score: 5, Interesting

    Booting Linux (and other free operating systems) is relatively simple: They quite robust against quirks in the BIOS, as they're usually not part of the testsuite of the BIOS vendors.
    It's also possible to boot Linux (and a smaller set of other free operating systems) without any PCBIOS interface (int 0x13 etc), as they don't rely on that.

    Windows does. There has been, for a couple of years, a useful, but very fragile hack called ADLO, which was basically bochsbios ported onto coreboot, to provide the PCBIOS.
    Recently, SeaBIOS (a port of bochsbios to C) appeared and was a more stable, more portable choice (across chipsets) in that regard.

    So yes, we're proud that we can run the very latest Microsoft system, simply because it's less a given than booting Linux.
    Even VirtualBox (commercially backed, and all) seems to require an update (very likely to its BIOS!) to support Windows 7. "We were first" ;-)

  6. Re:EFI? by mhatle · · Score: 4, Informative

    EFI is useful in the same way Open Firmware on PowerPC and Sparc is useful. It gives you an extensable system that can do different things with devices. This is great on a system where you don't know what the hardware may be (i.e. Workstations).. but starts to fall down when you get to servers, blades or embedded systems.

    On most systems these days BIOS or any type takes between 3 and 30 seconds to boot to the OS. This is simply not acceptable to many blade and embedded system designs.. (Even some server designs this isn't acceptable.)

    I can boot a system with coreboot in a second or less to the OS. This is really the most important part of coreboot. (For embedded systems, most of the time our target is in the .2 to .5 range from power on to OS start... this almost all but excludes ia32 from many embedded applications today.)

  7. Re:EFI? by Cyberax · · Score: 4, Informative

    EFI allows lightning-fast boot.

    First, you can put your kernel in EFI (if there's enough flash) and boot it directly from there.

    Second, EFI itself is pretty much efficient - you have access to lots of RAM, CPU works in protected mode, etc.

    It's quite possible to have 1 second until kernel startup with EFI. Almost like on my 166Mhz MIPS board :)

  8. Re:Yay! Let's trade speed for dumb. by sveinungkv · · Score: 5, Informative

    Actually, Coreboot is faster. The record from power on to Linux login is, according to their FAQ, 3 seconds. Writing it in C speeds up development compared to writing it in assembly and allows compilers to optimize it.

    --
    Spelling/grammar nazis welcome (English is not my first language and I am trying to improve my spelling/grammar)