Installing Linux on a 386 laptop

The “cheap” and “easy” way in about an hour! A question that pop’s up from time to time is “I somehow ended up with an archaic old laptop / computer, can it run Linux?” Well of course it can, but that totally depends! On what? Well machine CPU, CPU speed, hard disk space, RAM and most importantly what you are expecting it to do.

Okay, why a Intel 386? Well number one I own a 386, but more importantly its the absolute bottom Intel CPU you can run Linux on. While it wont be able to do much, it will give you a basic system to kick around and “get to know” the insides of Linux without a million things installed and the worry of breaking it.

Unfortunately a 386 requires some special moves as the actual chip was dropped from almost all distributions long ago. All of the modern distributions I have looked at require at least a 486 CPU. This tutorial will be strictly for installing a basic bare bones Linux on a 386. Have a 486? Pentium? Faster? Never fear I will be covering that in a part II later this week.

Linux on a 386 in about an hour? Madness you might think, it probably takes Linux longer to boot on a 386 (and in some cases you are correct)! Want to know the trick? Simple, cheat!

Join me after the break for the parts and steps needed to get you started.

First we need a target machine, here is mine. It is a DEC PC325SL, which translates out to intel386SL (which is a 386SX CPU in a highly integrated package where much of the support hardware is also inside the chip) running at 25Mhz with 4MB of ram and 120MB of hard disk space. It also has 256K video memory and 640×480 color VGA display. If you can swing it, a 386DX CPU or a 386S(X/L) with a 387 math co-processor is recommended, no it doesn’t really matter if its an Intel, AMD, etc. It also needs an IDE disk up to 2G, sorry MFM drives.

Next we need a distribution that will actually work with a 386 CPU. This is where it gets to be confusing. Everyone still has a distribution called i386, but support for the 386 was dropped a while ago. I looked at some of my favorites, Debian, Slackware, FreeBSD, and NetBSD (which I know are not Linux but hey.) Here is what I found out:

Debian stopped support with 3 so anything earlier is ok.

Slackware stopped around the same time in release 9.

FreeBSD states that it requires a 386DX, but then says most 386 laptops are ok via math emulation, but in a more current readme it states that you need a 486 (confused?)

NetBSD says it should work on all 386′s but I never made it that far.

Well of course I am not a super Linux guru, and can really only futz around without running off to a forum or a book, so I went with Debian. Originally version 2.2 as it was the newest version that machine could run, and yes in fact it did. The problem is it took over an hour to boot with a year 2000 generic kernel and when it finally did it refused to move past the package installer.

You could spend a lot of time trimming and optimizing to get it running great, but I am facing a brutal truth here, and that is the best I could run is still over a decade out of date and its going to require a lot of work. So I just simply stepped back in time a bit further to find something a bit more appropriate.

In the end I used Debian 1.3.1, which is a mid 1990′s Linux, and that’s really the point. Use whatever you like but its going to have to be pretty old or require a ton of work, which at that point you might be better off doing it from scratch.

Tools for the cheat install:

x86 compatible Host PC with an IDE/ATA port, and a standard BIOS capable of booting into DOS. I used my dual core AMD A2X2 with a nvidia chip-set so its pretty safe to say most PC’s will. It also needs an Internet connection and some form of Linux installed or booted (I use mint)

CD ROM or USB stick you can boot from with a windows 98 emergency boot disk (EBD from here on), or since MS DOS does not know how to access USB or SATA CD ROM’s, I used a old IDE drive with a 100Mb FAT16 partition on it.

IDE to 3.5 IDE pin adapter, they are cheap and handy I suggest you have one, just make sure you plug it in correctly you can kill your drive (as in magic smoke kill).

That should do it, lets get started

Step One:

Turn off your Host PC, plug in a spare IDE hard disk set as slave. To keep my self from borking my computers main drive I went ahead and unplugged it from the SATA port. Check BIOS to make sure its detected and that you are booting from your CD drive first, Insert the Windows EBD save changes and let the computer boot from the EBD.

You will see a Windows boot disk menu, choose to “start without cd rom support”. Once at the DOS prompt use FDISK to setup a 100 or so meg partition, be sure to tell FDISK no when it asks you if you want large disk support to ensure a FAT16 partition.

Exit FDISK, reboot with the EBD and use FORMAT C: (make sure that is the correct drive if you have others plugged into the system), then Eject the EBD. In my case I then plugged my SATA hard drive back in and set BIOS to boot from that disk and went on into Linux Mint, though you could leave your main drive unattached and use a live CD Linux.

I know that linux can make a FAT16 partition. I was having trouble with the EBD reading it while figuring this all out, so I just started making the partition with the OS that really needs it most.

Step Two:

Boot your Host PC into Linux, I am using (again) Linux Mint but It does not matter, it just has to be able to get on line, and mount a FAT16 partition. Point your web browser to the Debian archive and goto the following folder Debian-1.3.1/main/disks-i386/1997-10-13/

Download the following files

base1_3.tgz

resc1440.bin

drv1440.bin

