I bought a Toshiba Libretto 70CT in March 1998. One of the reasons I chose it above other small devices is that it didn't come with Windows CE (the ancestor of today's Pocket PC operating system), as most palmtop devices did. Instead, it came with Windows 95, which is interesting not for Windows 95 itself, but because if it can run Windows 95, it can obviously run other operating systems, too--such as Linux. (Later, the 70CT would ship with Windows 98.)
Installing Linux on the Libretto turned out to be easier said than done. Toshiba designed the Libretto without a built-in floppy or optical drive. This is a common compromise for small machines today, but the lack of a floppy drive was somewhat unusual in 1998. Toshiba did furnish an external floppy drive, connected to the Libretto through the PCMCIA interface. This seemed to make it possible to install Linux by booting off a floppy disk, and in fact, that's what I tried first.
Unfortunately, the drive is controlled via device-specific BIOS calls. Installing Red Hat required, at the time, two floppy disks--the boot disk and a supplemental disk, which contains drivers necessary to complete the installation. Unfortunately, the Linux kernel on the boot floppy did not include support for the PCMCIA floppy drive, and the Libretto refused to read the supplemental disk.
There were a few ways around this problem. One was to install via NFS. That way, only one floppy was required. Another method was to remove the 2.5-inch hard drive from the Libretto, and mount it on a separate machine with a floppy drive, and install Linux using that machine as a surrogate. In 1998, however, 2.5-inch drives were uncommon, and one typically needed an 2.5-to-3.5 adapter for the drive. Or, one could compile a version of the Linux kernel with support for the PCMCIA floppy drive already in it, and substitute it for the default kernel on the boot floppy.
For a number of reasons, I decided not to take any of these tacks. Instead, since I already had another laptop that had Linux installed on it, I decided to use it as a live filesystem which I would copy onto the Libretto. The basic steps are as follows; I'll go into further detail on each:
This approach usually means that whatever kernel you have running on the existing Linux machine is whatever you'll be running on the Libretto. One can get around this by building or copying a different version of the kernel, of course. One important consideration is that the versions of the kernel that ship with later releases of Red Hat contain an instruction that isn't available on the Pentium MMX chip used in the Libretto 70CT and other third-generation Librettos (Libretti?). I first installed Red Hat 4.2 on the Libretto, so this wasn't a problem.
By the time I next got around to updating the Libretto, Red Hat 7.3 was out, but I soon found that the kernel would not run on the Libretto. It would hang halfway through the boot process with an error indicating an unsupported instruction. The latest Red Hat release that included a kernel that would run on the earlier Pentium chips was Red Hat 6.2, so that's what I stuck with for the Libretto.
If you want to use a later kernel, it is a simple matter to build one against the Pentium MMX chip, and then use that as your boot kernel. If you do this, however, be aware that it is brutal to get a 2.4 or later kernel to fit into a zImage (maximum size 576 kB), and loadlin, which I use below to load the kernel, can only load zImages. You will have to use lilo or grub.
The other gotcha with this approach is that it is less precisely usable than it used to be, since hardly anyone has a nice Red Hat 6.2 installation lying around. Still, the principle should be applicable to other installations, provided the kernel is properly compiled (the following paragraph notwithstanding). You will typically need to install a larger hard drive for the later releases.
Disclaimer: The instructions in this document are not warrantied in any way. The author is not to be held liable for any damage or loss of data or equipment as a result of the use of these instructions.
Note well: These instructions are intended for use on a newly formatted Libretto 70CT. The reason is that FIPS is used to reduce the Windows partition. It is possible that the rest of the instructions will work on a Libretto that has been defragged and then FIPS'd, or on one that has had other partition software (such as Partition Magic) operate on it, but I don't know anything definite about that.
Here is the physical device configuration:
There is a free utility, FIPS, that you can use to trim the DOS partition. (Alternatively, if you have Partition Magic, you can use that.) fips20.zip contains FIPS as well as documentation and some other auxiliary programs for backing up the master boot record. To use it on the Libretto, you must put FIPS and the other utilities on a DOS bootable floppy.
Connect the external floppy drive, insert a blank diskette, and from the Windows terminal, format and master the A: drive. Then, copy FIPS and the other utilities onto the diskette. Then, shut down the Libretto, and reboot from the floppy. When you get a command prompt, type
> fips
FIPS will print out the partition map and some information about the boot (Windows) partition on the Libretto's hard drive, including its size. It will then allow you to change it, by using the cursor keys: the right and left arrows add and subtract a cylinder from the partition size, and the up and down arrows and and subtract 10 cylinders. For reference, each cylinder on the Libretto's 1.6 GB hard drive is about 2 MB. I reduced my Windows partition to about 260 cylinders--about 520 MB.
When you're done, press enter to save the new partition map. Now, shut the Libretto down (in preparation for the next step) by pressing and holding down the power button. Remove the FIPS floppy from the drive.
I first wrote this up in 1998. More recently, I've tried hunting down DOSLinux on the web, and can't find it. I suspect that its functionality has been folded into some other tool, but I don't know what that is, and in any case, I can't describe something I haven't used. In any case, I hope it isn't a problem for me to provide my own copy of DOSLinux here. It comes on 8 floppies:
[For space reasons, these diskette images are currently unavailable. Contact me if you're really interested in them.]
Turn on the Libretto, booting up into Windows 95. (That is, do not use the diskette with FIPS on it.) If you have the DOSLinux floppies, copy all the files from the diskettes into the C:\ directory using the floppy drive. If you downloaded the files from here, you don't need to put them on floppies. You can just download them directly into the C:\ directory.
Make sure you do not have any directories called C:\linux or C:\doslinux. DOSLinux will install files into both of these directories, and may overwrite anything you have there already. To build it, open a command window and execute doslnx54. This will automatically expand the DOSLinux distribution from the doslnx54.r0* image files.
Then execute zimagei; this expands the DOSLinux kernel itself and produces a batch startup script called linux.bat.
DOSLinux cannot be started from Windows 95; you must start it from native DOS. Shut the Libretto down again, and replace the FIPS diskette into the floppy drive. Boot up from that diskette; when you get the command prompt, type
> c:
> linux.bat
After DOSLinux starts up, you'll be logged in as root. You now create the Linux and swap partitions. Type
# /sbin/fdisk
When you used FIPS, it left a blank partition immediately following the Windows partition. Delete this by typing "d" and following the instructions. Then create your Linux partition by typing "n" to create a new partition. fdisk will ask you how big you want to make the partition (which will be /dev/hda2). Create as many main partitions as you like. Many people like to have a bunch of partitions (to avoid losing everything if one small section of the disk is corrupted). I used to regard this sort of thing with admiration, but I've found that most of my disk is frequently updated, so it needs to be backed up all the time, anyway. So I have just one partition. Make sure to leave enough room for the swap partition; it should be at least 32 MB plus the amount of memory you have. My disk looks like this:
Disk /dev/hda: 64 heads, 63 sectors, 788 cylinders
Units = cylinders of 4032 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 261 526144+ 6 FAT16
/dev/hda2 262 720 925344 83 Linux
/dev/hda3 721 753 66528 82 Linux swap
You may note that the last 25 cylinders (about 50 megabytes) are unallocated. The Libretto will write memory to the last 32 MB of the disk when hibernating (see Section 4.3, below), so the swap partition must not extend that far, or else resuming may be a bit dicey. Don't forget to type "t" to change the type of the swap partition to 82 (Linux swap). Then type "w" to write the table and exit.
(It's possible that the BIOS actually hides the 32 MB used for hibernation from the operating system, but 32 MB isn't that much, and it's best to be safe.)
The role of DOSLinux in this installation is to make both the Windows and Linux partitions visible from the same vantage point. You transfer files, using Windows, from the existing installation to the Windows partition, and you then use DOSLinux to transfer those same files from the Windows partition to the Linux partition. Once the files are put in place, you no longer need DOSLinux, but you still need the partition.
With that in mind, we now create a Linux filesystem on the new partition(s). For the partitioning listed above, you type
# /sbin/mke2fs /dev/hda2
# /bin/mkdir /linux
# /bin/mount -t ext2 /dev/hda2 /linux
These three commands create an ext2 file system (the standard Linux filesystem before ext3) and mount it in a new directory called /linux. This is distinct from the C:\linux directory used by DOSLinux, so nothing here will be overwritten. The Windows partition is already visible from within DOSLinux, mounted at the /DOS directory. Also, configure the swap partition by typing
# /sbin/mkswap -c /dev/hda3
You are now ready to start transferring files from the existing installation to the Libretto. From within Windows, use a network connection or ZIP drives to copy files to the Windows partition. Then enter DOSLinux to copy those files to the Linux partition, under the /linux directory. Because this requires you to boot and reboot each time you change from Windows to DOS, you should try to minimize the number of steps required to transfer the files. Remember that (a) you must start DOSLinux from DOS, not Windows; and (b) you do not need to create the file system or the /linux directory each time, but you do need to mount the file system onto the /linux directory.
The files that you transfer should all be put under the /linux directory, so that (for instance) the entire /etc directory of the existing installation will appear in /linux/etc in DOSLinux. You will need to transfer every file that you would need in an ordinary installation. Once you've moved everything over and put it in place, you can test your new system by typing in DOSLinux
# cd /linux
# /sbin/chroot /linux
You should now be at root in the new Linux system. Everything that was outside the /linux directory under DOSLinux will be invisible. This would be a good time to run passwd to set your root password for your Libretto by typing
# /usr/bin/passwd
When you're done, type
# exit
to return to DOSLinux.
You'll need to configure the hostname of the Libretto. If you have a network connection and a hostname for your Libretto, this will go in /etc/sysconfig/network (of your new Linux system), as below:
NETWORKING=yes
HOSTNAME=host.example.com
DOMAINNAME=example.com
GATEWAY=10.0.0.1
GATEWAYDEV=eth0
Of course, you'll have to put your own hostname and parameters in here in place of the examples.
Another thing you might have to concern yourself with is setting up your XF86Config file. If you don't want to go through the trouble, here's a sample XF86Config file that ought to get you up and running. In Red Hat 6.2, this file goes in /etc/X11/XF86Config.
If you didn't copy your home directory over, don't forget to fill in your .xinitrc file; otherwise, X may not open any windows.
To exit DOSLinux, you should type
# shutdown -h now
DOSLinux doesn't support APM, so the system will just hang after shutting down everything. After DOSLinux indicates "System halted," press ctrl-alt-del to reboot and bring up Windows.
Move the kernel from your existing system onto the Libretto in the DOS partition in some convenient location, such as C:\boot. I choose to use the loadlin boot loader on the Libretto (I use grub on my bigger laptop); I'll describe that method here. Get a copy of loadlin.exe (for example, here) and put it into C:\bin. To start Linux (not DOSLinux) from a batch file inside DOS, create the following file and call it linux2.bat (since linux.bat starts DOSLinux):
@echo off
c:\bin\loadlin.exe c:\boot\vmlinuz root=/dev/hda2 ro
(You may choose a different location for your loadlin and your kernel.) To start Linux, just boot up in DOS mode, and type
> linux2.bat
to start Linux. You should always be able to use this method. To set
up a start-up menu, edit config.sys so that it looks like this:
DOS=HIGH,UMB
[menu]
menuitem=Linux, Linux
menuitem=DOS, DOS
menuitem=Windows95, Windows 95
[Linux]
shell=c:\bin\loadlin.exe c:\boot\vmlinuz root=/dev/hda2 ro
[DOS]
shell=c:\command.com c:\
[Windows95]
shell=win
Now, when you start up your Libretto, it'll do its memory check, then display a three-item menu: Windows 95, DOS, or Linux. You can use the arrow keys or number keys and the enter key to make your selection.
Slide the modem card into the slot, and inspect /var/run/stab. You should have a line for slot 0 that indicates a serial_cs card present. One of the parameters should show you the tty for the card. If this says ttyS1, then the appropriate device is /dev/cua1; if it says ttyS2, the appropriate device is /dev/cua2. Assuming that it is /dev/cua1, you must make sure /dev/modem is symlinked to the right device by typing (as root)
# ln -s /dev/cua1 /dev/modem
Check Windows 95, under "Settings -> Control Panel -> Multimedia -> Advanced." Double click on audio devices, and then on the Yamaha sound card (which is what's in the Libretto). Look at the IRQ/DMA settings for the sound driver of your choice, and see if they match up with the compiled-in settings for your kernel. You can check the IRQ for the sound driver by typing
# grep soundblaster /proc/interrupts
The proper IRQ will be the number before the colon, at the left hand side. Find the DMA address by typing
# grep SoundBlaster8 /proc/dma
The DMA is the number before the colon. Finally, the I/O port address can be found by typing
# grep soundblaster /proc/ioports
The I/O port addresses are given by the range of hexadecimal numbers at left.
Go into Windows 95, under "Settings -> Control Panel -> Power Saver." This will give you the power management settings for battery and AC power. Click on Details. Go under System, and make sure that Hibernate mode is selected (checked), as well as the box marked "Enter resume mode when lid is closed." Do this for battery power; whether or not you do it for AC power is up to you.
The good thing is that suspend is done entirely between the BIOS and hardware, so it works equally well under Linux or DOS. This isn't the case on most machines.
I recently (February 2005) got my Cisco Aironet 350 wireless card to work with the Libretto. It merely requires that you download and install version 3.1.27 (or later) of David Hinds's PCMCIA package. You can find all the more recent versions on the PCMCIA SourceForge here. (These instructions will only work if you have a Cisco Aironet 340 or 350; other instructions apply otherwise.)
Once you install it, reboot the machine back into Linux, and configure the card as follows. Insert the card into the PCMCIA slot, and verify that the card was loaded properly by typing (as root)
# ls /proc/aironet
There should be one subdirectory in this directory, which will be called either eth0 or eth1, depending on which interface name the kernel has assigned to the wireless card. Assuming that it's eth0, you now type
# cd /proc/aironet/eth0
You must now configure your card properly. Your access point should have an SSID (or ESSID); if it is, for example, "linksys", then type
# echo linksys > SSID
If you are not using WEP (Wired Equivalence Privacy), you should be ready to start up the interface (see below). If you are using WEP, you must do some additional configuration. Type
# echo 0 XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX > WepKey
# echo 0 > WepKey
where the XX's should be replaced by the hexadecimal bytes of your WEP key. The first command inserts that key into the first key slot (slot 0) of your card, and the second command tells your card to use that key. The card actually has four or five key slots, but I tried using the other slots and couldn't get the card to work properly. Lastly, type
# echo WEP: encrypt > Config
This final command tells the card to use WEP; if you don't use WEP, you should see "WEP: open" if you type
# cat Config
You are now ready to start up the interface. Type
# /sbin/ifup eth0
For the sake of convenience (especially as I alternate between two different SSID's and keys at home and at work), I put these commands in a pair of shell scripts that I run under sudo.
The floppy drive is a PCMCIA device that Linux doesn't ordinarily know how to access. There is a special driver originally written by David Bateman, and more recently updated by Christian Gennerat. Bateman's driver is for the 2.0 and 2.2 kernels, and Gennerat's driver is for the 2.4 kernels, should you install one of those. Follow the instructions included with either distribution.
This treatment is based on instructions by Steve Meyer, which were in turn based on communications between him and David Maggin. Steve's notes used to be on the Web, but I think they have since disappeared.
Aside from Steve's write-up, this document is based on my own notes. If you have any comments, questions, or suggestions, please pass them on to me at <brian@isi.edu>.
More reports like this at Linux on Laptops.
Copyright (c) 1998, 2002, 2005 Brian Tung