blkdev in oftree

Samuel Rydh mol-devel@lists.maconlinux.org
Thu, 23 Oct 2003 12:02:00 +0200


On Wed, Oct 22, 2003 at 06:51:18PM +0200, Axel Dörfler wrote:
> Samuel Rydh <samuel@ibrium.se> wrote:
> > However, after a closer look at the of-mol source code, I noticed 
> > that
> > the open/read/write methods of the mol-blk node are not connected
> > to the underlying infrastructure (I was pretty certain I had
> > implemented this, but the code is indeed not there...). The
> > pseudo filesystem (which contains files explicitly exported from
> > the molrc file) is supported though.
> > 
> > The of-mol implementation is currently used to boot MacOS 9
> > and linux (yaboot). In the former case, special support code
> > is used to find and load the boot image (the newworld ROM).
> > In the yaboot case, everything of interest resides in the
> > pseudo filesystem.
> 
> MacOS X doesn't need OpenFirmware to start?

Well, I tweaked Apple's bootx loader to talk to MOL directly
rather than to OF client interface. At that time, mol-of was not
a stand alone loader but a part of MOL proper and rather tightly
coupled to newworld booting. 

> It does all the hardware recognition by itself
> after the boot loader was started?

No, it relies on the device tree.

> > Adding OF functionality to the mol-blk node should be
> > simple enough; the infrastructure (like opening device specs)
> > is already present. It is mostly a question about associating
> > ihandles with the the corresponding device spec (or file spec
> > for that matter). The best solution would probably be to
> > use ihandles internally rather than a filesystem/fd pair.
> > I intend to address this issue shortly.
> 
> I am looking forward to this :-)

Done :-). I've pushed a new mol-of version which should have
full support for all the block device nodes. I haven even added
a scsi node which once can access any generic SCSI devices
exported by mol.

To test the new of code, pull the OF repository and build it:

	bk clone bk://mol.bkbits.net/of-mol of-mol
	bk -r co
	cd of-mol
	./setup_links /path/to/mol-source
	./configure ; make

You need to put something like

	of_image:	/path/to/of-mol/of

in the molrc file. You also need to use the latest mol version
from BK (it fixes a few oftree things).

> Is it possible to let the OF run in real mode (MSR[IR/DR]=0)?

MOL uses a 1-1 mapping internally so just turning of MSR[IR/DR] ought
to do the trick. Note that at the moment of-mol does not really
respect the virtual-address-base OF setting etc but occupies
a fixed physical position.

> I am 
> looking for a way to continue to have the OF functional after the OS is 
> running.
> Normally, the OF should maintain a list of translations needed to run 
> it (when it's in virtual mode, at least, although I think it always 
> should do it). If it's in real mode, I hope to be able to use the 
> memory/available property to find out which range should stay 
> untouched. How would I do it with MOL?

MOL does not really implement these properties. Memory allocations
are handled by ofmem.c and the following scheme is the defualt:

	0x00000000      Exception vectors       
	0x00004000      Free space
	0x01e00000      Open Firmware (us)
	0x01f00000      OF allocations
	0x01ff0000      PTE Hash
	0x02000000-     Free space

> > > BTW is it possible to get a prompt at OpenFirmware level?
> > No. Only the client side of OF is implemented (no forth
> > interpreting).
> 
> I think yaboot uses forth code at least in some place (dunno if it's 
> needed, though).

Yes, it does. Nothing important though.

> Is the "yaboot" boot loader name hardcoded into MOL? I think I changed 
> the OF variables, and it still looked for it, but maybe I've just 
> overlooked something else.

Yes, MOL-OF currently loads 'pseudo:,yaboot'. I will make this more
generic later. In the meantime, you can either edit the of-mol/main/main.c
file and substitute the path with something like '/mol-blk/disk@0:6,booter'
or perhaps redifine the pseudo alias. 

Note: Only HFS[+] filesystems are supported at the moment. I believe ':' is
still used as directory separator rather than '\' (which I think is the OF standard).
I will fix this later. I want MOL to be able to boot a linux distro directly
from the install CD without any tweaking...

/Samuel