Creating an operating system on PPC

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Anton

Creating an operating system on PPC

Post by Anton »

Heya, I need help with this.
I know pretty much C and C++, although I'm currently almost only working with Obj-c in the cocoa API (former yellowbox) in mac os x. But that involves c/c++ so there ain't no problems with that part. :)

anyway, I have tried but failed with my search on finding any help or documentation on how to make your own operating system on the Apple PPC system. Apple's hardware technotes (http://developer.apple.com/technotes/) have been of absolutely no help at all. I welcome all help and will be really greatful if someone could work this out with me.

Hugs thanks in advance, people :)


   Regards, Anton Kiland
jamethiel

RE:Creating an operating system on PPC

Post by jamethiel »

Well, you're running OS X, so I'll assume you have an OpenFirmware-based PowerMac.

First things first, because it's based on OpenFirmware, some Sun SPARC OS tutorials might help (the SigOps site has some, if memory serves).

Expect to learn at least a little Forth.

The NetBSD project has already done the basic work for this. The source and documentation for the NetBSD/macppc port is another possible resource.

Hope this helps.
Anton

RE:Creating an operating system on PPC

Post by Anton »

I intend on developing here on my iMac but i will run the OS itself on an old 7600/132..but tat is OpenFirmware-based as well, even though it is a computer of OldWorld-type..is this a problem?

What's SigOps? and where to find the sparc os tutorials?

i'm sorry to ask this silly questions but i'm really new to the OS programming area...thanks for all help!


Bytheway, Forth is the "programming language" used by OF, right?

huge thanks

  -anton
jamethiel

RE:Creating an operating system on PPC

Post by jamethiel »

Okay, it appears that my memory failed me. Here are the links:

SigOps: http://www.acm.uiuc.edu/sigops/
The SPARC OS tutorial: http://www.cheesecake.org/sac/os-supp/

The SPARC tute is, unfortunately, not as useful as I would have hoped. It does have an example of calling one of the OpenFirmware functions from C, but it is incomplete, and would probably need to be double-checked against what NetBSD or OpenBSD do.

Instructions (from the NetBSD site) for patching the OpenFirmware in your 7600 (you may or may not need this):
http://www.netbsd.org/Ports/macppc/Syst ... patch.html

Yes, OpenFirmware is based on Forth. If you were insane enough, you could probably bootstrap yourself into a working OS with just that, no cross-compilers running on other computers or anything. My quota of this kind of insanity is presently being spent doing this on a PC Forth system.

While I'm thinking of documentation that could be useful for you, I'll send you after the PPC CPU manuals, and the OpenFirmware specification if you can find them (much to my dismay, I haven't been able to find a manual for the 601 in my 7200).

Hope this helps.
Anton

RE:Creating an operating system on PPC

Post by Anton »

I can't seem to find anything usefull at the SigOps homepage. All that is there is a tutorial for intel processors which I honestly have no idea how to get working on an PPC processor.

I'm am as I'm writing this checking out the SPARC tutorial to see what it'll give.

Huge thanks again, and as it is today I will need even more help since it seems as if I still haven't got a single step closer on how to get the booting process to run and how to start the coding of the OS itself.

Thanks thanks thanks!

  -Anton Kiland, Sweden
Anton

RE:Creating an operating system on PPC

Post by Anton »

I have as of now also checked out the SPARC OS  tutorial but I have gained a knowledge of the great amount of 0! =/    It sais a lot about PROM functions, and I wonder..are these implemented in the Apple PowerMac (OldWorld) architecture as well?


Huge Thanks again, dude.

  Regards,
    Anton Kiland, Sweden
Anton

RE:Creating an operating system on PPC

Post by Anton »

Hehe, sorry for all messages in a row now..

I can't seem to find any source code for NetBSD..and since I do not know what to look for if I find it it will be a rather tough task.

Help?

Thanks!
Anton

RE:Creating an operating system on PPC

Post by Anton »

okey, this is getting way to much today :)

i found this website  http://www.0xfi.com/oslib/topx.html#PowerPC%20Architecture   but unfortonatly i get none of the text in any of the files. I have read through the simple C application pdf from motorola, but i must admit that i don't understand it at all!

heeelp:$

HUGE HUGE Thanks!!
jamethiel

RE:Creating an operating system on PPC

Post by jamethiel »

Okay, the reason that the SPARC tutorial might come in handy is that it is based on OpenFirmware as well, and so some of the interfacing details -might- be similar enough to use. Having looked at it again, I agree, it's not even complete enough to help with the SPARC, let alone other OF-based systems.

The NetBSD source code can be browsed (on the web) at:
http://cvsweb.netbsd.org/bsdweb.cgi/

There is some code that accesses the OpenFirmware stuff at:
http://cvsweb.netbsd.org/bsdweb.cgi/src ... d/ofwboot/
(this is the NetBSD/macppc bootloader, and depends on the NetBSD libsa library for things like printf, but Locore.c shows the basic OF hooks and an implementation of putchar)

For getting a local copy of NetBSD, see:
http://www.netbsd.org/Releases/

Hope this helps.
Anton

RE:Creating an operating system on PPC

Post by Anton »

I have looked through the Locore.c file on the bsd cvs server but I must admit that it is rather hard to understand since it does not at all only show the basics of what you need to get it to boot. It would be a lot of help if there were any such files which to I later on could add more and more code as the projects moves forward. Get my idea? :)

thanks again, this code have helped some though :)
do you know if the gcc compiler in OSX.2.3 (darwin unix 6.x.x) is able to compile my files? what args to use and how to use a linker and makefiles etc.?


super thanks! :)

  Sencerely,
    Anton Kiland, Sweden.
Anton

RE:Creating an operating system on PPC

Post by Anton »

yes, I can see now that I really do need the very basics to be able to sort out what thing does what.

Thanks Thanks Thanks Thanks!!
Anton

RE:Creating an operating system on PPC

Post by Anton »

I found this
http://sourceforge.net/projects/ppcboot/
and as well the uBoot thingy (which I yet have to check out).

But..how to use it? How to make it run my files and how do I write the OS files? printing to screen etc.

thanks!
jamethiel

RE:Creating an operating system on PPC

Post by jamethiel »

I'm planning on exploring this part of the Mac startup sequence myself over the next month or so, but I don't believe I have any machines capable of -running- OSX, and won't be writing in C anyway, so my code (when I write it) may not be much help. We'll see.

The compiler in OSX will -probably- do what you want, but I don't know which special options you're going to need. The linker, especially when messing about with startup stuff, is a little trickier. I've had to use a hacked custom linker a time or two over the years. Makefiles are makefiles, and dependant on what version of make you're using. Best thing there is to read the manual, look at some examples, and start simply.

The thought occurs that you might also try looking at the -darwin- sources if you can find them to see how it boots up. The more data points on this, the better.

Anyway, I'm outta time for now. I'll check back tomorrow or monday, as time permits.
Anton

Hey!!! Anton is my nick

Post by Anton »

Hey!!! Anton is my nick, get yourself a new nick.
thanx
Anton
Anton

RE:Creating an operating system on PPC

Post by Anton »

okey..hmm

will check out the darwin sources tomorrow (it's 11.40pm here in sweden right now) to see  what there is to get from that.

Thanks again!!
Post Reply