OnMac.net: Windows XP on Intel Macs

Go Back   OnMac.net Forums > Alternative OSes on Apple Hardware > XOM - The open source solution > Developers
 
 
  #1  
Old 3rd April 2006, 11:34 AM
WandaLust WandaLust is offline
The Quiet Type
 
Join Date: Mar 2006
Posts: 21
Default EFI Programming Forum

This forum is about programming EFI, C/Assembler and I've started it to get moving on a full on CSM solution.

I want to open this thread as the frustration of trying to co-ordinate all the scattered information accross the net is amazing.

  #2  
Old 3rd April 2006, 12:51 PM
WandaLust WandaLust is offline
The Quiet Type
 
Join Date: Mar 2006
Posts: 21
Default


So to kick this off....

My aim is to create a fully functional CSM which provides the "Glue" for BIOS/VGA on any "Legacy" OS.

The XOM.efi is fantastic in it's achievement and I wish the source was available however it still isn't. It provides the initial target of getting XP installed and booted but I see this as the start of something better. I want to be able to put an undoctored CD/DVD for any OS (Linux, freeBSD, XP, 2000, vista etc) and install and boot just as if I were on a normal PC.

BamBIOS sounds like a plausable idea but not sure about it until something starts to come out although I don't think using the Bochs Bios is the best solution).

I think the final solution will be something like this :

ElTorito functionality provided by an EFI driver rather than coded into the EFI bootstrapper.

BIOS emulation possibly through an EFI driver (handles all interrupts and directs them to a module to process in EFI code).

VGA emulation possibly through an EFI driver

An Efi application (EFI Bootstrapper) would install the drivers (if not already installed) and possibly install itself in the NVRAM. This would be like xom.efi in that it would offer dual/triple boot functionality.

I'd also like to intercept the holding down c key for any other OS to provide CD level booting.


I have spent the best part of 3 weeks attempting to start work on creating a full solution and progress is slow. The issues I encounter are just how best to create the EFI. Their are so many little bits and pieces to get right and information is scattered accross the net. This forum hopes to get a collection together so we can all contribute and help each other out.

So far I have investigated the Intel Toolkit (essential really) building using nmake. All was fine until I began to work on the assembly part (Switching to Real mode to plug into the interrupts which the OS uses). I had to use ML.exe cause I couldn't get the toolkit to recognise and build the assembler modules.

My current status is as follows:

1) EFI boots okay and displays simple message
2) ElTorito CD functionality (initially coded into main module will be into a driver at some point) - Read CD and the Boot Block.
3) Passing control to the Assembler module to reconfigure the GDT/IDT and set up IVT tables.

So not great really... IVT table is not being setup properly and all weekend when I passed in a GDT table and tried to load it triple faulted and restarted. (I think relocation of code may be an issue here). However when I coded the GDT into the assembly module it hung rather than rebooted so some minor progress.

I am building on XP at the moment but would much rather get over and build on OS X.

So what I am hoping for is some help, information, platform tools that others have used and how they got them to work.

I think MASM is a pile of crap, options : NASM, TASM, FASM, GAS only using the Intel Toolkit and nmake causes all sorts of linking issues.

So any of you guys out there who have played with the EFI and gotten it to work I'd love to hear from you.

Also any one managed to test any of this stuff using the TianoCore Emulator ?

If there is enough support and programmers available lets get it on and perhaps set up a sourceforge project ?



Blanka - Narf you did good, but get that source out there...
  #3  
Old 3rd April 2006, 07:17 PM
rxcited rxcited is offline
Should be dual-booting by now.
 
Join Date: Mar 2006
Location: SF Bay Area
Posts: 54
Thumbs up Go for it Dude, or is it Dudette?

I cheer your effort WandaLust. I am not an assembly programmer or I'd offer to get involved. Maybe later when the tools and techniques are laid out for the assembly aspriant?

One question I have is rather than reinventing the wheel, why not use something like rEFIt?

http://refit.sourceforge.net

Or use the built in Mac boot loader? I don't know all the details about booting, maybe rEFIt uses this? The partial solution offered by Clay on his blog, looked promising. You hold option down when booting the Mac and get an iconic list of bootable volumes. When I do this now on my MBP 2.0Ghz, I get my "Machintosh HD" volume only. Clay was able to get it to the point of selecting an alternate volume and apparently got stuck on the VGA support part. He mentioned that there were some disadvantages to this technique which explains why Blanka didn't do it this way. Here's the blog I am referring to which includes some screen shots, the source code, and commentry by Blanka himself:

http://daemons.net/~clay/index.php/2006/03/15

What d'ya think?
__________________
-- Fuzz
  #4  
