Dear list, thank you for the help with cross-compiling for ppc64 so far! It is important but I overjumped enthusiastically the OF basics :-)
I read many webpages, hints and maybe old sites etc and solved many things. But is there a "beginners how-to" somewhere? What I would find most usefull:
1) Best source-code to use? There is a version-1.1.zip, a svn repo and a git repo.
2) The names are also a bit confusing when you see it first. I know about the IEEE standard and a few things about the history (from wikipedia), but if you for example visit the website and click on the "openfirmware" link, the you see a page with "OpenBIOS" heading. So even if one knows about history, there is confusion about actual used names.
3) How is the device-tree given to OF? And how does OF handle it over to a linux kernel?
4) Minimal prerequisites on a new hardware, so that OF is able to run? E.g. which type of RAM does it need? Does it need a stack or .text segment or other things to run (like c-code)? ...
If these points would be clarified, the it would be much easier for new people to help with e.g. additional targets or maybe new architectures.
Thanks for your time! Greetings, Michael
On Nov 21, 2016, at 9:34 AM, Michael wrote:
Dear list, thank you for the help with cross-compiling for ppc64 so far! It is important but I overjumped enthusiastically the OF basics :-)
I read many webpages, hints and maybe old sites etc and solved many things. But is there a "beginners how-to" somewhere? What I would find most usefull:
The website does have several pages that supply information. If you feel there should be more added, I will be glad to do so.
- Best source-code to use? There is a version-1.1.zip, a svn repo and
a git repo.
The git repo is what we are using now. I would chose that.
- The names are also a bit confusing when you see it first. I know
about the IEEE standard and a few things about the history (from wikipedia), but if you for example visit the website and click on the "openfirmware" link, the you see a page with "OpenBIOS" heading. So even if one knows about history, there is confusion about actual used names.
We use OpenBIOS as the project's name. Open Firmware is a standard OpenBIOS follows.
- How is the device-tree given to OF? And how does OF handle it over
to a linux kernel?
I don't think Linux touches the OpenBIOS device tree. It likes to discover things for itself.
- Minimal prerequisites on a new hardware, so that OF is able to run?
E.g. which type of RAM does it need? Does it need a stack or .text segment or other things to run (like c-code)? ...
Being a BIOS, I would think about anything could run OpenBIOS. I think any computer made in the last 20 years should work.
On Mon, 21 Nov 2016, G 3 wrote:
On Nov 21, 2016, at 9:34 AM, Michael wrote:
But is there a "beginners how-to" somewhere? What I would find most usefull:
For forth commands I've found this page useful (not sure if this is linked from somewhere): http://www.firmworks.com/QuickRef.html
(Not everything is implemented in OpenBIOS but mostly should work.)
- Best source-code to use? There is a version-1.1.zip, a svn repo and
a git repo.
The git repo is what we are using now. I would chose that.
- The names are also a bit confusing when you see it first. I know about
the IEEE standard and a few things about the history (from wikipedia), but if you for example visit the website and click on the "openfirmware" link, the you see a page with "OpenBIOS" heading. So even if one knows about history, there is confusion about actual used names.
We use OpenBIOS as the project's name. Open Firmware is a standard OpenBIOS follows.
This is a bit confusing. There are multiple implementations of the IEEE standard (commonly referred to as Open Firmware) and one of these is also called Open Firmware. These are listed under Implementations on the left of the page at www.openfirmware.info. Another implementation used by QEMU for PPC Macintosh models (and thus being active lately and most discussed on this list) is OpenBIOS. It may be useful to make it clear what you mean when talking about Open Firmware: the standard or the implementation with the same name.
Actually running OpenBIOS on real hardware is not something that is well tested (I'm not sure if it was ever tried but I think it wasn't done recently) so if you try to do that be prepared for likely needing some fixing. This is true for any implementation that does not support the hardware you want to run it on, then you likely need to port it.
- How is the device-tree given to OF? And how does OF handle it over
to a linux kernel?
I don't think Linux touches the OpenBIOS device tree. It likes to discover things for itself.
It discovers most things it can but still starts from the device tree but it's enough to have the basics in there. Not sure how much up to date is this but this is discussed in the kernel documentation here: https://www.kernel.org/doc/Documentation/devicetree/booting-without-of.txt
As for giving the device tree to OpenBIOS I think it should just know it or construct it from discovering the hardware as the point of the device tree is to describe the hardware for the operating system so the firmware should know the hardware and provide the device tree. It does not get it from anywhere as this it the first link that should have this knowledge. There are some more info about this here for example: http://www.informit.com/articles/article.aspx?p=1647051&seqNum=5
- Minimal prerequisites on a new hardware, so that OF is able to run?
E.g. which type of RAM does it need? Does it need a stack or .text segment or other things to run (like c-code)? ...
Being a BIOS, I would think about anything could run OpenBIOS. I think any computer made in the last 20 years should work.
I don't know how do you get that idea. Being a BIOS (or more correctly firmware) means that it is the lowest level and first program run on a computer that has to have detailed knowledge on how to initialise and operate hardware components so it very much depends on having low level drivers and code for the parts of a computer which is very much dependent on the specific harware. It can't just run on any computer for which it has no drivers.
In fact OpenBIOS does not have that many drivers but maybe the basics are there, only the platform specific init code might need to be adapted for a new board. For ppc these would be in arch/ppc. Running on QEMU is quite a bit simpler as we can skip a lot of init code (such as memory controller or other hardware) so maybe these are not well implemented or buggy as they were not tested with real hardware for a while.
I don't know anything about implementations other than OpenBIOS though so not sure if they work better or worse but if it's a harware not already supported, porting it would be similar.
Regards, BALATON Zoltan
Hello list and G 3,
thanks for your time and for the OpenBIOS implementation (btw)!
On Mon, Nov 21, 2016 at 11:11:37AM -0500, G 3 wrote:
... The website does have several pages that supply information. If you feel there should be more added, I will be glad to do so.
I have read them first. But for ma as a new arriving person it is a mixture between outdated (examples with old qemu, with svn repo, ...) and new stuff and so I did not know exactly what information is relevant.
More structured information I found on the OLPC websites and from a few companies.
... The git repo is what we are using now. I would chose that. ...
Thanks for confirmation. I looked at the patches (the dates) and convinced me to use the git repo. For a short time I was on the wrong track because the (oler) code from the svn repo did compile with ppc, when the newer code from git did not. Just a lot try-and-error for me for a certain time :-)
... We use OpenBIOS as the project's name. Open Firmware is a standard OpenBIOS follows. ...
One example which confused me: If you follow the link "Implementations / Open Firmware" from the main site (https://www.openfirmware.info/Open_Firmware), then you see the site "https://www.openfirmware.info/Open_Firmware" and there I was told to use the svn repo...
... I don't think Linux touches the OpenBIOS device tree. It likes to discover things for itself.
There is no plug-n-play in our hardware. We have to tell the OpenBIOS and the linux exactly every detail about the hardware. That is, about the memory (ranges & capabilities), about the busses, the interfaces, the CPUs etc. In my understanding we do the basic inits in powerpc assemblercode, so that the right flags are set and the RAM is able to work and then we call OpenBIOS from this assemblercode and give it our devicetree with the whole information about the hardware. The OpenBIOS then initialises serial & network and gives us the opportunity to debug some stuff and to boot in different ways.
... Being a BIOS, I would think about anything could run OpenBIOS. I think any computer made in the last 20 years should work. ...
That would be nice :-) But our hardware is challenging.
Thanks for your time and greetings! Michael
On 21/11/16 14:34, Michael wrote:
Dear list, thank you for the help with cross-compiling for ppc64 so far! It is important but I overjumped enthusiastically the OF basics :-)
I read many webpages, hints and maybe old sites etc and solved many things. But is there a "beginners how-to" somewhere? What I would find most usefull:
- Best source-code to use? There is a version-1.1.zip, a svn repo and
a git repo.
Definitely go for the github.com repository - SVN is no longer supported. I did try and update the wiki after the transition, however there is a chance I missed something.
And yes, we really haven't bumped the version number from 1.1 for a few years now...
- The names are also a bit confusing when you see it first. I know about
the IEEE standard and a few things about the history (from wikipedia), but if you for example visit the website and click on the "openfirmware" link, the you see a page with "OpenBIOS" heading. So even if one knows about history, there is confusion about actual used names.
I think this has already been covered by other people :)
- How is the device-tree given to OF? And how does OF handle it over
to a linux kernel?
OF implements what is called the CIF (Client Interface) which is a effectively a call table passed to the kernel at boot. You can find this referenced in kernel sources as of_* functions in Linux, and various other names for other kernels e.g. prom1275.
For Linux in particular have a browse around arch/powerpc/boot/oflib.c.
- Minimal prerequisites on a new hardware, so that OF is able to run?
E.g. which type of RAM does it need? Does it need a stack or .text segment or other things to run (like c-code)? ...
If these points would be clarified, the it would be much easier for new people to help with e.g. additional targets or maybe new architectures.
OpenBIOS is built as an ELF executable and so uses start.S to relocate itself and provide a C-like environment e.g. traps, MMU/virtual address setup before calling the main executable.
So in order to get going I'd suggest you do the following:
1) Start from the QEMU sources e.g. arch/ppc/qemu/*
The non-QEMU sources are missing a *lot* of functionality/bugfixes that haven't been tested simply because no-one has burned OpenBIOS PPC to a real PROM for quite a while.
2) Hack arch/ppc/qemu/start.S to setup your C environment
The QEMU binaries get various bits of information from QEMU via an ioport called the firmware configuration (or FW_CFG) interface. You'll need to hardcode some values here, e.g. RAM size, and make sure you're happy with the memory map comments at the top of the file.
3) Get basic serial IO working
Make sure that you've got a basic serial port working - chances are that you'll want to change the default config in config/examples/ppc_config.xml to use a standard 8250 serial port driver if that's what your hardware provides.
Set this up and make sure you can get serial output by writing to a suitable ioport location. Then also check arch/ppc/qemu/console.c since those are the bindings called by Forth.
4) Build your basic device tree
Make some hacks around arch/ppc/qemu/tree.fs and arch/ppc/qemu/init.c to provide a basic device tree. Once you've got serial IO and have a Forth prompt, you're pretty much there. You can view the device tree by typing "show-devs".
It's always interesting to obtain feedback from people using OpenBIOS on real hardware, so please do keep us informed of your progress and we will do our best to answer any questions/help track down any bugs reported.
ATB,
Mark.