9. Tips, hints and gotchas

Contents of this section

There are a couple of things you just cannot know about if you are installing Linux/m68k for the first time. This section tries to explain these points as far as we have experienced them ourselves.

9.1 Read the ANNOUNCE* files

The first and most important item is to read all ANNOUNCE* files.

They contain changes to the kernel over the time, and also explain all the options to bootstrap in detail. Do not expect to find all these options documented in the file you are just reading. The ANNOUNCE* files are located on tsx.mit.edu directly under /pub/linux/680x0/. However, you need to copy them to a Linux partition first and unpack some of them (*.gz) with gzip -d name (or, if you have installed it, use zmore).

Also, THE FAQ IS YOUR FRIEND. Read it thoroughly as well. Also, read it again then and now when new versions come out. It's undergoing changes and additions every couple of weeks.

9.2 Missing /dev entries

The directory /dev that comes with the filesys/root.tar.gz file is missing a couple of entries you might need very soon. In particular these are:

tty2, tty3... tty8

- required for virtual consoles

Create these with


cd /dev; ./MAKEDEV tty2; ./MAKEDEV tty3;   
etc.

mouse

- needed for selection (cut & paste, see Installation of the Selection package below)

and X11. See Putting X11 files into place for instructions.

scd0

- the entry for a SCSI CD-ROM

Watch out here; the original /dev/MAKEDEV script has an error at this point, it tries to generate a character special file although a block special file is required. Either fix the script, or create the entry yourself:


  mknod /dev/scd0 b 11 0
 

sda?, sdb?, ...

- the entries for SCSI harddisk partitions.

If you happen to have harddisks with more than 8 partitions, you will have to add additional entries for them. This is done with ./MAKEDEV sd??, where the first ? is to be replaced with the SCSI ID (first disk on the bus: 'a', second: 'b' and so on), and the second ? stands for the partition number: 1 = first partition, 2 = second partition and so on. Please note that a node without partition letter (as in sda) stands for the ENTIRE harddisk, which can be dangerous. Be careful here.

hda?, hdb?, ...

- analogous to the previous item for IDE harddisks. We need a bit more information here about IDE harddisk handling - you cannot talk about 'SCSI IDs' here, can you ?

9.3 Missing directories/files under /var

When you have started the kernel with a root filesystem from harddisk for the first time, you might have seen a couple of messages about not existing files or directories. This is mostly related to /var. Here are a couple of commands you might want to issue to get rid of these messages:


cd /var
mkdir adm
mkdir adm/messages
cd adm/messages
touch authlog daemon lpd-errs maillog news sysdebug syslog
cd ..
touch maillog secure spooler utmp wtmp
cd ..
mkdir spool
cd spool
mkdir cron
chmod 700 cron
mkdir locks
mkdir uucp
cd cron
mkdir crontabs
cd ../../..
mkdir tmp
chmod 1777 tmp

