This computer only has 4mb of ram (SIPP ram. hard to upgrade). I would like to install linux on this machine.
What I want from the system.
-> no gui
-> c compiler
-> vi or vim as editor
It's entirely possible run a linux implementation on such a small computer, but there are many considerations which may limit the sort of linux it is and hence the attractiveness it may have. Here are my observations.
Modern linux kernels can be compiled to be small, but they are regularly around 7 megabytes these days so they would need some work to be reduced. The small computer would likely work best with a kernel compiled to around 1 megabyte which would leave room in RAM for it to be able to work with other programs.
Modern vi is a little over 3 megabytes, so that's not going to fit the small computer.
The compiler gcc is just under one megabyte, which is nearly a quarter of the RAM and not sounding ideal.
Here are some recollections creating small linux bootdisks. In the olden days when creating a bootable linux system which ran in 4 megabyte machines, there would be a single 3.5 inch floppy disk of 1.44 megabytes to work with. On that disk, one would place a kernel which had been compiled to be as small as one could, together with a root filesystem for the rest of the space. In those days the kernel had a bootloader built into it so a separate bootloader wasn't necessary. On the root filesystem one would include the programs one wanted to run which were usually all contained in one executable called busybox. Busybox was, and still is, a suite of linux utilities in a very stripped down form which enabled it to run on small systems with a small footprint. It included the programs like ls, cd, cp, mv, chmod, chroot, date etc. and it also included the text editor vi. A linux system that fitted on a 1.44 megabye disk was a good fit for a computer with 4 megabytes of RAM. Busybox itself can be compiled to include just the utilities the user wants so it can be adjusted in size. I believe current pretty fully featured busybox is about 1 megabyte, but I can't see that it includes a compiler.
Today, to create a bootable linux system that will drive the small computer, one needs a bootloader, a kernel and a root filesystem that includes the linux utilities. It's entirely creatable using syslinux as the bootloader, a bespoke stripped down kernel which basically includes only the drivers for the hardware of the machine and everything else deleted, and the root filesystem with busybox. There's an issue with the compiler, gcc. I'm not familiar with stripping that down, so that's an exercise for the OP but there are smaller compilers but again I'm not familiar with them. The other issue is the learning curve in creating the bespoke system. Fortunately there are quite a few resources online if one wants to follow this path. The advantage is that it offers the possibility of having that small computer work optimally with modern software. And finally, there is the issue of how to load it onto the computer whether by cd, usb, network or however.
Edit: Below is a link to an example in modern times of the sort of system described above. It's particularly educational. Whether in it's present form it would fit the 4 megabyte environment I can't say, but it's certainly adaptable.
Minimal Linux Live (MLL) is a tiny educational Linux distribution, which is designed to be built from scratch by using a collection of automated shell scripts. Minimal Linux Live offers a core envi...