Linux CE homepage

I have been working on a Linux kernel for Windows CE machines for the past month or two (among other things). I have been doing this on my own, with the intention of making it a part of the Linux CE project. I have been doing all development in Linux. See below for how to make Windows CE programs in Linux. So far, it only works on a NEC MobilePro 400 handheld - it is almost guaranteed to crash and burn on anything else. The kernel is a modification of the MIPS Linux kernel sources available from here. The MobilePro 400 runs Windows CE v1.0, has 8MB ROM, and 4MB RAM.
Status:

The kernel gets all the way up to:
Kernel panic: VFS: Unable to mount root fs on 00:00
It can display stuff on the LCD screen. I'm pounding on the keyboard ports right now. NEC's documentation on the VR4101 (the CPU in the MobilePro 400) is missing chapters 18 through 24, which include such goodies as sound and keyboard registers. (If you have this information, please send it to me.)


I don't have the $$$ for Microsoft development systems which are so unfortunately required to build Windows CE applications without losing one's sanity. This is bad because there are basically two ways of loading Linux: I don't have an EPROM programmer or the equipment to successfully and reliably replace the surface-mount ROMs. Replacing the ROMs is also a very platform-dependant operation. As a result, the only viable way of booting Linux is to use a Windows CE program.
I decided to lose my sanity and create a Windows CE program without the help of the SDK. My earliest attempts were the result of hours of work in a hex editor. My working attempt is a bit of a kludge, but it is fairly reliable.
May I present:
ec2c and fixflags

The idea is to use the linker in MS Visual Studio (which can produce Windows CE executables) with GNU compilers. I use the MIPS GCC and binutils availble from the Linux MIPS site (above). I modified the Makefiles for as to get them to output ECOFF object files. I couldn't get configure to build them with that format. --enable-all-targets helps. I may post the binaries/sources sometime, but that would take a lot of space. The idea is that you want an as which outputs ECOFFs.
ec2c converts the ECOFF object into a COFF, which is required by Microsoft's linker. ec2c has several limitations, the most annoying of which is its inability to handle relocations to symbols in the .text section. This means that you have to use jal to get the address of a function in .text. Loading a register with its address will produce broken code, sometimes without a warning from ec2c. You have been warned.
I use Wine to run the linker. This produces an .EXE file which is apparently intended to run under Windows CE v2.1. The linker sets flags in the header in a manner that is offensive to WinCE v1.0, so you have to run fixflags on the .EXE to make it actually run.

If you want to know in detail how the Linux loader (lincelo) works, e-mail me. It is written in MIPS assembler. My apologies to SH3 users, but GCC and AS didn't get along when outputting ECOFF's.
lincelo.tgz
It looks for \vmlinux (the kernel image, not compressed!) If you can't get it to build, here is lincelo.exe.

Get vmlinux.tgz. I will post the sources when I have the time and space. It is based on Linux 2.1.36 from the Linux MIPS project. The standard kernels will not compile for MIPS (at least when I try :). I will upload the kernel source here when I have time.
The kernel is in MIPS ELF format, little-endian (of course). lincelo makes some assumptions about the format of the image, but they have been right so far.

The kernel has *no* drivers in it except for the console. It is currently incapable of mounting any filesystems. Once the keyboard works and the various pieces of ugly code are straightened out, I will work on initrd support.

Disclaimer: If lincelo is successful, and often if it isn't, all data stored on your handheld will be erased! You will have to reset by pushing the reset button or in extreme circumstances remove all batteries to get back to Windows CE. I can't imagine how it could physically damage anything, but if it does, don't look at me. You should run lincelo without any other running programs and with as few files as possible on your handheld. If it doesn't work, and you don't have a NEC MobilePro 400, don't scream at me. If it doesn't work and you are using a MobilePro 400, don't scream anyway because I probably can't help you.

Possible legal consideration: I am using the standard BIOS font to display text on the LCD screen. Is this copyrighted? As far as I know, the same font appears in all IBM compatible BIOS's at the same location. I ripped it out of a computer (Compaq?) a long time ago and I have converted it into several formats since then. If anyone can shed some light on this subject, and if necessary provide a free 8x8 monochrome font, please do so.

Have fun. Expect kernel sources someday (soon?).