Old 3rd April 2006, 07:38 PM
WandaLust WandaLust is offline
The Quiet Type
 
Join Date: Mar 2006
Posts: 21
Default

Quote:
Originally Posted by rxcited
I cheer your effort WandaLust. I am not an assembly programmer or I'd offer to get involved. Maybe later when the tools and techniques are laid out for the assembly aspriant?

One question I have is rather than reinventing the wheel, why not use something like rEFIt?

http://refit.sourceforge.net

I've looked at refit and indeed have the source. I may tack the solution on the end of this if I ever get that far, however at the moment I am still at the very early stages of a development...

Or use the built in Mac boot loader? I don't know all the details about booting, maybe rEFIt uses this? The partial solution offered by Clay on his blog, looked promising. You hold option down when booting the Mac and get an iconic list of bootable volumes. When I do this now on my MBP 2.0Ghz, I get my "Machintosh HD" volume only. Clay was able to get it to the point of selecting an alternate volume and apparently got stuck on the VGA support part. He mentioned that there were some disadvantages to this technique which explains why Blanka didn't do it this way. Here's the blog I am referring to which includes some screen shots, the source code, and commentry by Blanka himself:

http://daemons.net/~clay/index.php/2006/03/15

What d'ya think?
I am using some of Clays code as a reference point and also have this code, however he is using a customised EFI build sequence and freeBSD. I am trying to use Windoze stuff and it's all getting a little interesting. The assembler part is the real difference between the two solutions, if only i could get objcopy to work properly on xp...
  #5  
Old 4th April 2006, 05:28 PM
chrisp chrisp is offline
Should be dual-booting by now.
 
Join Date: Mar 2006
Location: Stuttgart, Germany
Posts: 90
Default

The source code has been released and there is now a "Developers" forum, maybe this thread should be moved there?

(I'll comment on the actual discussion later.)
  #6  
Old 4th April 2006, 09:04 PM
chrisp chrisp is offline
Should be dual-booting by now.
 
Join Date: Mar 2006
Location: Stuttgart, Germany
Posts: 90
Default

Some random comments:

Quote:
Originally Posted by WandaLust
I am building on XP at the moment but would much rather get over and build on OS X.
Porting TianoCore or the Intel Toolkit to OS X would be a lot of work. You could have a look at gnu-efi instead. There are some issues with that, too, but at least it already works with gcc and GNU make. Remaining problems with gnu-efi are:
  • It only supports EFI 1.02 at this time. You have to bring your own headers for UGA, for example. (See my patch for elilo for reference.)
  • gnu-efi works by compiling the source with gcc, linking a shared object with a special linker script, then converting that ELF object to a PE32 binary using objcopy. OS X uses Mach-O instead of ELF, has a non-GNU linker, and lacks objcopy.

Possible workarounds for the second item are building a cross-compile environment for Linux i386 on OS X, or using Linux inside QEMU.

Quote:
Originally Posted by WandaLust
I'd also like to intercept the holding down c key for any other OS to provide CD level booting.
That might be a bit difficult, because Apple's loader handles this even before any user-written EFI module can gain control. (At least that's what I currently assume.) However, that function could be added to a second-stage boot menu like rEFIt.

Quote:
Originally Posted by WandaLust
So what I am hoping for is some help, information, platform tools that others have used and how they got them to work.
I have some tipps for getting the free Visual C++ 2005 Express Edition to produce EFI binaries; I'll post those to the wiki when I have the time. The Building elilo page at mactel-linux has some information about gnu-efi.

BTW, there's always the #winxponmac-dev channel on FreeNode IRC.

Quote:
Originally Posted by WandaLust
Also any one managed to test any of this stuff using the TianoCore Emulator ?
rEFIt runs fine under the Nt32 emulator, but I guess low-level BIOS-related code won't.

Quote:
Originally Posted by WandaLust
If there is enough support and programmers available lets get it on and perhaps set up a sourceforge project ?
Well, the source for XOM has been released, so you could build on that. In case you decide not to, I could offer the rEFIt project at SourceForge as an umbrella project for EFI/CSM coding.

Quote:
Originally Posted by rxcited
Or use the built in Mac boot loader? I don't know all the details about booting, maybe rEFIt uses this?
Some information about the Intel Mac boot process: http://refit.sourceforge.net/info/boot_process.html

Quote:
Originally Posted by rxcited
The partial solution offered by Clay on his blog, looked promising. You hold option down when booting the Mac and get an iconic list of bootable volumes. When I do this now on my MBP 2.0Ghz, I get my "Machintosh HD" volume only. Clay was able to get it to the point of selecting an alternate volume and apparently got stuck on the VGA support part.
From what I understand, clay used a second small HFS+ partition to put his loader/CSM on. Any blessed HFS+ volume will show up in the built-in chooser, but only if you hold Option on boot. XOM uses its own menu because it saves the extra partition and because the contest rules required that the user is asked on each boot.
  #7  
