We are interested in OKL4, which is an operating system based on microkernel technology. We had been using one of the previous versions of L4 for our research experiments. The version we used supported IA32 and ARM processors and we built our system with an IA32 processor. A few months back, we needed to use Renessas SH4A processors as our experimental platform for some reasons. However, the current release (3.0) of OKL4 only supports ARM processors. While I had enjoyed programming on OKL4, I often wanted to understand the internal of L4 microkernel. This particulary motivated me to port it to SH processors. April 13, 2009.
SH2007 is our target platform. It is made by a Japanese manufacturer (I'm afraid they have no English page:-( ). SH2007 is equipped with an SH7780 processor with 128MB of RAM and some basic peripherals such as serial console, two ethernet ports and two USB ports.
The current version is based on OKL4 3.0. This is absolutely no warranty.
Source code: okl4_3.0_sh_rev135.patch.gz
This is NOT an official release. Please do not ask the okl4 developer mailing list about this implementation.The platform we've used is Ubuntu Linux 8.04 (and 9.04 beta lately). We haven't be sure yet that we can build OKL4 on the other platforms such as OSX and Windows.
or
Many computer boards with SH processors use SH-IPL for their boot loader. SH-IPC downloads the kernel via NFS protocol. Note that SH-IPC place the kernel at 0x82100000, which is also the kernel entry point.
First, you need to download crosstool-0.43.tar.gz from Kegel's website.
Then, expand the tarball and apply this patch to the source.
% tar zxf crosstool-0.43.tar.gz % cd crosstool-0.43 % patch -p1 < ../crosstool-0.43.sh-linux.patch
Build the crosstool. This creates GCC 3.4.5 with glibc 2.3.6. I used GCC 4.2 because GCC 4.3 failed to build it in my environment. To use GCC 4.2, you need to edit demo-sh4.sh.
% ./demo-sh4.sh
This creates a directory for storing the binary outside the source directory.
Move the directory where you like. For example, you may want to put it in /opt.
% cd .. % sudo mv result_top/gcc-3.4.5-glibc-2.3.6 /opt
Append the directory to your PATH so that the OKL4 build scripts can invoke the compilers.
% export PATH=$PATH:/opt/gcc-3.4.5-glibc-2.3.6/sh4-unknown-linux-gnu/bin
Congratulations! Now you're ready to build OKL4 for SH7780.
Edit your dhcpd.conf like the following, then restart dhcpd. Note, replace OKL4_SRCDIR with an appropriate string. Choice of IP addresses is up to you.
host sh2007 {
hardware ethernet (MAC address of your hardware);
fixed-address 192.168.100.1;
filename "OKL4_SRCDIR/build/images/image.boot";
next-server 192.168.100.254;
option host-name "okl4";
option root-path "OKL4_SRCDIR/build/images";
}
Edit your /etc/exports and append the entry like this.
OKL4_SRCDIR/build/images 192.168.100.0/255.255.254.0(rw,insecure,no_root_squash,subtree_check)
Don't forget restarting NFS daemon to activate the latest change.
Set up minicom.
Download the OKL4 3.0 release. Get it at the OKLabs community wiki.
Extract the tarball, and apply the patch.
% tar zxf okl4_3.0.tar.gz % cd okl4_3.0 % patch -p1 < ../okl4_3.0_sh_rev127.patch
% cd $OKL4_SRC_DIR % ./tools/build.py PYFREEZE=false MACHINE=sh2007 PROJECT=examples EXAMPLE=hello
% cd $OKL4_SRC_DIR % ./tools/build.py PYFREEZE=false MACHINE=sh2007 PROJECT=ktest
SH-IPL jumps to 0x88210000 after downloading and extracting the image file. We need to strip off the headers in the image file so that the first instruction is placed at 0x88210000.
% cd build/image % sh-linux-objcopy -Obinary image.boot
The SPUMONE project team in DCL sometimes helped me to build the development environment and to understand SH4A.