Linux CE for MIPS-based Devices

Index


The Kernel

The kernel is the core part of any operating system. Without it, we wouldn't get very far.

NOTE (7-Jan-00): Some of the information on this page is out of date. Other parts are still useful. Still other parts are of historical interest. For more current information, please see the Linux VR web page.

Status

We're making good progress on the kernel for VR41xx-based devices. Brad LaRonde has some kernel binaries avaialable on his page, but to get a kernel with the more recent additions, grab the latest sources and compile your very own binary.

I am focusing on the VR41xx port of the kernel, since that's what I have to test with. Here's where we are with it so far:

For more specific information and some idea of the history of this project, see Brad's page.

Steve Hill and Harald Koerfgen are working on support for Philips Poseidon class CPU-based devices (PR31700 is a member of this family). Steve has been very busy recently (as of 29-Nov-99), so not much has happened on that front in the past month or so, but they did make some progress on the kernel. Since the R39xx CPUs are so similar to Poseidon (or the other way around, which I think is closer to the truth), it looks like support for them will be included with the Poseidon support.

UPDATE (8-Jan-00 and 30-Apr-00): In fact, that port is now being called R39xx instead of Poseidon. There are now a number of R3912-based platforms that are supported in the latest CVS sources.

The MIPS port of Linux (also see here and here) already had most of the architecture-dependant code that isn't specific to anything outside the CPU core, so most of the hard work was done already. There are several branches and patches connected to Linux-MIPS, some of which are outlined below.

Linux CE-MIPS is a 32-bit little endian port, since that's what is guaranteed to be supported by all the CPUs in MIPS-based Windows CE devices. Little endian MIPS is commonly referred to as mipsel (as in mipsel-linux), whereas big endian is mipseb, or more often just mips (as in mips-linux).


Development Tools

Since it's much easier to do development work in a desktop environment, most of the Linux CE development will be done with cross-development tools. This allows for creating MIPS or SH3 or ARM binaries on a different host system, such as a nice inexpensive x86 Linux box.

i386 Linux binaries of binutils 2.8.1 and egcs-1.0.3a built with the appropriate MIPS patches can be found at ftp://oss.sgi.com/pub/linux/mips/crossdev/i386-linux/mipsel-linux/ . I have heard reports of those binaries not liking some versions of glibc. It seems like they really want to run on RedHat 6.x. If the RPM installation complains about glibc dependancies not met, or if you have problems with them, you will probably have to build from source.

UPDATE (8-Jan-00): We have diverged a little from the standard toolchain due to the lack of hardware floating point support, so while the above RPMs will work, and should be fine for compiling the kernel, user applications should be compiled with these specailly patched versions of egcs, and the soft-float version of glibc. Binary packages of those can be found at: ftp://linux-vr.sourceforge.net/pub/linux-vr/ and full instructions for their installation are in the Linux VR Tools HOWTO, or you can check out Jay Carlson's work on those at ftp://ftp.place.org/pub/nop/linuxce/. For non-RPM users, pick up Jay's tarball of the cross-development tools here and untar (and un-bzip2) in the directory /usr/local, also you need to set up symbolic links /usr/local/linuxce-softfloat/mipsel-linux/include/linux and /usr/local/linuxce-softfloat/mipsel-linux/include/asm to point to the Linux CE kernel source inlcude dirs include/linux and include/asm-mips, respectively, instead of the links suggested on the Linux VR Tools HOWTO with something like:

   ln -s /usr/src/linux/include/asm-mips /usr/local/linuxce-softfloat/mipsel-linux/include/asm
   ln -s /usr/src/linux/include/linux /usr/local/linuxce-softfloat/mipsel-linux/include/linux

There are many known MIPS bugs in the stock distributions of both binutils and egcs, so if you try a more recent stock version without MIPS-specific patches, be aware that you are likely to run into problems.

If you're a true diehard who wants to build the cross-development tools from source, you can get the right patches from ftp://oss.sgi.com/pub/linux/mips/src/binutils/ and ftp://oss.sgi.com/pub/linux/mips/src/egcs/ and follow the instructions in Ralf Bächle's Linux/MIPS HOWTO (see section 9). Specify mipsel-linux for the target. You can pick up the source RPMs (SRPMs) from the above FTP links to get the source and patches packaged together, but you should still build them manually, as per Ralf's HOWTO.

UPDATE (8-Jan-00): You can also get an SRPM for the soft-float egcs from the Linux VR FTP site, the soft-float patches for both egcs and glibc from Jay's ftp, and a Makefile-style build script also from Jay.


Getting the Source

The currently recommended kernel source for MIPS devices is the Linux VR kernel. I'm not sure where the SH3 kernel development is currently being housed. The other source trees listed below are here mainly for historical interest.

Linux VR Sourceforge CVS repository

Active development is taking place in this repository, so sometimes things get broken. To get a more stable release, try the most recent file release from the Linux VR project page, or to live on the cutting edge, grab the up-to-the-minute source from the CVS repository itself.

UPDATE (30-Apr-00): Unfortunately, we haven't done a release in a while, so the latest "stable" release is a bit old.

You can access the Linux VR kernel source repository by issuing the following commands under Linux (you need to install CVS first):

   cvs -d:pserver:anonymous@cvs.linux-vr.sourceforge.net:/cvsroot/linux-vr login
   (leave password blank)
   cvs -d:pserver:anonymous@cvs.linux-vr.sourceforge.net:/cvsroot/linux-vr co linux
or if you already have a previous version from there, from the linux directory, do:
   cvs update -d

For more details, see the Linux VR CVS HOWTO.