linux

loadlin.exe

root.bin

and copy them to your FAT16 partition.

Optional Step:

My 386 came with 120 meg disk, That might be large enough to squeeze a basic Linux system on, but I also wanted a little room for a MS DOS partition so I upgraded to a 540 meg hard drive. Of course 386′s and other <1994 machines have a bios limitation of 1024 cylinders limiting the drive to 500 megs. This computer is even more picky limiting my choices down to 2 DEC approved drives, the 120 meg or a 240 meg (probably sold as an option). In order to use this drive so that both DOS and Linux can live happily on it, I must use a drive overlay (ick). So far I have been avoiding the use of floppies, but I do have floppies, and the drive on the machine works fine.

I found a old copy of Western Digital EZ Drive 9.03, I also used a MS-DOS6.22 boot floppy image. EZ drive is simple but even if you do not want a DOS partition, you HAVE to have one or else EZ drive will scream “no boot partition” and halt. So make at least 1 MSDOS partition at the start of the drive, even if its only a megabyte in size.

Step 3:

Remove the hard disk from the 386 and attach it to your host PC, it should be MASTER on Channel 0 and the drive with the FAT16 partition we put the install files on. should be the SLAVE on Channel 0. Enter your PC bios and find your 386′s drive, and be sure to turn off LBA. If you are using a drive overlay set your bios where it boots from the 386 drive first.

Reboot the Host PC (I disconnected my main drive for now as well), if you are using a drive overlay let it boot the hard disk first, then tell the overlay to boot from drive A, insert your Windows EBD into your CD drive and it will eventually load. If you are not using an overlay just boot from the Windows EBD. When you come up to the EBD boot menu use the arrow keys to stop the timer, then hold SHIFT and press F5 which will just dump you directly to a command prompt.

Find the drive with the linux install files on it and run:

loadlin linux root=/dev/ram initrd=root.bin

The debian installer should fire right up, follow the menus until you come to the disk partitioner. Create 2 partitions, 1 as type 82 (linux swap) at about 16-32 megs big, and the other should be set up as you like as your space. I just used the remainder of the disk and it defaulted to a linux type. Write the changes and continue on with the installer. Also be sure to use the right disk, it should be /dev/hda

The installer should continue and eventually ask you to install lilo, which is fine on the MBR, then reboot. Remove any disks still left in the Host PC and Debian should start. Now you have to go though another round of configuration questions. Eventually you will get to the dselect package manager (which I hate). Once you figure out how to exit dselect you should still be root. Type in halt and the system should start shutting down, if you are logged into your user account you need to use su and enter the root password first to halt the machine.

Step 4:

Once everything is down, remove your 386 drive from the Host PC and place it back into the 386, with a little luck it should start up just fine. Though there is nothing but the bare basics installed, there is still a ton of stuff to check out and poke around through. Outside of reading this and getting everything prepared it should take about an hour.

Getting software packages into the machine, right now I am just downloading the deb files from the Debian archive on my mac and coping them over via floppy disks. Another option would be to use minicom and a null modem cable. If you are really lucky you can get networking going. I downloaded the entire binary-i386 folder for Debian 1.3.1 and its about 400MB, and while I am not trying to load the machine up, some things like a menu driven text editor (fte) and mouse support are nice.

Have fun and be sure to tune in for part II which involves my 8MB Pentium 90 laptop for linux after 386, you might find it surprising.