The last line causes the t bit to be set on the /var/tmp directory. This has the effect that only the owner of a file in /var/tmp can remove (except for root, of course). As this makes your system safer, you should also apply this change to the /tmp directory (which is, by the way, not world-writeable when unpacked from the root filesystem, so do:


chmod 1777 /tmp

9.4 Virtual consoles.

They are something very useful. You might run into a situation where a program hangs and cannot be killed with Ctrl-C. What can you do ? Usually you would either reboot the machine or use a terminal (if you have one) hooked onto the serial port to kill the process. This is, however, much easier if you can just switch to another console and remove the offending process from there. By default, Linux kernels always have everything compiled in to get you started with VCs (short form for virtual consoles), but you also need to set up a few things yourself.

First, you need to have the entries in /dev. These are named tty1, tty2.. up to tty8 (by default, the kernel is compiled with support for 8 virtual consoles, but you can always recompile the kernel with a higher number of VCs). The before last section explained how to create these entries in /dev. For a start, it should suffice to create nodes for tty1...tty8.

Now you can already switch between these consoles with the left Alt key + a function key, like in LeftAlt F2. That is: Press and hold LeftAlt, and press F1...F8 to switch to console 1...8. By default, however, only console 1 has a getty program running in it so you can login. The other VCs will initially only show you an empty screen with a cursor in the upper left corner. Also, VCs that have not been accessed at all can even not be switched to (slightly contradicting to what I said above). Access a VC once to make it "visible":


echo "Hello world on tty4" >/dev/tty4

Press LeftAlt and F4, and you should see the text at the top line.

The next step would be to activate getty programs on more than the first console. A getty program is responsible for greeting the users on a terminal, print out the Login: prompt and wait for the user to log in.

The file that controls on which consoles/terminals you can log in is /etc/inittab. This file may look different, depending on the type of init program you are using, but we'll explain it for the default setup, where the simpleinit is used. This is a very small example for an inittab file:


# inittab for linux, poeigl 1.6
# Format:
# ttyline:termcap-entry:getty-command
tty1:con80x50:/sbin/getty 9600 tty1

The third line tells you how an entry in this file is put together. The fourth line describes the behaviour on console #1, the one you used for logging in. To enable a getty for another console, just copy that line and modify it slightly, e.g.:


tty2:con80x50:/sbin/getty 9600 tty2

Don't be misleaded by the baud rate; for console gettys, it is not used.

If you like to, you can enable gettys on all 8 consoles, but that will probably not make too much sense. We think 4 gettys is a good number.

After you have added the new entries, save the file and leave the editor. To immediately see the new getty start up, you have to tell the controlling program to re-read the /etc/inittab file. This is done by sending it a hangup signal, SIGHUP. The process id of init is always 1, so


kill -SIGHUP 1

will cause init to re-read the inittab and start new gettys as desired. (Note: If you should some day change to the SysV-init program, re-reading the inittab is done by using telinit q). If you now switch to another console, you should see a Login: prompt there. If something went wrong, you will see a message on the console telling you that a getty could not be started for some reason. This might be a typo in the inittab, missing /dev/tty? entries, or alike. Check these items again.

9.5 Installation of the Selection (Cut & Paste for console) package

This is a nice feature in Linux. If you know X11, you know (and probably love) the feature that you can cut a portion of text out of almost any application (the most important ones being xterm and xclipboard) and paste it into another application's window. This is possible on virtual consoles under Linux, too. This feature is split into two parts: An enhancement to the kernel to understand two more ioctl() calls for ttys, and a process running in the background. Both rely on a mouse driver, which is already present in the current kernel. The aforementioned ioctl() calls are also already in the kernel.

To install this feature, you will either need to get the util-linux package and compile the selection program yourself, or get a pre-compiled binary (there is one at tsx.mit.edu ). To install the binary package, just unpack the archive while being in the root directory; the archive has been put together with correct paths so that the files just 'drop into the right place':


cd /
tar xzvf <path_to_selection_package>

After this, you just have to tell the system that you want the selection daemon to be started automatically when you boot into Linux. This is done by adding something like the following to your /etc/rc or /etc/rc.local :


# Enable the selection (cut & paste for VCs) stuff
/sbin/selection -t bm
echo "Cut & Paste enabled."

The -t bm switch tells selection to use a busmouse type mouse driver. This is a relict from PC Linux, but that doesn't matter. The behaviour of the Amiga mouse driver from the programmer's view corresponds to that of the busmouse driver under PC Linux. It is not necessary to start the daemon in the background - it automatically forks itself off. To test it out right now, just (as root) type in the above line at the shell prompt:


/sbin/selection -t bm

You should now see a white cursor appear in the center of the console. You can move it around with the mouse to mark the starting position of the text you want to snap. To drag out an area, click and hold the left mouse button and move the cursor to the end of the desired area. All characters affected by the cut operation are inverted. When you release the left mouse button, the area is marked and copied into a kernel buffer. To paste it out, use the right mouse button. You can certainly paste into any console you want - VCs and iselection work together like a charm.

The left/right mouse button behaviour for cut/paste is the default; but you can easily change it. Also, there are ways to easily snap words or entire lines. Read the manual page!

9.6 Shutting down the system

As you might already know, a Unix system cannot just be powered off when you are done with your work like you might be used to from AmigaOS.

Under Unix, you can never easily tell what data that should be on the harddisk after a write operation has actually been written physically. Linux has dynamic caches for read and write operations. Usually, there is a process in the background (called update) that flushes all write buffers to the harddisk that have not yet been written. update is started from your startup script, usually /etc/rc or /etc/rc.local. By default, update performs its task of synchronizing the contents of disks with the write buffers every 30 seconds. You can, however, also trigger this manually by using the sync command.

So, you have to make sure the sync'ing has been done before you can power off your machine. There are programs that assist you in this task, like shutdown or halt.

So, power-down can be done by typing:


shutdown now

The keyword now tells shutdown to immediately start closing down the system. There are different flavors of shutdown around, each having its own syntax. Some require you to enter a time when shutdown is to begin (e.g.: in two minutes), others will default to 2 minutes if no options were used on the command line. You will have to check the shutdown manual for your system to find out how it works.

When shutdown begins its work, it first sends a warning message to all users currently logged in telling them the system is about to go down. After the shutdown delay has passed (which would be 0 seconds in the above example), shutdown sends all processes the signal to quit themselves. If they do so, fine. If not, shutdown will send them the KILL signal which forces them to terminate. Next, all filesystems are unmounted (along with an implicit call to sync to synchronize their contents with the write caches) and swapping is disabled. After that, the behaviour might be different: The system may reboot automatically, or it may just tell you that you can turn the power off then.

This is all nice and good, but you'll probably want a faster and simpler way to reboot your system than having to type the above command. This can be done. Even on the Amiga, the PC-typical Control-Alt-Del key combination was implemented, although only in software. This key combination (Control key, left 'Alt' key and 'Del' key on the keypad(!)) can be used to either immediately reboot your Amiga (which is not at all good for Linux, as we just explained) or execute the shutdown command automatically.

First, you have to tell the kernel that you want the CtrlAltDel key combination to trigger a soft reboot, as opposed to a hard reboot. This is done with a program of the same name, ctrlaltdel. If you do not already have a binary of that program, you will have to get the sources or a binary package from somewhere; they are in an archive named util-linux-x.y.tar.gz, where x and y are its version number (when writing this, it was 2.5).

Once you have found and installed the binary, you have to add the above mentioned ctrlaltdel command to your /etc/rc file. A line like


ctrlaltdel soft

tells the kernel to perform a soft reset when receiving the CtrlAltDel key combination. A soft reset means that the process with ID 1 (init) receives a SIGINT (interrupt) signal. init will then perform whatever action it was asked to; the simpleinit that comes with the root.tar.gz filesystem will do a quick shutdown, killing processes and unmounting file systems as above. If you decide to use another init (like SysV-init), you can configure what exactly should be done through /etc/inittab (this file is different from the inittab used by simpleinit!). E.g., in my inittab it says:


# Special actions for powerfail and CTRL-ALT-DEL
ca::ctrlaltdel:/sbin/shutdown -t1 -rf now

which is exactly what I want to happen when I hit Ctrl-Alt-Del.

Describing the installation of SysV-init and its configuration files would go beyond the scope of this installation guide; get the sources for it and read the compilation and installation instructions in the archive.

9.7 Expansion boards and interrupts

A serious problem when starting Linux are hardware expansions (graphic boards, networking cards etc.) that produce interrupts. Usually such hardware is initialized under AmigaOS when its driver is loaded and started. This driver is also responsible for servicing the interrupts from the boards. When the Linux kernel is started, AmigaOS multitasking is disabled, but the board(s) still continue(s) to produce interrupts. Someone has to service these interrupts, but there is noone who could do this, so the computer hangs.

The solution is to either not load the device driver for specific boards or to reset the boards to a defined state where they do not produce interrupts. Newer versions of the amiboot bootstrapping program have this ability for a few boards; namely the Rainbow 3, Piccolo and SD64 graphic boards from Ingenieurbüro Helfrich, Germany. This is of course only a fraction of the hardware that might actually cause problems - there are most probably other boards like Arcnet or Ethernet boards which still produce this problem. I guess anyone who knows how to reset a certain board should provide patches to the Amiga coordinator of Linux/m68k, Geert Uytterhoeven.

A better solution would probably be to use Amiga-Lilo for loading Linux; Amiga-Lilo is started directly from a bootblock so that no expansion devices should be initialized by then. Amiga-Lilo is available from e.g. tsx.mit.edu as amiga-lilo*.

9.8 Transferring files between AmigaOS and Linux

AmigaOS -> Linux

You have probably already used this when you installed the root and /usr filesystems. You just have to mount the AmigaOS filesystem into Linux that you want to access with a command like


mount -t affs /dev/xdyz <mountpoint>

where

<mount_point> is the directory under which you want to mount the filesystem. Suggested places for mounting foreign filesystems under Linux are /mnt, /mount or alike. If mounting fails, you should (among others) make sure that the corresponding entries in /dev/ are actually present. If not, you will have to create them with the mknod command. Also, be aware that currently only Fast Filesystem partitions with a blocksize of 512 bytes can be mounted into Linux.

After having mounted an AmigaOS partition like this, you can directly access its files just as you would access files on Linux partitions. There might arise some problems with permissions of directories or files, however; sometimes AmigaOS protection bits seem to be translated into Linux permission bits incorrectly. This may have the effect that only root can access these files. As AmigaOS partitions can currently only be mounted read-only, there is no way of changing the bits from Linux. However, there has already been a patch by Joerg Dorchain to fix this; this patch was part of the last kernel of the 0.9 series, 0.9pl13. It is, however, not yet part of the 1.2 kernel series; Joerg is just working on write code for the affs.

To unmount a mounted Amiga partition, just type


umount <mount_point>

Mounting an AmigaOS floppy disk is done similar. However, as the Linux kernel cannot inquire the floppy drive to tell it how much sectors it has (or, to be precise: where its rootblock is located), you have to specify an extra parameter to mount:


mount -t affs /dev/fd0 <mount_point> -o size=1760

This tells mount that the disk in drive fd0 (this is DF0: under AmigaOS) has a size of 1760 blocks (880 KBytes), which is the standard size for AmigaOS-formatted DD disks. Further disk drives are accessed by increasing the device number accordingly (assuming there is a corresponding node in /dev), like /dev/fd2 for what is known as DF2: under AmigaOS.

Linux -> AmigaOS

One way is to use disks to transfer files. You have to pre-format them under AmigaOS and can then write files to them using tar:


tar cvf /dev/fd0 <file_pattern>

would 'tar' together all files matching file_pattern to the disk in DF0:.

Reading these files under AmigaOS happens in a similar manner, but you will have to install the flat-handler to be able to read raw data from a disk. After that, type


mount flat:

and you can read back files with a command like


tar xvf flat:df0

Another way which currently seems to be the best is to use a partition with an MS-DOS filesystem. This requires that you have at least AmigaOS 2.1.

MS-DOS filesystem read & write code exists for both sides - under AmigaOS this is done via the L:CrossDOSFileSystem and under Linux you can compile kernels with MS-DOS filesystem code. To find out if your current kernel has MS-DOS filesystem code compiled in, do this:


cat /proc/filesystems

This requires that you have mounted the /proc filesystem (which should have been done automatically at boot-time). If the list of displayed filesystems contains msdos, you are ready to go. If msdos is missing from the output of the above command, you will have to recompile your own kernel. Generic Linux documentation will tell you how to do that.

If it says


cat: /proc/filesystems: No such file or directory

then you have not mounted the /proc filesystem.

Now, create a Mountlist entry for your exchange partition. Here is what mine looks like:

/*
 * MS-DOG partition for transfers to Linux - mounted under /temp
 */

MS:
    Device = scsi.device
    FileSystem = L:CrossDOSFileSystem
/* CHANGE THIS! */
    Unit = 2
    Flags = 0
/* CHANGE THIS! */
    Surfaces = 1
/* CHANGE THIS! */
    BlocksPerTrack = 1435
    Reserved = 2
    Interleave = 0
/* CHANGE THESE! THEY ARE NOT CORRECT FOR YOUR SYSTEM! I BET! */
    LowCyl = 1447
    HighCyl = 1452
    Buffers = 30
/*  Priority = 5    */
    GlobVec = -1
    BufMemType = 0
    Mask = 0x7fFFFFFE
    MaxTransfer = 0xFFFFFF
    Mount = 1
/*  DosType = 0x4d4e5800 */
    StackSize = 4000

The numbers for Unit, Surfaces, BlockPerTrack, LowCyl and HighCyl are most definitely not the same for your configuration - so don't just paste these lines into your Mountlist, but also modify them! Also, your Device= line might look different - e.g. Device = gvpscsi.device.

Furthermore you might want to give this logical device a different name than MS:. Change the first line to do that.

Next, simply mount this partition; in my case:


mount ms:

and format the partition by typing in


format ms: name <somename> noicons

That should be all you need. You can now copy files to MS: and read them from there under AmigaOS, and under Linux you can mount it with a command like


mount -t msdos /dev/<devicename> <mountpoint>

The only disadvantage is - quite obviously - that you are limited to the capabilities of MS-DOS filesystems: 8 + 3 filenames, no extra "." in filenames (like in hello.c.bak, which is illegal). Apart from that, this is a quite convenient way to exchange files between the two operating systems until we have the ability to directly access affs partitions from Linux (writing to them, that is).

9.9 Problem with agetty on serial port

Several people have reported problems when trying to use the original /sbin/agetty program to log in on a terminal hooked up to the serial port. The effect was usually that characters typed on the terminal were echoed back, but there was no Login: prompt or anything. A precompiled binary that seems to work ok can be found at ftp.informatik.uni-oldenburg.de If you want to use it, gunzip/unpack it from / and give it the correct permissions (chmod 755 agetty).

9.10 German keymap

The keymap that comes with Linux/m68k is for american keyboards, where a lot of characters are at different places than a german user would expect. A german keymap can be found at ftp.informatik.uni-oldenburg.de . Suggested usage is to copy this to e.g. /root/lib and load it from /etc/rc.local with the following command:


# load german keymap
loadkeys /root/lib/german_keys

If you try this out, you may still find that you cannot type e.g. the ö (o umlaut) and ä (a-umlaut) keys (generally anything with an ASCII value > 127). This may have several reasons:

After these changes, the german keymap should work just as you are used to it from AmigaOS. For further hints, read the keymap file itself, it's a plain text file.

9.11 NFS mounting

The current kernel comes complete with NFS capabilities. However, the mount command included in the root.tar.gz filesystem is unable to mount NFS filesystems. On ftp.informatik.uni-oldenburg.de you'll find (among others) a mount command that can do that.

9.12 Shorter boot times from AmigaOS into Linux

You might feel that it takes too long to start the whole system under AmigaOS just to boot up Linux. A much quicker way is to check for some condition early in the S:startup-sequence and go right away into Linux if that condition is met. I use the left mouse button for this. Ingo wrote a minimal program that just checks the status of the left mouse button and sets a WARN returncode if it is pressed.

This is the beginning of my S:startup-sequence:


c:checkleftmouse
if warn
    c:startlinux
    quit
endif

You can find all required files for this (binary, sources, example start file) on ftp.informatik.uni-oldenburg.de . You must configure the startlinux script for your system, however.

NOTE: The checkleftmouse program is a REALLY UGLY hack that just checks the hardware register directly. You should not use it for anything else but starting Linux.

This section is already a little obsolete now that we have an Amiga-Lilo - although probably not everyone wants to mess around with their RDB. Section What are the differences to Linux on Intel machines ? lists where you can find Amiga-LiLo.

9.13 Using "slow" RAM on A2000s with 2630 and RAM expansion

The problem:

On an A2000 with both 32bit-RAM and 16bit-RAM, the 16bit-RAM usually is at the top of the memory pool. Linux allocates memory from the top down, so it uses the 16bit-RAM first! This really slows dows the system. The obvious solution is to use the -m switch of the bootstrap program to tell Linux not to use the 16bit-RAM (see ANNOUNCE-0.9pl3). But now there's an unused block of memory in the system... slow memory, but still faster than virtual memory, for example.

The solution:

A device driver that accesses the unused 16bit-RAM as a block (!) device. This enables you to use the 16bit-RAM as either a real RAM disk, or as swapspace. Yes, that's right, swap into 16bit-RAM! :-) (This even has an advantage over using the 16bit-RAM as real memory, because now only currently unused memory regions are placed in 16bit-RAM, and all active regions are in 32bit-RAM.)

Installing the driver:

You can find the package that contains the source, diffs etc. on ftp.informatik.uni-oldenburg.de . Please note that you will have to learn how to use the -m option of bootstrap. Information about this switch can be found in ANNOUNCE-0.9pl3.gz on tsx.mit.edu.

Copy z2ram.c into <linux-sourcetree>/drivers/block/, then "cd" into this directory and apply the patch:


patch -p0 < z2ram.patch

The driver was developed for v0.9 type kernels; to use it with v1.2 kernels, you have to change line 46 in z2ram.c from


    addr = (char *)((device * 0x100000) + (CURRENT->sector << 9));

to
    addr = (char *)((device * 0x100000) + (CURRENT->sector << 9) +0x80000000);

Finally, rebuild the kernel and reboot with the new kernel.

Using the device:

The major device number is 22, the minor depends on the starting address of your 16bit-RAM. If it starts at 0x200000, the minor is 2, if it starts at 0x400000 the minor is 4 and so on. Create a device node with the appropriate minor number. On my system, I have 4MB 16bit-RAM at 0x600000, so the minor I use is 6:


mknod /dev/z2ram b 22 6

Now you can treat the 16bit-RAM like any other disk. For example, you can put a filesystem on it. Just take care that you use the correct number of blocks (depending on the size of you 16bit-RAM). On my system:


mkfs.ext2 /dev/z2ram 4096         (4 MB)

But using the RAM as a RAM-disk is rather boring. What's more interesting is to use it as swapspace. On my system:


mkswap /dev/z2ram 4096
swapon /dev/z2ram

WARNING: The driver does not do any checking if the memory is really there. You must use the correct minor device number for your system and give the correct size of the RAM block (in KB) for the mkfs or mkswap commands, or the system will crash.

Of course, it is possible to split the 16bit-block into two or more parts, and use one as a RAM-disk and the other as swapspace, for example. Just create a second device node and use the appropriate sizes. For example, if I wanted to use 2MB as a RAM-disk and the other 2MB as swapspace, I would simply do:


mknod /dev/z2disk 22 6      # first block at 0x600000
mknod /dev/z2swap 22 8      # second block at 0x800000
mkfs.ext2 /dev/z2disk 2048  # filesystem for RAM-disk, 2MB
mkswap /dev/z2swap 2048     # 2MB swapspace
swapon /dev/z2swap          # enable swapping


Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter