Sunday, April 27, 2014

The Adventure of running Linux on an Amiga 1200 in 2014

A few weeks ago I've googled a little bit for the keywords "amiga" and "linux" and discovered that the m68k port of Debian is still in development and maintenanced.
I remembered trying to install a Debian 2.0 inside a WinUAE enviroment a few years ago but it somehow failed as the kernel never really came up running. At this point it was only a small test and I just said myself that the kernel maybe needs a part of Hardware which only a real Amiga has.
Looking back I assume I've forgotten to enable the MMU emulation....

Being more experienced with linux now and also in the possession of an Amiga 1200 equipped with a 68030 (with MMU!!) and 64 MB of memory I finally decided to try it again. But this time without any old prebuilt solutions.
As it turned out the only part really maintained is the Debian Ports repository. New installation CDs are not available. But this shouldn't be an issue I thought. Experienced with the Debian multistrap tool for embedded systems I've built a root file system using this repository with nearly up-to-date packages.

The official Debian Wiki for M68k gives a few hints on the installation and also distributes prebuilt kernel images. I've tried one and guess what. It actually worked and my 1200 was running linux 3.2.x!
I just had to grin while the ridiculously slow configuration process was running.... time zone ... click click ..... keyboard layout .... click click ..... discoverying network hardware........ FAILED!!!


Source: http://www.gamesaktuell.de/screenshots/970x546/2012/04/FUUU_Guy.jpg

If you are not a linux user you might don't know this but having access to a network hardware is essential for Debian. Especially if you don't have any installation CD this is the only way to install software.
So what to do now? Looking into /lib/modules I could find some drivers but none for my 3COM Etherlink III which apparently has the chip 3c589. There is actually a list of some guy about supported PCMCIA network hardware for the Amiga. My card is also listed but as an unsupported one.

The kernel of the Debian Wiki offered only about 6 network drivers and I couldn't believe these were all. So I downloaded a vanilla 3.14.1 kernel wishing I could compile it with more modules. So the pain was about to begin...

What do you need to compile a kernel? A compiler might be a good starting point. If you want to compile linux software for the m68k a m68k-linux-gnu-gcc is the right thing. Debian offers the Emdebian repository which gives quite a few cross compilers. So while browsing the package manager I've found the right thing. So cool, huh? Well no! The m68k-gcc inside the official Emdebian Repository has an unresolved dependency and couldn't be installed. I couldn't believe it. So I started to compile binutils and the gcc manually. Somehow no success. I don't want to discuss the reasons here. Some missing headers or what......
As the process of making a toolchain seemed to be black magic i tried to use crosstool-ng, a software to auto-generating gcc toolchains. So cool, huh?
Well NO! crosstool-ng doesn't offer m68k support with the normal libC. Instead only µlibC. Arghh! No! Well, I dont' care. Just build the µlibC version It might work as well. And again a stone in my way. The elf2flt repository is down and crosstool-ng is unable to build anything. What a joke!
I also tried to use a prebuilt bare metal compiler using the target m68k-elf- as I thought it wouldn't matter for the kernel. It compiled well but It crashed at the point in head.S where the startup routine was about to enable the MMU. You can actually see it as the m68k port prints the alphabet on the Amiga's serial port before starting the true kernel code.
Kinda depressed about the bad shape of this part of the community I was about to stop this whole test.

But then I got one idea! I couldn't install the gcc compiler from Emdebian because the dependencies were unresolved. But not because the package was missing. It was a version mismatch between the gcc and the libgcc2. Well F*CK the dependecies I said myself and so I've force installed all needed packages and tried it again. I've compiled the kernel, installed it and then another try...... It worked......



I was proud as I've managed to get a 3.14.1 kernel running on my real Amiga. I've also selected a 3com driver and at this point I thought it was the right one. But ..... duuuh .... as I've loaded it the kernel said it couldn't find the card. I looked again in the kernel config and yes it was the wrong driver. It was for the 3c509 which is a character apart from my 3c589 and not a PCMCIA but instead an ISA card. :-(

I've filtered the kernel config for "5c589" and a driver was existing. I looked for dependencies and guess what.

Depends on: NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_3COM [=y] && PCMCIA [=n]

I couldn't select the driver as PCMCIA was not enabled...... not enabled I thought??
I remembered activating "Amiga 1200/600 PCMCIA support" and here is the deal. It was handled seperatly as AMIGA_PCMCIA. I thought that this might be some configuration problem inside the kernel as I don't assume that the Amiga port was tested very well. I looked inside linux-3.14.1/drivers/net/ethernet/3com/Kconfig and changed the dependency to "PCMCIA || AMIGA_PCMCIA" and tried it again. This time the compilation failed as a few functions were not available. Looking at the source code of the PCMCIA implementation I've discovered the reason. The PCMCIA subsystem for the Amiga is quite old (I'm not even wondering) and also has a different interface compared to the normal one.

At this point I've compared both subsystems but couldn't help it. I'm not experienced enough to solve this issue and the motivation was about to drift away. I will still try it though and write about it here.




3 comments:

  1. Hello,

    is there a way to acess the internet via RS232 and another computer?
    I know that this will work from one windows computer to another windows computer.
    Maybe you can connect an analog modem.

    Good luck!

    ReplyDelete
    Replies
    1. I'm very sure that this is possible. I just checked it on AmigaOS 3.1 using my 1200.
      With the TCP/IP stack Miami (one of the standard ip stacks for the Amiga) you have the option of using PPP over the serial port. One problem though is the limited baud rate.
      A real ethernet port is much faster and usable. You don't really want to surf the internet with an analog modem.
      I once bought a PCMCIA network card for FTP to get fast file transfer over the network. Surfing isn't really fun as the browsers are pretty old.

      Delete
    2. Ah yes. And I wouldn't even think about doing that on linux. I need fast access to the repositories to get software installed.

      Delete