|
|
Sun Labs is providing a kickstart to the code base for OpenSolaris on PowerPC. While there has been much discussion and perhaps some confusion from the beginning of OpenSolaris about PowerPC, Power and what progress has actually been made towards the goal of a full port, the contribution here on this project is essentially the tangible work in progress.
What it is now
What it is not (at the moment)
Sun Labs will continue to work on this code base with the community and will assist interested developers to get started. Below are notes gathered when we first started and expect that people new to this project will find them useful.
Much has changed in Solaris since the original 2.5.1 PowerPC release and that source is extremely dated. Above all the amount of effort required to legally review the source in order to release it, was prohibitive, thus Sun chose not to include it in OpenSolaris. Additionally the relevant parts of that source have already been incorporated into the contribution.
Copy and modify
--
Many aspects of the code development with the Solaris on PowerPC project are made by copying existing code and modifying. It is a judgement call, made on a case-by-case basis, what existing code to use as the starting point.
Sometimes, it is best to start from the old Solaris/PPC 2.6 code. This is almost always appropriate for small leaf nodes that deal more with instruction-set architecture, which has not changed much over the last decade. Other times, it seems better to start with modern (ONNV) code for another processor, and modify for PowerPC. This is more appropriate for things that interact with operating system services, where the interfaces may have changed considerably.
Then, there is the question of which processor to use as a starting point. Our current work on 32-bit PowerPC is more like x86 in some ways, but more like Sparc in other ways.
PowerPC is more like x86:
PowerPC is more like sparc:
note:1 PowerPC can work in big-endian or little-endian mode. Solaris/PPC supports both. Solaris 2.6 code was little-endian only; Solaris 2.11 code is big-endian, but code is written to work both ways. Some libc functions were built using a merge of x86 and sparc code for 2.11, and Tim Marsland's 2.6 PPC big-endian workspace.
This is just a quick guide listed here.
The assumption is that you have already a working Solaris x86 host with GCC and the tools setup on it. You have downloaded and extracted the latest source tarball or pulled from the ppc-dev/ppc-dev svn workspace, now you need to make it all. You must configure your polaris.sh script and if this is the first time you building a fresh workspace you must run setup-polaris. These steps are outlined in a bit more detail the README.polaris file.
If your using the ODW or the EFIKA as your target you will need to run VOF (Virtual Open Firmware). A little more detail on VOF can be found at the task map page
Next thing is to build NFS boot which produces the binary inetboot This is the 2nd level bootstrap that is loaded by OpenFirmware. When inetboot is started it will prompt you for the kernel you want to download. In the source tree look at the README.inetboot notes which will not only help you build it but also setup your tftp and nfs server.
Build your kernel using these steps in this order
More details on these notes can be found in README.polaris, or if there are still questions post them on the discussion list. The final binary will be created and found in usr/src/uts/chrp/unix/debug32 and in your $ROOT/platform/kernel. Then copy up your proto_root to your nfsroot dir and you're good to go.
Static Linking: The current makefile will do a post build link of unix
and genunix for one large bin. This was done to assist the Metrowerks debugger with location of symbols. KRTLD will still do all the module run time linking. This is now done as part of the overall make process, but it is fairly straightforward to return to the separate unix / genunix approach. KRTLD will still do it's job stitching it all together.
Currently the kernel boots progresses to the point of loading and executing a hand coded $ROOT/sbin/init on the Genesi ODW workstation. This involves mounting a network root file system and then will load and exec the test init app. You can see a sample output of the target's console at the Status Page.
So simply put to get to the same point as we are you first need an Pegasos ODW Workstation and a tftpboot, nfsroot server. We typically use our solaris x86 host development system as the target server, but we have also a Debian Linux x86 box as a target server also. Once that is setup and you have a built kernel, you need to populate your nfsroot with your created proto_root. You also need
openfirmware - binary provided on the Project Extras Page
inetboot - built and found in usr/src/psm/stand/boot/ppc/chrp
Once the ODW has booted you need to alternately set the irq routing. We have multiple irqs on 9 and have to manually move the RHINE irq. Enter the following on the command line
The above will load VOF from the tftpboot, then type
This will load inetboot and you're off and running. If you have our handcoded init in your sbin dir, it should load and exec.
Currently the focus has been on the ODW target. The kernel will load on Macs and the EFIKA board but wil panic much earlier due to specific PIC and decrementer initialization work that needs to be completed.
PPC/Solaris 2.51 release 1995-1997, it was a full up release and functional. Further development was continued into 2.6 but dropped during this release cycle. We here in the Labs have access to many of the team personnel that did this port and fortunately have worked with them directly on other projects. These critical relationships were important to leverage. We have access to the source for all of this, but the community does not. It appears that much of this code is essentially unusable in a direct sense but some parts do have relevant. It was not possible or even practical to release the 2.6 source base.
ON source code gates and releases
ON gates contain no systematic self-describing information. This table was built using information dug up by hand, from some combination of three methods:
What internal ON gates have support for PowerPC?
We have started with GCC as the basic tool chain the community initially developed an x86 build environment on x86 solaris box. The long term goal of self hosting is still a ways off. Full GCC support for the OpenSolaris source is complete and GCC is required since the Sun Workshop tools do not put out PPC binaries. The community has played a big part in getting this environment up and source compilation with PPC output functioning.
binutils 2.16.1
gcc 3.4.3
Sun Labs has been using the Metrowerks PowerTAP to bring up low levels parts of the kernel until the Virtual Memory Manager is up. It will essential to discuss further how the tools can be used once protected memory is in order. Metrowerks has a kernel aware debugger that can be interfaced with Solaris. We have had discussions with Freescale on how exactly this can be achieved. There is a doc that describes the interface to the kernel. KMDB is important to get functional early on. We also have GDB via serial console and Abatron BDI 2000 with GDB support.
With the OpenSolaris on PowerPC project we have been working with a few targets to date. The ODW from Genesi and the PowerMacs/MacMini from Apple. The http://www.opensolaris.org/os/project/ppc-dev/ page has more detailed information on these targets. The basic requirement is that a target runs OpenFirmware.
--
We have 2 at this time. Good old console output that can be seen from the serial port on the ODW or directly to the display if you're using a PowerMac based target. The second choice and the way most of this early development has been done, is with the Metrowerks Codewarrior JTAG debugger from Freescale. This is a HW emulator and IDE that is hosted on a Linux system and downloads the kernel or it's associated pieces (inetboot, krtld, etc) directly to the target's memory, jump to entry and run. You have full source level debugging, stepping, breakpoints and a rich set of tools that give you insight into all levels of the hardware, regs, memory I/O, etc.
For general info and overview go to Metrowerks TAP
In order to use this tool the target hardware needs to have the JTAG port "brought out" to a pins that can be accessed with the emulators connector. The ODW has this option designed in, unfortunately the PowerMacs do not. All of our low level bringup has been done on the ODW board. We expect that the community will be using the printf approach until KMDB or GDB is up on the target.
Sun Labs was uniquely positioned to be a main player in this early effort because of it's PPC HW & tools expertise, embedded experience, relationships internally and externally and past history. Sun Labs is about research yet the team here found many aspects of this project beneficial this effort is generally straightforward knowing that a Solaris PPC port was done in 1995. Sun Labs will act as a direct interface between the community and Sun internals providing information, source and resources that cannot be gained otherwise.
We will focus on the areas such that enough of a kernel is booting to allow the community to be effective. The community has chosen the Genesi PegasosII based ODW with the Freescale MPC7447 as the cpu. This is a community effort but we are focusing on the pieces that we feel that Sun Labs can contribute to directly and have coordinated these efforts. The immediate goal that the Sun Labs team is committed to with the OpenSolaris PPC community is achievement of a booting, initialized and functional OpenSolaris kernel on a 32 bit PPC architecture with KMDB, GDB, network connection and a serial console in hopefully a reasonable timeframe.