Old 4th April 2006, 09:20 PM
rxcited rxcited is offline
Should be dual-booting by now.
 
Join Date: Mar 2006
Location: SF Bay Area
Posts: 54
Default

Thanks Chrisp, interesting reading. I have noticed that if I use Startup Disk that it reblesses the OS X boot.efi file and I need to rebless xom.efi to get dual booting back. If a small HFS+ partition were used to select the XP boot, then I suppose Startup Disk would work without damaging the dual boot setup, the NVRAM settings would work for selecting the default boot volume (which could be XP if desired) so the Mac would boot into the last selected OS on power up, with no user intervention. The required "pause" to select the OS would in fact be present by holding the Option key. This all sound about right? I personally would prefer this.

But I guess this is all using Apple's boot mechanism and has nothing to do with rEFIt. I noticed you posted the patch to XOM to support rEFIt. Have you tested that or are you just laying the groundwork? Can you comment on how rEFIt might interact with the Apple and XOM mechanisms and contrast it to the XOM solution we have now?
__________________
-- Fuzz
  #8  
Old 5th April 2006, 09:30 AM
chrisp chrisp is offline
Should be dual-booting by now.
 
Join Date: Mar 2006
Location: Stuttgart, Germany
Posts: 90
Default

Quote:
Originally Posted by rxcited
I have noticed that if I use Startup Disk that it reblesses the OS X boot.efi file and I need to rebless xom.efi to get dual booting back.
Correct. Apparently the same happens on OS updates.
Quote:
Originally Posted by rxcited
If a small HFS+ partition were used to select the XP boot, then I suppose Startup Disk would work without damaging the dual boot setup, the NVRAM settings would work for selecting the default boot volume (which could be XP if desired) so the Mac would boot into the last selected OS on power up, with no user intervention.
Well, yes and no. xom.efi would still be the blessed loader for the small HFS+ partition (no "damage" there), but using Startup Disk will change NVRAM settings to boot from your OS X volume directly. The small HFS+ partition will not show up in Startup Disk; to select it as the boot volume you'd have to use 'bless --setBoot' or hold Option on boot to get the built-in chooser. Also, XOM will still display its menu and OS X is the default choice there.
Quote:
Originally Posted by rxcited
I noticed you posted the patch to XOM to support rEFIt. Have you tested that or are you just laying the groundwork?
I have tested the patch on my iMac and it works fine. By default, rEFIt will tell XOM to just boot Windows, but you can still access XOM's menu by pressing '+' on the Windows entry and choosing "Run xom.efi" from the submenu.
Quote:
Originally Posted by rxcited
Can you comment on how rEFIt might interact with the Apple and XOM mechanisms and contrast it to the XOM solution we have now?
I'm not sure what else there is to say. You may want to take a look at http://refit.sourceforge.net/info/boot_process.html for some more information about the boot process.
  #9  
Old 5th April 2006, 09:39 AM
WandaLust WandaLust is offline
The Quiet Type
 
Join Date: Mar 2006
Posts: 21
Default

So XOM is finally out there for all to see. I got it set up last night and have started to look at the processes used, I also have Clays stuff so these are both very good starting points.

The rEfit stuff I also have and very impressive. I may well tack onto the end of one of these projects when I get there...

My current aim is to try and intercept the INT calls and will be looking to implement them using EFI calls. I am going tonight to look to an OS i was writing last year which intercepts and remaps GDT, IDT etc and look at whether I can use this to intercept and process those IDT, GDT calls.

Looking at what Blanka and Clay have done.

Also as reading the post was beginning to wonder if we just replaced boot.efi with the xom.efi (i.e renamed xom.efi to boot.efi) and wondered what effect that would have. this would solve the reblessing issues but at this time not sure exactly what boot.efi does.

Anyway thanks for all the posts and keep em coming...
  #10  
Old 22nd August 2007, 04:31 PM
pipomolo42 pipomolo42 is offline
The Quiet Type
 
Join Date: Jun 2007
Posts: 16
Default

Hi,

I'm currently looking at CSM myself, and I was wondering: has everybody stopped since Apple released BootCamp ? As Wandalust said, it's really hard to find documents or people with knowledge about EFI ...

Also, it seems that Clays site is currently down. Could someone send me his work (provided that the license permits it) ? I would like to have a look at it.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump


All times are GMT +1. The time now is 10:53 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.