Thursday, September 17, 2009

Editing files remotely

Do you find that you're unable to use your editor of choice in the Minix environment? It's possible to use your favorite text editor by editing your files inside a Minix machine remotely!

Minix 3 supports OpenSSH, so make sure you install it using packman. Once you have SSH up and running, you can use sshfs to mount your Minix files on your operating system of choice and edit your files as if they were local :-)

SSHFS is available for Mac, Linux and Windows. Once you install it, simply type:

$ sshfs username@minix-ip:/path/to/directory ./local/dir


Happy hacking with your favorite editor!

Thursday, March 5, 2009

Upgrading to Minix 3.1.4

If you want to run the latest and greatest Minix (also known as 'current', which is currently 3.1.4 with new features such as virtual memory) you need to have a working 3.1.3 installation either with networking enabled or some way to get the updated sources into your machine.

Excellent instructions on how to perform the upgrade are available here. The important difference from regular upgrades is that the /etc/drivers.conf is incompatible between 3.1.3 and 3.1.4.

Have fun!

Monday, March 2, 2009

Telnet and Terminal Type

If you telnet to a Minix3 machine, you may be prompted for a terminal type as follows:
Terminal type? (network):

For us, the vt100 terminal type works fine for most purposes.

For information on how to start your telnet or FTP server, look here.

Saturday, February 28, 2009

Executables in Minix3

The executables in Minix3 are of a.out format. Unfortunately, this a.out format is not same as that of Linux (which uses ELF). Hence, disassembly tools commonly used on Linux, like objdump will not work on Minix a.out executables. The special a.out format used in Minix is generated by Amsterdam Compiler Kit (ACK).

Tools like objdump have been ported to Minix3 and are part of the binutils package, but they do not understand Minix3's ACK executable format, as they are just port of Linux objdump code to Minix3.

If you need to disassemble the user-space programs, then the best way is to compile them using GCC (which has been ported to Minix3), and then use objdump. But if you need to disassemble kernel code, you are out of luck.

Currently I am looking for a tool which can be used to disassemble Minix3 executables. However, it seems like I would most probably have to write one. If you want more information on the executable format, you can refer to the /usr/src/include/a.out.h header file, which seems to be the only source of information. I came across a few old messages in mailing list archives, trying to explain a.out, which you can check out to see if they are useful.

I will post an update here if I find any way of disassembling Minix3's a.out or if I write my own tool for it.

Compiling huge programs?

Then you may often run into errors such as no space left on device. These types of errors are often misleading - if you're sure that you have sufficient hard disk space (Minix3 allocates a ridiculously small root partition, source of many problems) - then it is possible that you don't have sufficient RAM.

Because versions before Minix 3.2 don't support virtual memory, whole programs must fit into RAM else they won't run. Try increasing the RAM size (only possible if you're running Minix3 on a virtual machine). If that doesn't work, the problem may be the shell. Try executing configure or make with /bin/bigsh:

/bin/bigsh ./configure --foo-bar


And hope it works!

Friday, February 27, 2009

GNU software on Minix

If you've installed any GNU software on Minix3 using packman (such as binutils, diffutils, bash, et. al.), and then wondering where the binaries are located, they're in /usr/gnu/bin

I recommend adding /usr/gnu/bin to your path so you won't have to type the full path to use those executables. Executables such as GNU Make are prefixed with a 'g' (gmake), so it will not collide with the native Minix commands.

Thursday, February 26, 2009

Endeavour with Minix3 networking

If you want networking to work in Minix3, you have to do some homework before you start installing it. You need to know which network card you have. Minix3 currently supports a few network cards:

0. No Ethernet card (no networking)
1. Intel Pro/100
2. 3Com 501 or 3Com 509 based card
3. Realtek 8139 based card
4. Realtek 8029 based card (also emulated by Qemu)
5. NE2000, 3com 503 ro WD based card (also emulated by Bochs)
6. AMD LANCE (also emulated by VMWare)
7. Different Ethernet Card (no networking)

You can find out your network card type by using the lspci command in Linux. If your network card is not in list, then you have following options:

1. Add another network card.
2. Wait till support for your network card is added.
3. Don't use networking
4. Write a network driver for your network card ;-)

If you have a supported network card, then you can choose the proper option during the installation process, and then everything should work fine. You are lucky if you have a DHCP server running on your network, in which case, Minix3 should pickup an IP address automatically; reducing your work ;-)

Most of the work is done by dhcpd daemon which can work both as client and server. I personally do not not know much about how it exactly works, you can find out more at it's man page and here.

If you don't have DHCP available, then you need to setup a static network IP by using the ifconfig command, which is used to provide an IP address to the network interface.

There are two interfaces which are available /dev/ip and \dev\ip0. The ifconfig command is invoked usually as:
ifconfig -I /dev/ip -h 192.168.0.2 -n 255.255.255.0


I was confused as to which device I should specify, /dev/ip or /dev/ip0. But it seems that the ifconfig command is smart enough to find out which device to use automatically. So, you can get away by just giving the command:
ifconfig -h 192.168.0.2 -n 255.255.255.0

and Minix3 will choose best device.

I still don't know what /dev/ip represents and why there are two devices, this is just a temporary way around the confusion.

Other than this, another useful command is add_route and an example use of this command is:
add_route -g 192.168.0.1

which will set 192.168.0.1 as your default gateway.

Another useful command is pr_routes which displays the routing table.

For setting up DNS, you can edit the file /etc/resolve.conf. A typical resolv.conf should look something like:
nameserver 192.168.1.254


The best way to find out, whether you are in business or not is by pinging your gateway. So, cross your fingers and give the command:
ping 192.168.0.1

and Hope that Minix will say:
192.168.0.1 is alive