Comments

  1. Justin says:

    @Shawn H. Corey

    You did not install Linux on a 286. At least, you did not successfully boot it. Linux has always required at least a 32 bit architecture. It was developed on a 386.

    There is a project called ELKS that created a Linux-like kernel for earlier CPUs. ELKS is not Linux even if that is what the L stands for.

    In my experience, one of the problems with running Linux on older CPUs is that modern GCC will include instructions that older CPUs cannot handle. The kernel itself is not so much the issue.

  2. @ shawn i just installed linux on my pencil.

  3. sgf says:

    Just to join in with the others, ‘Oooh, that brings back memories. =D’.

    SLS Linux on a 486sx in ’95. Trying to run X and Netscape in 4MB, and watching it thrash as I moved the mouse. Fun, fun, fun.

  4. kukuta says:

    Ahhh … the times when you had to set the IRQs manually, with jumpers, otherwise you might’ve found (after many hours) that your network card isn’t detected by Linux because of your serial port … those were the times :)

  5. totalizator says:

    My story: I’ve been looking around for a 486 machine for months and finally I’ve found one on an internet auction. It’s an exotic machine labeled as “Olivetti Echos 48 color plus” laptop. The specs are: 486 DX4 100MHz processor, 16MB RAM, 540MB HD, 3,5″ FDD, 2xPCMCIA slots, active color display, it’s pink (well, sort of), has German (QWERTZ) keyboard layout and has been manufactured in 1994. As if it weren’t enough the Olivetti is an Italian company but the laptop is assembled in Korea. Absolutely incredible . Oh and the original price in 1994 was $4038 USD. Here is an article I’ve found, introducing Echos 44 model (same look, older processor and smaller HD): http://issuu.com/adpware/docs/mc144?mode=embed&layout=http%3A%2F%2Fskin.issuu.com%2Fv%2Flight%2Flayout.xml&showFlipBtn=true&pageNumber=206 (unfortunately it’s in Italian!).

    So far, I’ve been able to get rid of Windows 98 which previous owner put inside (quite operational) and install a Debian Woody (3.0). Everything thanks to a six (sic!) magic floppy installer images from Debian archive (archive.debian.org) and a Xircom RealPort PCMCIA LAN card. The installation was unbelievably straight forward and the only inconvenience was changing the default apt sources (adding archive.* prefix to it). I’ve ended up with a ready to go ~100MB Debian install which after boot and logging in shows that the RAM usage is mere 3MB, swap usage 0MB (fully connected to the Internet).

    Lately I’ve even done dist-upgrade to Debian Sarge (3.1) and I think I’ll stick with that for longer as everything works just right. The machine is perfect for a dumb terminal as the only spinning thing is a hard disk and the power supply is labeled as 1,5A@21W max output. I’ve been able to run X on it with IceWM but despite using only 7MB RAM and ~20MB for SWAP it is too slow for comfortable use.

    Still, I think that it’s a great machine for which I can find many useful tasks on a daily basis (I’m not kidding). It’s unbelievably small – maybe a bit thicker than a modern netbook and proves how bloated modern laptops have become. It’s a great experience and a big lesson messing with hardware that old.

  6. RoadWarrior222 says:

    As I seem to recall, there was a hardware thing that made the difference between hairpullingly unusable and merely dog slow on 386 and 486 machines with only 4MB of RAM. It had to do with how the BIOS handled the UMA, the bit between 640K and 1MB… if it let linux use the whole 4096K, then booting to a shell and into X with a lightweight window manager, like FVWM was about as brisk as loading DOS and getting into windows, but if it only let you have 3900K or so, it was thrash city. My first linux adventures, circa 1995ish, were on a 386SL20 with 4MB, I tried a 10 disk slackware install at first I think, but munged it. Then used that one that came in a 5MB zip file and went on 4 floppies, that you just dumped to a FAT filesystem and used a loader. Puppy rings a bell, but might not have been it…

    The distributions of the day tended to be of somewhat low quality, and I spent more time messing around trying to fix circular links to libraries than actually using it for anything useful.

    One machine of mine of the time on which a light distro flew was a 386sx40, with hercules mono graphics… which ran rings around slower 486es, particularly with unaccelerated VGA support.

    Last outing on 386es for me was sometime early this century, when I was trying to get freesco going on IBM PS2 hardware. I spent an entire afternoon going crosseyed reconfiguring the PD arrays on some 72 pin SIMMS so they were PS2 compatible, and I could have a full 16MB in my 386sx16… well that worked… but the next part of my plan came up against IBM… I had desoldered the clock crystal and socketed it, and slapped in a 25Mhz one… bzzzt… the barstewards actually put a clock speed check in the BIOS… I found an 18Mhz crystal and it booted half the time with that in it… but ended up putting the 16Mhz stocker back in… It was just below bearable with that in it… so ended up configuring a 486 machine for it…

    But this retro install and talk of small distros reminds me, I still have an iOpener I haven’t got around to hacking yet… think I lost most of my links though :(

  7. Fernando Cassia (@fcassia) says:

    Blah. Linux on a 386 will be a dog. It was a dog. Heck it was even a dog in a Pentium I 166…

    Linux only became usable on Pentium III machines and up.

    For this 386sx, I’d just install OS/2 Warp 3.0 designed to work in 4MB RAM and with great apps, plus, there’s tons of ported software. Chances are you can still run Firefox for OS/2 on that machine with semi-decent performance (without Flash).

    FC

    • mail junky says:

      Funny, that I have pII web and blah blah blah servers that run linux (both Debian Squeeze and ubuntu 10..04 without a major problem. Do not expect it to work like multi-core box either. You have to define the jobs that it is best at. Ran Debian etch including gui on a p1 with 96 megs ram till it died. Though now I just try to use cl with them. Lots of excellent software for the command line at your fingertips in the repos. Being a mouse jockey is not required here.

  8. mail junky says:

    Found an old 386 in the closet to try the debian install.
    wget -r -l0 -nd –no-parent -A “*” -R “.*” http://archive.debian.org/debian/dists/Debian-1.3.1/main/disks-i386/1997-10-13/

  9. matz79 says:

    his is no hack, Linux runs on every 386SX, except 2.6/3.0 kernels (at least 20Mb ram needed/386SX can adress only 16Mb Ram)

    Slackware 8.0 runs well on 386SX/386DX, just use the lowmem kernel to boot
    but you need at least 12mb of Ram. If you pull out the harddisk and install on another computer with more resources, and compile a custom 386 kernel it will work in 4Mb too.

  10. this is a good way to spend your free time … I have to go to the attic and find my dad’s really old pc and give it a shot

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s