The VR41xx platform code is in arch/mips/vr41xx and the R39xx/Poseidon platform code is in arch/mips/r39xx, but there is CPU-specific code in various places of the arch/mips directory tree.

Once you have the source, you can 'make config' (see below for details), then 'make dep', then 'make'. The last make will build vmlinux, which is the unstripped kernel image. Don't forget to strip vmlinux afterwards (but keep a copy of the unstripped kernel image if you're doing kernel debugging).

In the more recent kernel sources you can also do 'make vmlinux-stripped' which will place a stripped kernel binary named vmlinux-stripped in the directory arch/mips/boot/

A ramdisk image is currently being linked into the kernel binary if initrd support is configured. For details on that, see Brad LaRonde's Ramdisk HOWTO. Eventually we'll get initrd support in the bootloader, so the ramdisk image won't have to be linked into the kernel, but this is not a high priority at the moment.

Steve Hill's CVS repository

Active development was going on in this CVS repository for some time, but has now moved to Sourceforge. Many thanks go out to Steve for allowing us to use his server when it was in operation.

The 2.2.10 kernel from SGI CVS

To compile the 2.2 kernel branch from SGI (NOTE: Not recommended, this is being included for completeness), grab the version 2.2.10 kernel source from the anonymous CVS server at oss.sgi.com (for more information on available resources, see Ralf Bächle's Linux/MIPS HOWTO, from which several chunks of the following were copied or adapted):

   cvs -d :pserver:cvs@oss.sgi.com:/cvs login
   (Only needed the first time you use anonymous CVS, the password is "cvs")
   cvs -d :pserver:cvs@oss.sgi.com:/cvs checkout -r linux_2_2 linux
or if you already have a previous version from the CVS repository, from the linux directory, do:
   cvs update -d -r linux_2_2

If you omit the -r linux_2_2 flag, you will (currently) get the 2.3 sources.

Next, apply Harald Koerfgen's R[23]000 patches with something like this:

   cd linux
   gzip -dc r2300_patch.gz | patch -p1

UPDATE (14-Aug-99): I'm not sure if the R[23]000 patches are still needed for the 2.2 tree. Harald has integrated them into the 2.3 SGI source tree, but I don't think he plans to do the same for 2.2.

Finally, there's a problem caused by a bug in binutils newer than version 2.7, which as far as I know is still an issue. The workaround for now is to change the following line in arch/mips/Makefile from:

   LINKFLAGS       = -static -N
to:
   LINKFLAGS       = -static

When making config, be sure to say Y to 'Generate little endian code' as well as 'Are you using a crosscompiler'. Also, you must specify a platform or else the final link step will fail.

The 2.3.x kernel from SGI CVS

To try the "experimental" kernel branch from the SGI CVS repository (NOTE: Also not recommended, use the Sourceforge CVS repository instead), follow the same instructions as for 2.2.10, but leave off the -r linux_2_2 flag to the cvs commands. Also, the R[23]000 patches are not needed, since they have been integrated as of 3-Aug-99 (probably earlier, that's just the first time I confirmed it). Note that these sources are in more of a state of flux, since active development is taking place in this branch, both MIPS-specific, and in the general Linux kernel code.

Last I checked, the kernel version in the repository was 2.3.99-pre6, but this changes pretty frequently.

The 2.3.x stock Linux kernel

Apparently, much of the recent MIPS development has been folded into the official 2.3 kernel sources, so this is another option to try (NOTE: Definitely not recommended unless you have lots of patience):

Grab the latest Linux kernel 2.3 sources from ftp.kernel.org, or your favorite mirror site and decompress as usual.

Next, you need to change the top-level Makefile to reflect MIPS architecture. Change the line:

   ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
to:
   ARCH := mips

or you can use 'ARCH=mips' as an argument to all your make commands, such as:

   make ARCH=mips menuconfig

Then you can 'make config', 'make dep', and 'make'. If you make config before changing the ARCH line in the top-level Makefile (or if you choose not to change the line and forget the 'ARCH=mips'), you'll get the wrong config options.

I ran into a problem that caused 'make' to fail immediately with the following error:

   In file included from
   /usr/local/lib/gcc-lib/mipsel-linux/egcs-2.90.29/include/stdarg.h:27,
                    from /usr/src/linux/include/linux/kernel.h:10,
                    ... lots more include file include from lines ...
                    from init/main.c:15:
   /usr/local/lib/gcc-lib/mipsel-linux/egcs-2.90.29/include/va-mips.h:89:
   sgidefs.h: No such file or directory

The problem appeared to be in the header files that got installed when I built egcs. If you get the same error, you can fix it by changing the offending line in va-mips.h from:

   #include <sgidefs.h>
to:
   #include <asm/sgidefs.h>

Get the exact path for va-mips.h from the error message you get during 'make', you may have several copies of this header file in various locations, especially if you work with one or more cross-development environments.


Running 'make config'

No matter what source tree you start from, when making config, say Y to 'Are you using a crosscompiler' (unless you're actually building the kernel on a Linux-MIPS box).

The sources from the Linux VR CVS server have a specific config script that requires some explaination (This is aimed at people building kernels for VR41xx platform, but most of it is also applicable to the other MIPS handheld platforms):

That's it. Good luck, and happy kernel building.




Legal Stuff:

Microsoft and Windows are registered trademarks of Microsoft Corporation. VR4100, VR4101, VR4102, VR4111, VR4121, VR4181, and VR Series are trademarks of NEC Corporation. MIPS is a trademark of MIPS Technologies, Inc. CompactFlash is a trademark of the CompactFlash Association. Clio is a trademark of Vadem, Inc. All other brands and product names may be trademarks of their respective owners.


Last modified: 30-Apr-2000