![]() | ![]() |
|
4mb Laptop HOWTOBruce Richardson <brichardson@lineone.net>25 March 2000How to put a "grown-up" Linux on a small-spec (4mb RAM, <=200mb hard disk) laptop.
1. Introduction
2. The Laptops
3. Choices Made
4. The Pre-installation Procedure
5. The Installation
6. Conclusion
7. Appendix A:
8. Appendix B: Resources relevant to this HOWTO1. Introduction1.1 Why this document was written.I got my hands on two elderly laptops, both with just 4mb RAM and small (<=200mb) hard drives. I wanted to install Linux on them. The documentation for this kind of laptop all recommends installing either a mini-Linux or an old (and therefor compact) version of one of the professional distributions. I wanted to install an up-to-date professional distribution. 1.2 What use is a small laptop?Plenty. It isn't going to run X or be a development box (see Which components to install?) but if you are happy at the console you have a machine that can do e-mail, networking, writing etc. Laptops also make excellent diagnostic/repair tools and the utilities for that will easily fit onto small laptops. 1.3 Why not just upgrade the laptop?Upgrading old laptops is not much cheaper than upgrading new ones. That's a lot to spend on an old machine, especially considering that the manufacturer isn't supporting it any more and spare parts are hard to find. 1.4 What about 4mb desktop machines?The procedure described in this document will work perfectly well on a desktop PC. On the other hand, upgrading a desktop machine is far easier and cheaper than upgrading a laptop. Even if you don't upgrade it, there are still simpler options. You could take out the hard disk, put it in a more powerful machine, install Linux, trim it to fit and then put the disk back in the old machine. 1.5 What this document doesn't do.This document is not a general HOWTO about installing Linux on laptops or even a specific HOWTO for either of the two machines mentioned here. It simply describes a way of squeezing a large Linux into a very small space, citing two specific machines as examples. 1.6 Where to find this document.The latest copy of this document can be found in several formats at http://website.lineone.net/~brichardson/linux/4mb_laptops/. 1.7 CopyrightThis document is copyright (c) Bruce Richardson 2000. It may be distributed under the terms set forth in the LDP license at sunsite.unc.edu/LDP/COPYRIGHT.html. This HOWTO is free documentation; you can redistribute it and/or modify it under the terms of the LDP license. This document is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the LDP license for more details. Toshiba and T1910 are trademarks of Toshiba Corporation. Compaq and Contura Aero are trademarks of Compaq Computer Corporation. 2. The LaptopsThis section describes the laptops that I have used this procedure on, the problems faced when installing Linux on them and the solutions to those problems (in outline). 2.1 Basic SpecificationsCompaq Contura Aero
Toshiba T1910
2.2 The ProblemThe small hard disks and the lack of an internal floppy on the Aero make the installation more tricky than normal but the real problem is the RAM. None of the current distributions has an installation disk that will boot in 4mb, not even if the whole hard disk is a swap partition. The standard installation uses a boot disk to uncompress a root-partition image (either from a second floppy or from CD-ROM) into a ram-disk. The root-image is around 4mb in size. That's all the RAM available in this scenario. Try it and it freezes while unpacking the root-image. 2.3 The SolutionThe answer is to eliminate the ram-disk. If you can mount root on a physical partition you will have enough memory to do the install. Since the uncompressed ram-disk is too big to fit on a floppy, the only place left is on the hard disk of the laptop. The steps are:
The only question was whether a distribution that wouldn't install (under normal circumstances) on the laptops would run on them. The short answer is "Yes". If you're an old Linux hand then that's all you need to know. If not, read on - some of the steps listed above aren't as simple as they look. 3. Choices MadeThis section describes the choices available, which options are practical, which ones I decided on and why. 3.1 What to use to create the initial root partition?The best tool for this is a mini-Linux. There's a wide selection of small Linuces available on the net, but most of them won't boot in 4mb RAM. I found two that will:
This gives the option of either using SmallLinux to create the partitions and muLinux to copy the root partition or using muLinux to do the whole job. Since I had two laptops I tried both. 3.2 The DistributionIt didn't take much time to choose Slackware. Apart from the fact that I like it but haven't used it much and want to learn more, I considered the following points:
Version 7.0 was the latest version when I tried this so that's what I used. But I don't like Slackware!You don't have to use it. I can't answer for all the distributions but I know that Debian, Red Hat and SuSE offer a range of installation methods and have an "expert" installation procedure Does Debian do any other kind?which can be used here. Most of the steps in this document would apply to any of the distributions without change. If you haven't used the expert method with your preferred distribution before, do a trial run on a simple desktop machine to get the feel of it and to explore the options it offers. 3.3 Which installation method to use?
The tools I had to hand dictated a PCMCIA network install. I will point out where steps differ for the other methods. Whichever method you choose, you need to have a higher-spec machine available - even if only to create the disks for a floppy install. 3.4 Partition LayoutBasic RequirementThis procedure requires at least two Linux Native partitions in addition to a Swap partition. Since one of the ext2 partitions will be in use as temporary root during the installation it will not be available as a target partition and so should be small - though no smaller than 5mb. It makes sense to create for this a partition that you will re-use as /home after installation is complete. Another option would be to re-create it as a DOS partition to give you a dual boot laptop. How complex a layout?There isn't room to get too clever here. There is an argument for having a single ext2 partition and using a swap file to avoid wasting space but I would strongly urge creating a separate partition for /usr. If you have only one partition and something goes wrong with it you may well be faced with a complete re-installation. Separating /usr and having a small partition for / makes disaster recovery a more likely prospect. On both machines I created 4 partitions in total:
In addition, the Aero uses hda3 for a 2mb DOS partition containing configuration utilities. See the Aero FAQs for details. 3.5 Which components to install?The full glibc libraries alone would nearly fill the hard disks so there's no question of building a development machine. It looks as if a minimal X installation can be squeezed in but I'm sure it would crawl and I don't want it anyway. I decide to install the following (for a full listing see Appendix A):
This selection matches the kind of machine described in What use is a small laptop?. 4. The Pre-installation ProcedureThis section covers creating a swap partition and a temporary root partition on the laptop's hard disk. Nothing here is Slackware-specific. 4.1 muLinux PreparationIf you are going to use only muLinux to for this procedure then you need to prepare a disk with mkfs.ext2 and supporting libraries on it. From the muLinux setup files uncompress USR.bz2 and mount it as a loop file-system. If you are in the same directory as the USR file and you want to mount it as /tmpusr then the sequence for this is:
losetup /dev/loop0 USR mount -t ext2 /dev/loop0 /tmpusr >From there copy mkfs.ext2, libext2fs.so.2, libcomerr.so.2 and libuuid.so.1 onto a floppy. 4.2 Prepare the installation root files.Select the root disk you want - I used the color one with no problems but the text one would be slightly faster in these low memory conditions. Uncompress the image and mount it as a loop device. The procedure is the same as in the above section but the root disk image is a minix file-system. Next you need 3 1722 floppies or 4 1440 floppies with ext2 file-systems - it's better with 1722 disks as you don't need to split the /lib directory. Give one floppy twice the default number of inodes so it can take the /dev directory. That's 432 nodes for a 1722 disk or 368 for a 1440. If you specify /dev/fd0H1722 or /dev/fd0H1440 then you don't have to give any other parameters so for a 1722 disk do
mke2fs -N 432 /dev/fd0H1722 If you have mounted the root image as /tmproot and the destination floppy as /floppy then cd to /tmproot. To copy the dev directory the command is
cp -dpPR dev/* /floppy/ For the other directories with files in (bin, etc, lib, mnt, sbin, usr, var) it's
cp -dpPr directoryname/* /floppy/ Don't bother with the empty ones (floppy, proc, root, tag, tmp) because you can simply create them on the laptop. boot and cdrom are soft links pointing to /mnt/boot and /var/log/mount respectively - you can also create them on the laptop. 4.3 Create the partitions.Mini-Linuces and ext2 file-systems - an important note.To save space, small-Linux designers sometimes use older libc5 librariesand where they do use up-to-date libc6 they leave out may of the options compiled into full distributions, including some optional features of the ext2 file-system. This has two consequences:
ProcedureIf installing on an Aero, make sure the floppy drive is inserted before switching on and do not remove it.
5. The InstallationThis section does not give much detail on the Slackware installation process. In fact, it assumes you are familiar with it. Instead, this section concentrates on those areas where special care or unusual steps are required. 5.1 Boot the machineMake a boot-disk from one of the images. I recommend you use bareapm.i on a laptop and bare.i on a desktop - unless you have a parallel-port IDE device (pportide.i). Boot the laptop from it. When the boot: prompt appears, type "mount root=/dev/hdax" where x is the temporary root partition. Log in as root. Then activate the swap partition. 5.2 Floppy/Parport CD-ROM InstallIn both these cases, no extra work should be necessary to access the installation media. Simply run setup. 5.3 Network/PCMCIA InstallSlackware has supplementary disks with tools for these and instructions for their use greet you when you log in. Use the network disk on a desktop PC with ethernet card or a laptop with pocket ethernet adaptor. Use the PCMCIA disk for PCMCIA install. Once your network adapter/PCMCIA socket has been identified, run setup. PCMCIA install on the AeroThe Slackware installation process runs the PCMCIA drivers from the supplementary floppy. Because the Aero has a PCMCIA floppy drive, this means you can't remove the floppy drive to insert the PCMCIA CD-ROM/ethernet card. The solution is simple: the Slackware PCMCIA setup routine creates /pcmcia and mounts the supplementary disk there, so
5.4 Set-upThe Slackware set-up program is straightforward. Start with the Keymap section and it'll take you forward step by step. AddSwapYou do need to do this step so it can put the correct entry in fstab but make sure it doesn't run mkswap - you're already using the partition. TargetIn this section Slackware asks which partitions will be mounted as what and then formats them if you want. The safest bet here is to leave your temporary root partition out altogether and just edit fstab later once you know you don't need it for it's temporary purpose anymore. If you're going to reuse it as /home then it is OK to designate it as /home - obviously, don't format it now! If you intend to re-use it as a part of the directory structure that will have files placed in it during installation (/var, for example) then you absolutely must ignore it in this step: after the installation is complete you can move the files across. SelectHere you choose which general categories of software to install. I chose as follows:
I wouldn't recommend adding to this - if anything, prune it back to A, AP and N. That gives you a core Linux setup to which you can add according to your needs. InstallChoose the Expert installation method. This allows you to select/reject for installation individual packages from the categories you chose in the Selection step. Appendix A goes through the precise choices I made . This part takes about 3 hours for a PCMCIA network install. You are prompted to select individual packages before the installation of each category, so you can't just walk away and leave it to run through. ConfigureOnce the packages are all installed, you are prompted to do final configuration for your machine. This covers areas like networking, Lilo, selecting a kernel etc. Some points to look out for:
ExitThe set-up process is finished but you are not. Do not reboot yet! There is another vital step to complete. 5.5 Pre-reboot ConfigurationOn a normal machine you would simply reboot once the installation is complete. If you do that here you may have to wait 6 or 8 hours for a login prompt to appear and another half hour to get to the command prompt. Before rebooting you need to change or remove the elements that cause this slowdown. This involves editing config files so you need to be familiar with vi, ed or sed. At this stage your future root partition is still mounted as /mnt so remember to at that to the paths given here.
Once these changes have been made, you are ready to reboot. 5.6 Post-reboot Configuration.If you made the changes recommended in section Pre-reboot configuration then the boot process will only take a few minutes, as opposed to several hours. Login as root and check that everything is functioning properly. Re-use the temporary root.Once you are sure the installation is solid you can reclaim the partition you used as the temporary root. Don't just delete the contents, reformat the filesystem. Remember, the mke2fs that came with the mini-Linux is out of date. If you intend to re-use this partition as /home, remember not to create any user accounts until you have completed this step. Other configuration tweaks.In such a small RAM space, every little helps. Go through SlackWare's BSD-style init scripts in /etc/rc.d/ and comment out anything you don't need. Have a look at Todd Burgess' Small Memory mini-HOWTO http://eddie.cis.uoguelph.ca/~tburgess/ for more ideas. 6. ConclusionThat's it all done. You now have a laptop with the core utilities in place and 50 to 70mb spare for whichever extras you need. Don't mess it up because it's a lot easier to modify an existing installation on such cramped old machines than it is to start from scratch again. 7. Appendix A:This appendix lists which packages (if any) from each category might be included in the installation and gives my reasons for including or omitting them. I made no attempt to install X so those categories are ignored. Although this appendix refers specifically to the Slackware distribution it can be used as a guide with any of the major distributions. 7.1 A - Base Linux SystemMost of the packages in this category are essential, even those that aren't listed as required by the Slackware set-up program. Because of this, I've listed those packages that I felt could reasonably be left out rather than all the non-compulsory packages that I installed. Packages considered for omission:
Packages installed:aaa_base, bash, bash1, bin, bzip2, cpio, cxxlibs, devs, e2fsprog, elflibs, elvis, etc, fileutils, find, floppy, fsmods, glibcso, gpm, grep, gzip, hdsetup, infozip, kbd, ldso, less, lilo, man, modules, modutils, pcmcia, sh_utils, shadow, sudo, sysklogd, sysvinit, tar, txtutils, util, zoneinfo Combined size: 33.4 7.2 AP - Non-X ApplicationsNone of these packages are, strictly speaking, essential - although ash is really required for sensible operation in 4mb. Leaving them all out could save the vital space for you to squeeze in your favourite app. I selected a minimal set of tools that I don't like to do without. Packages considered for inclusion:
Packages installed:apsfilter,ash, diff, groff, ispell, manpages, quota, sc, sudo, texinfo Combined size: 8.1 mb 7.3 D - Development ToolsYou could fit C or C++ into this space but the glibc library package is too big, so some pruning would be needed. Do the main installation first and then try it. There is room for Perl and Python. Packages installed:None 7.4 E - EmacsI don't use Emacs and so saved myself some space. On the other hand, if you are an Emacs fan then you probably use it for e-mail, news and coding so you'll claim some of that space back by omitting other packages. If you do want Emacs it might be an idea to leave this out while doing the core installation. Once the laptop is up you can try fitting in what you want/need at your leisure. Packages installed:None. 7.5 F - FAQs and HOWTOsIf you know it all you don't need these. I installed the lot. Packages installed:howto, manyfaqs, mini Combined size: 12.4 mb 7.6 K - Kernel SourceYou can just squeeze it in. If all you want to do is read the source, go ahead. Packages Installed:None 7.7 N - Networking Tools and AppsThese packages were selected to provide core networking tools, dial-up capability, e-mail, web and news. Packages installed:dip, elm, fetchmail, mailx, lynx, netmods, netpipes, ppp, procmail, trn, tcpip1, tcpip2, uucp, wget Combined size: 15.1 mb 7.8 TetexAnother set that will barely squeeze in. I can't say how it would run in the space available. Packages installed:None 7.9 Y - BSD Games CollectionI'm addicted to several of these. If I really need that last 5mb they can go. Packages installed:bsdgames Combined size: 5.4 mb 7.10 End resultIn total the installed packages plus kernel took up about 75mb of disk space of which 19.5mb was in the root partition and 55.5 in /usr. On the Aero that left 39mb in /usr, 74mb on the T1910. 8. Appendix B: Resources relevant to this HOWTO
|
![]() |