Linux on the Casio Fiva 206E

Edward Keyes, 2001

Introduction

The Casio Cassiopeia Fiva 206E is the English-language version of Casio's latest very small Crusoe-based subnotebook. It was originally released in Japan, and started shipping in the US in the summer of 2001.

The standard configuration is 128 MB of RAM (of which 16 is reserved for use by the Crusoe code-morphing software), a 600 MHz Crusoe 5600 processor, 20 GB hard drive, 8.4" SVGA (800x600) screen, 16 mm keypitch, Type II PC Card slot, Type II Compact Flash slot, one USB port, 10/100 Ethernet (no dongle needed), modem, Firewire port (the 4-pin unpowered type), and external video (dongle needed and included). The standard battery reportedly lasts for 5 hours (which means about 3 hours of heavy use, 4 of reasonable use), and the whole thing weighs in at less than a kilogram.

Oh, and the top cover looks like a big smiley face when it's closed.

One unique feature of the Fiva is the little switch on the back right side. In one position, the machine boots up into Windows Millenium Edition... in the other position, it does a quick-boot into a reduced version of Linux and runs an MP3 player.

To my knowledge, this is the first major machine shipping in a dual- boot configuration with Windows and Linux. I can only assume that the existence of the hardware OS switch gets around the traditional Microsoft OEM restriction against dual-booting configurations (yeah, why didn't they bring THAT up at the anti-trust trial?).

While the Fiva comes with a hard-copy version of the LGPL in its documentation, I was unable to locate any source code. At this point in time, I'm still going back and forth with Casio tech support to find out why they've apparently ignored this condition of the GPL, to provide source with shipping products (or at least have it accessible).

In any case, the mere fact that it ships dual-booting means that there is the need to upgrade the minimalistic Linux installation (based around the Midori Linux distribution) into a full-fledged dual-boot machine. That's what this page is about: telling you how the Fiva is set up from the factory, and what the best/easiest way is to get it to transform into a full switchable Windows/Linux system.

The shipping setup

The Casio engineers who designed the Fiva's shipping setup had a weird mix of brilliance and insanity. For instance, the OS switch, which is a beautiful idea, is implemented by having the BIOS rewrite the master boot record of the hard drive, toggling the active flag between partitions 1 (WinME) and 3 (Linux).

From the factory, there are three partitions: a normal Windows FAT32 partition, an 8 MB unknown partition, and a 200 MB Linux partition. Note that by default there is no hibernation partition.

The small unknown partition is, according to Casio tech support, used in their hard-drive imaging process and is not useful for anything in the boot process. We can safely get rid of it, or rather, use it for our own purposes.

The Linux partition is a concentrated bit of insanity in itself. The partition is 200 MB, but if you do a df, you'll note that the filesystem there is only 32 MB. Wait, it gets worse... in addition, there is a SECOND 10 MB filesystem in the SAME partition which gets mounted at /lib using the loopback device and an explicit byte offset into /dev/hda3. A more horrendous hack have I rarely encountered. So about 40 MB of the 200 MB partition is filesystem, the rest is just zeroed and wasted. Crazy.

Cracking the shell

One thing you'll want to do straightaway is get into the BIOS. Although this isn't documented anywhere I can see, the Fiva uses the standard F2 key during the boot logo to enter the BIOS setup mode. Here you can set uptions such as turning on actual boot messages instead of the pleasant Casio logo, setting up what devices it can boot from, etc.

One thing you'll note immediately is that the BIOS hibernation features are turned off by default. The Fiva is set up to use Windows' own hibernation features, so there isn't a hibernation partition on the hard drive, and hibernation is not therefore supported while in the default Linux mode.

The next thing to do is to break out of the comfortable padded box the Linux mode puts you in ordinarily. One thing you'll note is that the FTP program does allow you to browse completely through the Linux filesystem, including the system config files. This is how I discovered that in the startup scripts, if the file Program Files/CASIO/Linux/Debug exists on the mounted Windows filesystem, the script drops you into a different run level with a normal shell prompt instead of starting the MP3 player, etc. Just touch the file with Notepad and reboot into Linux.

Note, unfortunately, that there are some aspects of the system that don't get configured properly in this mode... for instance, touching the trackpoint freezes the system. Ah, well. It reboots quickly. I didn't use it enough to figure out exactly what was going wrong. There are other hooks you can use if you want, such as running a script placed in the Windows filesystem.

The Linux system in this mode is pretty useful. One thing I did straightaway was use dd to image completely the second and third partitions into files onto the Windows filesystem. Then I could transfer them to my own system for analysis, and for a poor-man's recovery disk. The system is missing a few useful utilities like df, fdisk, and more, but you can transfer these from the Windows filesystem if you like. Most reasonable shared libraries are already there.

Note, however, that many of the directories are mounted as cram filesystems as opposed to real ones... I don't know why they bothered, since there's plenty of extra hard drive space. In any case, that means that additional binaries you want to install should be shoved in /program instead of in, say, /bin, which will go away upon reboot.

Setting up

Before doing anything drastic, of course back up your system. This goes without saying. Hopefully you're starting from a mostly factory-fresh Fiva anyway.

I'm assuming you have access to a USB floppy drive. The first thing you should do is create a Windows ME emergency boot disk, from the Add/Remove Programs control panel. Then find a copy of Partition Resizer and put it on the same floppy. You may prefer to use FIPS 2.0 instead... I found did not have any luck with it due to a weird slight mismatch between the number of sectors in the Windows partition as reported in the partition table and as actually present in the filesystem. Partition Resizer didn't seem bothered by this, but FIPS threw a fit and exited.

In the Accessories folder of the Start menu, run the disk defragment program. We'll shortly be trying to resize the Windows partition to have enough room to install Linux, but that means that all your files need to be at the beginning of the partition, which is just what the defragmenter does for us. If you have trouble with hidden files, check the docs for FIPS and/or PRESIZER.

Reboot using the floppy disk and choose "Minimal Boot" from the menu. This gets you into a decently real DOS mode, which unfortunately Windows ME removed from the Shut Down menu as an option. Now run PRESIZER and shrink your first partition down to whatever you want Windows to live with. I found 4 GB / 15 GB to be a decent tradeoff between Windows and Linux, since Linux can access the Windows partition anyway. Don't worry about moving around the other partitions at the moment... we'll leave them as is and deal with them in fdisk a bit later on.

Reboot and make sure everything still works.

Now download some Linux installation disks. My own system was set up for the Debian 'testing' (aka Woody) distribution, which at this point in time is a nice compromise between recent kernel and X Windows versions and not being bleeding-edge unstable.

If you have the Casio CD-ROM drive, you're in luck and you can skip this step. I didn't bother to get it, which means I'm going to do a floppy installation instead, since I did happen to have a USB floppy drive lying around.

Unfortunately, the Debian install process requires multiple floppies, and while the first one boots fine, the kernel doesn't know how to access the floppy drive over USB for the followup disks, so you're stuck. Instead of trying to use a physical root floppy, grab the floppy image, gunzip it, and dd it onto /dev/hda2, that useless small second partition. Then at the Debian rescue disk prompt, you can boot with "linux root=/dev/hda2" instead of relying on the floppy.

Grab the rescue and drivers.tgz file as well and put them on your Windows partition in an obvious place. Debian will want them during the installation process, since you won't be able to use floppies.

Installation

Okay, now's where we start doing destructive things to the system, so really back up things that you want to keep. The plan is to remove the 200 MB Linux partition and replace it with about a 50 MB boot partition, and have our main swap and filesystem as extended partitions. We'll leave the second useless partition alone for now, since we're using it to install from, but once we're done we'll remove it and put a 150 MB hibernation partition there instead. The 50/150 split is a bit odd, but we have 208 MB to work with before the Windows partition. If you have 192 MB of RAM installed, you can probably split it 8/200 to still get a decent boot and hibernation storage.

Boot into the Debian install process however you like... CD-ROM would be best, but the floppy-plus-hda2 as described above also works. For some reason I was unable to get LOADLIN to do anything reasonable (it kept locking up halfway through the kernel boot).

During the early config process, you'll want to use fdisk to create your Linux partitions. I'd recommend doing this in the steps of (a) remove hda3, (b) recreate hda3 of size around 50 megs (will be used for /boot to match the OS switch going to the right partition), leaving blank space between hda3 and hda2, (c) create an extended partition for swap space (hda5, 256 MB), and the root file system (hda6, whatever's left). If you like having your Linux file system with a separate /usr partition, etc. you know what to do here anyway.

Note that this is where you actually lose the ability to boot into the original Linux. So if you want to play it absolutely safe, you can install Linux completely to hda6 and boot into it with a floppy to test, and then go back later and reconfigure the partitions to use hda3 as /boot. This was too much hassle and not very much risk for me, so I just deleted the original Linux partition from the start, once I knew the network was going to work. You may want to go a bit further in the install process to make sure everything else is happy before backing up to do surgery on hda3, just in case.

Continue to install Debian. It will ask you where your kernel and drivers are... point it toward your Windows partition. It should be able to scan and find them itself with a little nudging.

To do a network install, you'll want to load the RealTek network driver, which seems to work fine with the Fiva's built-in ethernet.

From this point on, it's clear sailing. Note that you want to install LILO into hda3, not into the master boot record. We'll be relying on the OS switch to select our OS, rather than a master bootloader, which we'll leave alone to make Windows happier.

The default PS/2 config with gpm will get the trackball working, and selecting an 800x600 configuration with the Siliconmotion XF86 module at least works, if not beautifully.

Post-Installation

The main thing we put off until now was the creation of the hibernation partition. Use fdisk to remove partition number 2, and recreate it as a maximal size (should be 150-something megs) partition of type A0, the ThinkPad hiberation type. The Fiva's BIOS should recognize this type. Next grab a copy of phdisk, which will format this partition for use with the hibernation features.

At this point, you should have a functioning dual-boot Windows/Linux laptop, maybe a bit rough around the edges, but ready for further customization as you see fit. Have fun.

This is where I am in my exploration of the Fiva. As I learn more about good kernel options, X Windows options, and so forth to use, I'll add them to this page. Feel free to email me if you have suggestions or additions.

You can also email me if you want to complain about how I caused you to destroy your Fiva, but I'll just laugh and say, "Tough luck, it worked fine for me." Heh heh.