ttylinux User Guide
Version 9.2 - i486
Version 11.0 - i686, x86_64

Maintained by Douglas Jerome

Based on Previous Work by Pascal Schmidt


Contents

1 Introduction

ttylinux is a small, minimal Linux distribution. It is freely available as a bootable CD-ROM image. The entire source distribution that builds the bootable CD-ROM image is also freely available.

This document provides information about using and installing ttylinux. The audience of this document should be comfortable with using the Bash command line.

The word ttylinux has no capital letters, ever. "TTYlinux", "TTY-Linux", "TtyLinux", "Ttylinux" and all other usages of a capital letter or extra symbol are wrong. When spoken, ttylinux sounds like "t - t - y - linux".

Using the ttylinux source distribution and building ttylinux are beyond the scope of this document. The source distribution has a short text file describing how to build ttylinux. When available, the Developer Guide describes building ttylinux.

1.1 ttylinux Overview

ttylinux tries to use as little space as possible and be a familiar and complete command-line Linux system, with fairly up-to-date Linux kernel and program utilities. It provides multi-tasking, multi-user Linux with networking capabilities in no more than 8 MB of disk space. It is prepared for Internet access by Ethernet. A text-based web browser, command-line remote login secure client and server, NFS client and an FTP server are a part of ttylinux.

ttylinux can be installed onto a disk drive, both spinning hard drive or flash drive such as a USB memory stick; it can be manually installed or installed by using an installer script. Installation by installer script or manual installation can be done with ttylinux itself or by using a different Linux system.

The ttylinux file system, excluding the Linux kernel, is 8 MB in size. Using the ttylinux installer script, a Linux kernel between 2.5 and 3.5 MB will also be installed. This makes a minimum workable size of about 12 MB for a hard drive partition on which to install ttylinux, although 32 MB of RAM are needed to use the automated ttylinux installer script.

ttylinux includes a package management script capable of installing, removing and querying software packages and their files. The package manager can list and install packages from an external repository via http. Pacman is useful for adapting ttylinux to specific needs.

What ttylinux Is Not

ttylinux is not a typical Linux distribution; it does not have a graphical user interface, software development tools, music player, document preparation nor printing tools, databases nor network services such as BIND, News Server nor Mail Transfer Agents.

What ttylinux Can Do

ttylinux is intended to be useful as the basis of an embedded system or a directed-purpose system: with its small size ttylinux boots quickly from flash drives and CR-ROM; it has been used as a system fix/repair tool, as a simulation host, and is a good basis for a rescue or installation CD-ROM.

ttylinux provides a working Linux environment with its boot image, and custom task-specific scripts can mount other parts of the file system to provide a larger system.

ttylinux is useful on computers which are considered obsolete, such as 486SX PC. It is for people who want to have a minimal Linux distribution to run when little space is available or needed. Some users may want to use the ttylinux file system but configure and build their own Linux kernel.

ttylinux can serve as a rough prototype of a larger system, since it uses the same C library, glibc, as full Linux systems, compiling programs on a different Linux computer and copying them to the ttylinux file system can result in working programs. However this is not a supported feature. Programs compiled outside the normal ttylinux build process may require libraries not present in ttylinux. Worse, they may be compiled on a computer with different Linux kernel capabilities and make system calls not present in ttylinux.

ttylinux is for people who have Linux experience; it is not for beginners, unless you want to learn how a Linux system works underneath the Graphical User Interfaces. You must be able to use the interactive shell command-line, and it helps to know your way around Linux system. Most of the programs are smaller versions of the common Unix utilities.

1.2 Licenses

The software packages that are part of ttylinux are licensed under a number of different open source licenses, as listed below. The initialization and system service scripts developed by the ttylinux project are licensed under the GNU General Public License; a copy of this license is included in the file COPYING.

Package Version License
bash 3.2.48 GPL
busybox 1.14.3 GPL
dropbear 0.52 MIT
e2fsprogs 1.41.8 GPL
glibc 2.9 LGPL
iptables 1.4.4 GPL
lilo 22.8 BSD
ncurses 5.6 MIT
ppp 2.4.5 GPL
retawq 0.2.6c GPL

For more information on the licenses, please visit the opensource.org website.

2 Starting with ttylinux

This section has a general overview of the ttylinux download CD-ROM image and also describes the system hardware requirements for using ttylinux, from where to download ttylinux, what to download and how to use the downloaded images.

ttylinux has three basic parts: a boot loader, a Linux kernel, and a root file system. All three of these are in the CD-ROM image; the CD-ROM image can be burned onto a blank CD-ROM disc and then booted. When booted, the root file system from the CD-ROM is decompressed and becomes a read/write root file system in a RAM disk in memory. Note that changes to any of the files while running ttylinux are lost, as they are in a RAM disk. Booting the ttylinux CD-ROM is further described in section 2.3.

Installing ttylinux from the bootable CD-ROM onto a hard drive is described in section 3.4. Installation onto a hard drive makes a system different from the bootable CD-ROM; the installed ttylinux has a read/write root file system directly on a spinning hard disk or solid state disk, not in a RAM disk. The advantage of a hard drive ttylinux system over the RAM disk system is that file changes are not lost.

ttylinux can be put onto a flash drive, such as a USB drive, which can be made bootable. This copies the RAM disk boot method to the flash drive; when the flash drive is booted, the root file system from the flash drive is decompressed and becomes a read/write root file system in a RAM disk in memory. As with the system booted from CD-ROM, the changes to files are lost when the system shuts down. The process of putting ttylinux onto a flash drive is described in more detail in section 3.3.

The ttylinux root file system is a compressed image file on the CD-ROM; it can be copied and used with a different custom kernel, one that you make, and put onto other media with your boot loader of choice. This process is beyond the scope of this document, but the requirements for a ttylinux custom kernel are described in more detail in section 2.1.1.

2.1 System Requirements

ttylinux is intended eventually to run on several different CPU and system architectures; however, currently only these PC compatible architectures are directly supported:
ttylinux 9.2 - i486, specifically the i486 instruction set
ttylinux 11.0 - i686, Pentium Pro instruction set
ttylinux 11.0 - x86_64

CPUs and Computers

i486 ttylinux 9.2 requires an i486SX or newer processor in a PC compatible computer. It will not work with the i386 CPU; the glibc version in ttylinux uses CPU instructions the i386 CPU does not have. Any x86 compatible CPU supporting i486, and upward compatible, that is in a PC compatible computer should work.

i686 ttylinux 11.0 requires Pentium Pro or newer processor in a PC compatible computer. Any x86 compatible CPU supporting Pentium Pro, and upward compatible, that is in a PC compatible computer should work.

x86_64 ttylinux 11.0 supports generic 64-bit x86 processor in a PC compatible computer.

Memory

ttylinux uses an 8 MB RAM disk when booted from CD-ROM. The kernel on the CD-ROM is fairly large; it supports a broad range of hardware, so at least 24 MB of memory are required for full operation with i486 ttylinux 9.2, and at least 32 MB of memory are required for full operation with i686 or x86_64 ttylinux 11.0.

Using a custom kernel supporting only hardware for a particular computer, an i486 ttylinux system may require as little as 16 MB of memory to run. If the file system is installed onto a read/write disk drive, spinning or flash, and a custom kernel is used, an i486 ttylinux will run within 8 MB of RAM.


2.1.1 Custom Kernel Requirements

The ttylinux root file system is an 8 MB ext2 file system; the file system image is compressed and resides in the CD-ROM image. After burning the CD-ROM image to a blank CD-ROM disc, or mounting the CD-ROM image via loop device, you can find the compressed root file system; it is boot/filesys.gz. This root file system can be used with a different custom kernel.

ttylinux 9.2 is built with Linux 2.6.20 header files, and ttylinux 11.0 is built with Linux 2.6.30.5 header files. Linux kernels are not backwards-compatible; software using the capabilities of a given kernel version cannot be expected to work with any previous kernel version. Using a kernel older than the one that ttylinux was built with cannot be supported in any way. With that described, with the small number of packages in the ttylinux system, ttylinux works to some extent with any Linux kernel from 2.6.0 upwards.

Your custom kernel needs to support all the hardware you want to use, plus some additional requirements for ttylinux itself.

A kernel used for running ttylinux needs to have ramdisk support, initial ramdisk support, and a default ramdisk size of at least 8192. Note the kernel configuration has a default ramdisk size of 4096, which is not big enough.

If you want to use the basic firewall script of ttylinux, your kernel also needs iptables support with the netlink interface.

A ttylinux kernel needs to support ext2 file systems.

If you want to add a telnet server to ttylinux, your kernel will need to have Unix98 pseudo terminal support and support for the devpts file system.

2.2 File Downloads

The main ttylinux web site is accessed at http://ttylinux.org/. The web site is hosted at /, which is very much appreciated.

The ttylinux web site has a Download page that has several files available for downloading.

Bootable CD-ROM Images

There should be several ttylinux bootable CD-ROM ISO images available, at least one each for i486 PC and x86_64 PC. The CD-ROM ISO images are each an El Torito bootable CD-ROM ISO 9660 file system with the Joliet and Rock Ridge extensions. El Torito enables CD-ROM to be bootable on PC. The Joliet and Rock Ridge extensions adds longer file names to the ISO 9660 file system capabilities.

Source Distribution

The ttylinux source distribution, which includes the source code packages, is available; it has a file How_To_Build_ttylinux.txt that describes the build process. When available at the ttylinux web site, the Developer Guide more fully describes building ttylinux.

Binary Run-time Packages

The packages that make up the entire latest i486 ttylinux CD-ROM run-time are available. The x86_64 packages also should be available. Packages for other CPU architectures may be available. These packages are available in the case any were removed from a ttylinux system and there is a desire or need to reinstall the removed packages. Packages are installed with pacman, the ttylinux package manager. Pacman is described in more detail in section 5.9 of this document.

Previous Versions

At least one previous ttylinux version should be available.


2.3 Booting a CD-ROM Image

The 9.2 and 11.0 versions of ttylinux are intended to boot on an appropriate 32-bit x86 or 64-bit x86_64 PC that can boot from a CD-ROM drive.

Download the CD-ROM ISO image file and burn it onto a blank CD-ROM disc as an ISO image. Then put the disc into the CD-ROM drive of an appropriate PC and boot the PC; ttylinux should boot up automatically.

A computer's BIOS setup may not be set up to allow booting from CD-ROM; in that case you need to go into the BIOS setup screen(s) and make changes that allow the computer to boot from CD-ROM. If the computer has an old BIOS that is not able to boot from a CD-ROM device, there is software called Smart Boot Manager that may help. It can currently be found at: http://btmgr.sourceforge.net/about.html

Once ttylinux has booted, and you see the login prompt, login as user name "root", the administrator account, password "password".

The CD-ROM can be used as a rescue system or simply for trying ttylinux. For installing or transferring ttylinux from the CD-ROM, or from the downloaded CD-ROM image file, to another disk device see section 3. See section 5 of this user guide for pointers about what you can do with a ttylinux system.

2.4 Setting Up a USB or Flash Drive

ttylinux can be put onto a USB drive, also known as flash drive, USB memory stick, pen drive, travel drive, etc. This also applies to flash drives that are not on USB. For these you probably want to boot a RAM disk system from your USB or flash drive. See section 3.3, but you should also read the preceeding parts of section 3.

2.5 Installation Guide

Section 3 of this user guide describes the various types and methods of ttylinux installations.


3 Using the CD-ROM Image, aka Installation Guide

This section of the user guide describes the two types of ttylinux bootable installations and the methods for creating them from either the downloaded CD-ROM image file or a CD-ROM with the image burned onto it.

3.1 CD-ROM Image Overview

The ttylinux CD-ROM image is the source used for installation; it is a CD-ROM ISO 9660 file system with the following directory structure:

|-- AUTHORS
|-- COPYING
|-- LABEL
|-- boot/
|   |-- filesys.gz
|   |-- isolinux/
|   |   |-- boot.msg
|   |   |-- help.msg
|   |   |-- isolinux.cfg
|   |   `-- isolinux.bin
|   `-- vmlinuz
|-- config/
|   |-- kernel-<linux verison>-<CPU architecture>.cfg
|   |-- packages-<ttylinux version>.txt
|   |-- syslinux
|   `-- ttylinux-setup
`-- doc/
    |-- ChangeLog
    |-- Flash_Disk_Howto.txt
    |-- User_Guide.pdf
    `-- User_Guide.tex

Several files are critical for installation, note their location in the CD-ROM image:
CD-ROM/boot/filesys.gz - ttylinux gzipped file system image
CD-ROM/boot/vmlinuz - gzipped ttylinux Linux kernel
CD-ROM/config/ttylinux-setup - user-maintained RAM disk startup

ttylinux installation scripts automate the process of installing ttylinux; the scripts also copy the other documentation and information files to the new installed system.

For manual installation you can mount the CD-ROM or mount the CD-ROM image file via loop device for access to the critical files. The manual processes of installing ttylinux describes this in more detail.

3.2 RAM Disk or Persistent Storage Boot

There are two basic types of ttylinux installation, resulting in two type of booted systems: a RAM disk or persistent storage.

A Ram Disk installation results in a system that puts the root file system into RAM when it boots, which is what the bootable CD-ROM does. If you want to put ttylinux onto a flash drive, pen drive, USB memory stick, travel drive, etc. then you very probably want this sort of installation. This is typical for flash drives, but not for spinning hard disks, for at least two reasons: 1) flash drives have been much slower than hard drives, so maintaining a live file system on a flash drive has been intolerably slow, and 2) these are removable drive which have been difficult to consistently mount as they move between interfaces and computers. With this booting scheme, the boot loader takes the root file system from the drive and gives it to the kernel which decompresses it and mounts it as a read/write root file system in a RAM disk in memory. Changes to files in the root file system are lost when the system shuts down; persistent changes must be stored elsewhere. However, ttylinux has specific support for persistent changes to its boot-time startup with a RAM disk system, this is described section 3.3.5. The program /sbin/ttylinux-flash can be used to copy ttylinux from the CD-ROM to another drive and configure it to boot in this manner. The processes of putting ttylinux onto a drive for booting a RAM disk system and configuring its boot-time startup support is described in more detail in the next section 3.3.

A Persistent Storage installation results in a system that boots with the read/write root file system maintained directly on the spinning hard disk or solid state drive. If you have a spinning hard disk or one of the new fast solid state drives, and its bus interface is not removable, then you probably want this sort of installation. If you want to install onto removable media and will move the media to different slots or computers, then you do not want this kind of installation. The program /sbin/ttylinux-installer can be used to install ttylinux from the CD-ROM onto a spinning hard disk or solid state drive and configure it to boot in this manner. The processes of installing ttylinux onto a hard drive and booting a persistent storage root file system is described in more detail in section 3.4.


3.3 Transfer from CD-ROM - RAM Disk Boot

The section describes transferring a few files from the CD-ROM image to a drive, probably a flash drive, and configuring it to boot ttylinux into a RAM disk, as does the CD-ROM.

A Linux system, either ttylinux or some other Linux system, can be used to make a ttylinux bootable flash drive.

If you use the ttylinux script, /sbin/ttylinux-flash, to transfer ttylinux from CD-ROM to flash drive, then after using the script to make a ttylinux bootable flash drive, the flash drive with the new ttylinux copy can then be used in place of a CD-ROM as the source for another ttylinux transfer, but only if you again use the ttylinux script.

3.3.1 Source Directory

The ttylinux CD-ROM is used as the source, or the ttylinux CD-ROM image file mounted with a loop device can be used. Even the kernel and file system image files removed from the ttylinux CD-ROM image can be used as the source if they are in a directory structure as found in the CD-ROM image.

Using the CD-ROM Disc

For mounting the CD-ROM disc, /mnt/cdrom references the mount point in your file system to which the CD-ROM disc mounts. If you are not using ttylinux then your actual mount point may be different; substitute accordingly. Have the ttylinux boot CD-ROM disc in the CD-ROM drive and mount it. You need to know which device in /dev to use; if you do not know which device to use then section 3.4.1 might help. The CD-ROM should be mounted as type iso9660 e.g., mounted by the following command.

	mount -t iso9660 /dev/<partition> /mnt/cdrom

Using the CD-ROM ISO Image File

If you have a downloaded ttylinux CD-ROM image file, bootcd-i486-9.2.iso.gz, bootcd-i686-11.0.iso.gz or bootcd-x86_64-11.0.iso.gz, then you can mount it via loopback device with the following commands; substitue i686-11.0 or x86_64-11.0 for i486-9.2 where appropriate.

	mkdir -p mnt/cdrom
	gunzip bootcd-i486-9.2.iso.gz
	mount -t iso9660 -o loop bootcd-i486-9.2.iso mnt/cdrom

Critical CD-ROM Files

Of the following three files, you must have access to the first two; the third one is very usefull, but not critical. In the following, "CD-ROM/" is meant to be wherever you mounted the CD-ROM disc or CD-ROM image file.

CD-ROM/boot/filesys.gz - ttylinux gzipped file system image
CD-ROM/boot/vmlinuz - gzipped ttylinux Linux kernel
CD-ROM/config/ttylinux-setup - user-maintained RAM disk startup

3.3.2 Target Directory

The target directory is the directory where ttylinux will be put; it must be the top-level, root directory on the disk partition being used. You need to know, or find out, the device name for the disk partition onto which you want to transfer ttylinux. If you are not sure what a disk partition is you can read a little more description of ttylinux target partitions in section 3.4.2, but do not continue until you understand enough about disk devices and partitions to understand the rest of this section.

Due to the combined space requirements of the 8 MB ttylinux file system and the 2.5 to 3.5 MB ttylinux kernel, and considering some margin, the minimum partition size onto which you can install ttylinux and have it work is at least 12 MB.

This rest of this section describes manually mounting a disk partition that has the directory to transfer ttylinux onto. If your target directory is already mounted, or automatically mounts, and you will use the ttylinux script to transfer ttylinux, then delete everything in the target directory or the script will not transfer ttylinux onto it.

In order to manually mount a disk you need to know the disk device node e.g. /dev/sdc and its mountable partition you want to use e.g. /dev/sdc1. Read the previous sentence again, note the distinction between the disk and partition devices.

A USB drive partition probably should be mounted with the following command. For mounting the drive, /mnt/flash references the mount point in your file system to which the drive mounts. If you are not using ttylinux then your actual mount point may be different; substitute accordingly. If you are mounting a Linux file system then change to the appropriate file system type in the following command.

	mount -t vfat /dev/<partition> /mnt/flash

The device partition in the above example is the device node of the mountable partition on the disk that you want to use e.g. sdc1, in which case it represents /dev/sdc1.

If you will use the ttylinux script to transfer ttylinux, then delete everything in the target directory or the script will not transfer ttylinux onto it.

3.3.3 Running the Transfer Script

The ttylinux shell script, /sbin/ttylinux-flash automates the process of copying the ttylinux system from the source directory into the target directory and making the target drive bootable. This transfer typically is from CD-ROM disc to flash drive; the CD-ROM disc should be mounted with option -t iso9660 to specify the correct file system type, and USB drives are usually FAT32 and those should be mounted with option -t vfat to specify the correct file system type.

The script is invoked with a command line option telling it which boot loader to use, lilo or syslinux. The following is the help output from the ttylinux-flash script, it describes how to invoke the script.

ttylinux-flash
(C) 2008-2010 Douglas Jerome <douglas@ttylinux.org>

Usage: ttylinux-flash --lilo     <source path> <flash path> <flash dev>
       ttylinux-flash --syslinux <source path> <flash path> <flash dev>

Parameters:

     -l | --lilo ....... Use lilo method to make bootable flash disk.
     -s | --syslinux ... Use syslinux method to make bootable flash disk.

     <source path> is the mounted ttylinux CD-ROM directory, or any equivalent
                   USB or hard drive directory of the ttylinux CD-ROM layout
                   and contents.

     <flash path>  is a rooted path to the flash disk root file system to be
                   loaded from the source path.  For the syslinux method this
                   must be a Windows FAT file system, but for the lilo method
                   this can be either an EXT2 or FAT file system.

     <flash dev>   is the /dev/* that is the whole disk block device node,
                   such as /dev/sdc, NOT a partition block device node
                   like /dev/sdc1.

The transfer script checks if the source CR-ROM device contains a ttylinux CD-ROM; if the CD-ROM is found then a summary of what is to be transfered onto which device is printed and you are given a choice of continuing or aborting. Enter "yes" to continue the transfer.

The transfer script copies the ttylinux files onto drive and then installs the bootloader.

After the installer is finished you can remove the CD-ROM disc from your computer and reboot.

3.3.4 Manual Transfer

The manual process is described in appendix B of this document. It also is a text file, Flash_Disk_Howto.txt, in the doc/ directory on the ttylinux CD-ROM disc.


3.3.5 Configuring the System

This transfered ttylinux system is a RAM disk system. Its file system is a gzipped image on the boot drive; its directories and files are very inaccessible. When the system is running, changes made to files are not retained for the next boot. Customizing or configuring this system to your needs takes some specific support.

A ttylinux system properly transfered, such as by using the /sbin/ttylinux-flash script, has a special boot-time startup feature: the system startup script /etc/rc.d/rc.sysinit attempts to mount the drive that is boots from and run a script on that drive. Since the script is on the boot drive, probably a USB memory stick, it can be changed and maintained by you.

The feature of mounting the booted drive and running a startup script on that drive provides the user with a persistent boot-time startup configuration that is retained from one boot to the next. This user-maintainable startup script on the boot drive is in the config/ttylinux directory; a default version of this script is put onto the boot drive when the /sbin/ttylinux-flash script is run. This startup script is a very convenient place to configure your particular network interface for ttylinux startup.


3.4 Installing from CD-ROM - Persistent Storage Boot

NOTE Your computer needs at least 32 MB of RAM to run the ttylinux-installer script.

The section describes installing ttylinux from the CD-ROM image to a drive partition, probably on a spinning hard disk, and configuring it to boot ttylinux with the root file system residing on the boot drive, not in RAM.

A Linux system, either ttylinux or some other Linux system, can be used to install ttylinux.

WARNING: Running the installer can easily destroy all operating systems, and anything else, currently present on the target machine. Proceed with caution and backup all important data before installing ttylinux. Really.

To install ttylinux onto disk from the bootable CD-ROM, you first need to burn the ttylinux CD-ROM ISO image onto a blank CD-ROM disc and, if using ttylinux to perform the installation, boot into it as described in the previous section 2.3.

Once logged in as root, you can start the installation. You need to know three things to run the installer: 1) what your CD-ROM device is, 2) which drive partition you want to install ttylinux, and 3) where you want to put the boot loader.

If you don't know the answers to those three questions after reading the following instructions, the safe bet would be not to proceed with installation; the ttylinux installer is not yet automated or user-friendly enough for you.


3.4.1 Source CD-ROM Device

The correct CD-ROM device name depends on whether the drive is an IDE or SATA device. If your system uses IDE, the following device names are possible:

Device Name Description
/dev/hda Master Device on First IDE Controller
/dev/hdb Slave Device on First IDE Controller
/dev/hdc Master Device on Second IDE Controller
/dev/hdd Slave Device on Second IDE Controller

Among the above, /dev/hda is not likely to be your CD-ROM device unless you are using a modern laptop. A more likely possibility is /dev/hdc. /dev/hda normally is the device name of your hard disk, but a modern computer will use SATA for the hard drive and many of those have IDE CD-ROM drive.

If your system uses SATA (Serial ATA), use this table:

Device Name Description
/dev/scd0 First SATA CD-ROM Device
/dev/scd1 Second SATA CD-ROM Device
/dev/scd2 Third SATA CD-ROM Device
/dev/scd3 Fourth SATA CD-ROM Device

Usually the SATA CD-ROM device will be /dev/scd0.


3.4.2 Target Partition Device

You need to know, or find out, the device name for the disk partition on which you want to install ttylinux. The device names for disk partitions are formed by appending a number to the device name of the corresponding disk. For example, if your disk device is /dev/hda, the device /dev/hda3 is the third partition on that disk. Numbers 1-4 are the primary partitions, extended partitions start at 5.

ATTENTION: If you plan on installing onto a USB drive, or some other frequently moved disk device, then do not install ttylinux with the instructions here; use the instructions in section 3.3. The disk and partition devices used by this installation process would likely be different between different computers, so this installation may not correctly boot when booted on a computer other than the computer on which the installation is performed.

Due to the combined space requirements of the 8 MB ttylinux file system and the 3 MB ttylinux kernel, and considering some margin, the minimum partition size onto which you can install ttylinux and have it work is about 12 MB.

IDE disks use the same device names as given for IDE CD-ROM devices above. For SATA, the names are as follows:

Device Name Description
/dev/sda First SATA Disk Device
/dev/sdb Second SATA Disk Device
/dev/sdc Third SATA Disk Device
/dev/sdd Fourth SATA Disk Device

Note that if you want to create a dual-boot setup with Windows and ttylinux on the same disk, a topic not covered here, you can't use the first partition /dev/hda1 or /dev/sda1 as your ttylinux target partition, because that is where Windows needs to be installed to work.

Here are some examples of possible device names for your target partition:

Device Name Description
/dev/hda1 First Primary Partition on Primary IDE Master
/dev/hdb5 First Extended Partition on Primary IDE Slave
/dev/sda2 Second Primary Partition on First SATA Disk
/dev/sdc6 Second Extended Partition on Third SATA Disk

Note that depending on the BIOS, booting might be possible only from the first two disks installed in the system.

Also, you can look at the directory listing of /sys/block to see which block devices the kernel has detected, as disk drives are block devices.

Drive Partitioning, if Needed

What to do if your target disk is not partitioned yet? Linux systems, including ttylinux, have the fdisk program that can be used to partition disks. For example, to partition a disk connected as master to the first IDE controller, use:

	fdisk /dev/hda

The user interface of fdisk is somewhat primitive, so be careful. If you haven't used it before, a good idea would be to search the Internet for instructions. The basic commands you may need are "d" to delete a partition, "n" to create a new partition, "p" to print the current partition table, and "w" to write the edited partition table to disk. You can also use "q" to exit fdisk without saving your changes.

3.4.3 Boot Loader Location

The LILO boot loader is installed in one of two places: either the Master Boot Record (MBR) of the disk device or the boot sector of the partition device in which ttylinux is being installed.

With LILO installed in the MBR of the first disk, it will completely take over the entire boot process of the computer. If there are other operating systems installed on the computer they need to be specified in the LILO configuration file, /etc/lilo.conf, in order to boot them.

With LILO installed in the boot sector of the target partition or in the MBR of a disk other than the first one in your computer, the bootloader installed in the MBR of the first disk needs to be configured to boot the ttylinux target partition.

3.4.4 Running the Installer

Once you have decided on target device and boot loader location, you can run the installer. The script is called ttylinux-installer. The following is the help output from the ttylinux-installer script, it describes how to invoke the script. The square brackets indicate an optional parameter, the partition device is used for the installation target device.

ttylinux-installer
(C) 2008-2010 Douglas Jerome <douglas@ttylinux.org>
(C) 2006      Pascal Schmidt <ttylinux@ewetel.net>

Usage: ttylinux-installer [-m | --mbr] <source device> <target device>

Parameters:

     -m | --mbr ... Put the lilo boot loader onto disk device containing the
                    <target device> disk partition device.

     <source device> is the CD-ROM device that has the ttylinux CD-ROM.

     <target device> is the disk partition device onto which ttylinux is
                     installed; it needs to be a disk partition device, not the
                     whole disk device.  An ext2 file system is created on this
                     partition device.

This program creates an ext2 file system on the disk partition device <target
device>, installs ttylinux from the CD-ROM <source device> into the new file
system on <target device>, and then puts a lilo boot loader onto the target
disk.  The lilo boot loader is put onto the disk partition <target device>
unless the -m or --mbr option is present, in which case the lilo boot loader is
put onto the disk device containing the <target device> disk partition device.

For example, to install from the CD-ROM device /dev/hdc into partition device /dev/hda2 and placing LILO on the MBR, /dev/hda disk device, you would use:

	ttylinux-installer -m /dev/hdc /dev/hda2

Another example, installing from the second SATA CD-ROM device /dev/scd1 into the third partition device of the second SATA disk and placing LILO on the boot sector of the target partition:

	ttylinux-installer /dev/scd1 /dev/sdb3

The installer checks if the source CR-ROM device contains a ttylinux CD-ROM disc; if the CD-ROM disc is found then a summary of what is to be installed on which device is printed and you are given a choice of continuing or aborting. Enter "yes" to continue the installation.

The installer creates an ext2 file system on the target partition then copies the ttylinux distribution files onto the new file system, and then installs the LILO bootloader.

After the installer is finished you can remove the CD-ROM disc from your computer and reboot.

3.4.5 Manual Installation - Setup and Installation

This description uses LILO for boot loading; other boot loaders such as grub and maybe loadlin and syslinux will also work.

There are two files to take from the ttylinux CD-ROM image, either by burning the image to a blank CD-ROM disc and mounting it, or mounting the CR-ROM image via loop device. In the following commands, the ttylinux version 9.2 CD-ROM image file is named bootcd-i486-9.2.iso.gz; decompress it and mount it via loop device with the following commands, substituting your actual CPU x86_64 or i686 and ttylinux version number 11.0, if needed.

	mkdir -p mnt/ttylinux
	gunzip bootcd-i486-9.2.iso.gz
	mount -t iso9660 -o loop bootcd-i486-9.2.iso mnt/ttylinux

The two files needed from the CD-ROM are the ttylinux root file system, boot/filesys.gz, and the Linux kernel, boot/vmlinuz. You can, of course, use a different Linux kernel, following the ttylinux custom kernel requirements described in section 2.1.1.

There are two ways to install ttylinux for booting, one is to have ttylinux boot with the root file system in RAM disk, the other is to have ttylinux boot with the root file system directly on the hard drive.

Install a ttylinux to Boot Using RAM Disk

Copy the ttylinux file system filesys.gz image and the desired Linux kernel into your boot files directory; probably, this directory is /boot. After copying the two files, unmount the loop device with the following command.

	umount -d mnt/ttylinux

These two files, the kernel and the file system image, can have names other than the file names from the ttylinux CD-ROM. For this example the file names are changed from the names on the CD-ROM: the compressed ttylinux file system image file is called ttylinux-filesys.gz, the Linux kernel is called ttylinux-vmlinuz and the boot dirctory is /boot. Add the following section to /etc/lilo.conf:

image = /boot/ttylinux-vmlinuz
	label  = ttylinux
	initrd = /boot/ttylinux-filesys.gz
	root   = /dev/ram0
	read-only

Run the LILO boot loader installer by typing /sbin/lilo. The next boot will have the option of selecting ttylinux at the LILO boot prompt.

Install a ttylinux to Boot with File System on a Hard Drive

A hard drive partition, or a flash drive partition, of at least 8 MB is needed to install ttylinux. For this example ttylinux is being installed on drive partition device /dev/hda8 and the kernel and file system files are available via the loop device instructions above. A loop device also is used to mount the ttylinux file system image file.

	cp mnt/ttylinux/boot/filesys.gz filesys.gz
	gunzip filesys.gz
	mkdir -p mnt/filesys
	mkdir -p mnt/newroot
	mount -t ext2 -o loop ./filesys mnt/filesys
	mount -t ext2 /dev/hda8 mnt/newroot
	cp -a mnt/filesys/* mnt/newroot
	cp mnt/ttylinux/boot/vmlinuz mnt/newroot/boot/ttylinux-vmlinuz
	umount -d mnt/ttylinux
	umount -d mnt/filesys

The new ttylinux root file system is still mounted; it needs to be customized before booting. Configuration is described in the following section 3.4.6; it includes a description of a LILO configuration for booting the new ttylinux installation. After configuration unmount mnt/newroot.


3.4.6 Manual Installation - System Configuration

This section covers the minimum configuration needed to run ttylinux. More system configuration can be done; see the system guide, section 5, below for information.

The configuration files and options described in this section are present in a ttylinux system installed from the bootable CD-ROM. Following the installation instructions above, the file system is in mnt/newroot, that is the example starting point for the following configuration descriptions.

/etc/fstab

/etc/fstab needs to have the correct device for the root directory, the manually installed ttylinux /etc/fstab still specifies a RAM disk device for the root directory. Change the RAM disk device, /dev/ram0, to be the disk partition device in which the ttylinux root file system was installed. In the above example /dev/hda8 was used, so for that example the root directory in /etc/fstab would be specified as:

/dev/hda8     /     ext2     defaults     0 0

Boot Loader

The boot loader needs to specify the ttylinux kernel and root file system device. Following the installation instructions above, the LILO configuration file /etc/lilo.conf would include the following. Note the initrd specifier is removed and the root specifier is changed to /dev/hda8.

image = /boot/ttylinux-vmlinuz
	label = ttylinux
	root  = /dev/hda8
	read-only

Keyboard Map and Timezone

To use the current keyboard map and timezone from the Linux computer being used to install ttylinux, use the following commands.

	rm mnt/newroot/etc/localtime
	cat /etc/localtime > mnt/newroot/etc/localtime
	mnt/newroot/bin/dumpkmap > mnt/newroot/etc/i18n/kmap

Dial-up Network Information

ttylinux 9.2 is does not directly support dial-up networking with PPP and has no support at all for ISDN. Previous versions of ttylinux did have PPP and ISDN support; their package structure is being re-organized and they may return in later 9.X version of ttylinux.

ttylinux 9.2 does have the PPP binaries: /usr/sbin/pppd and /usr/sbin/chat, but currently it is up to you to configure and use them.

Unmount and Reboot

Now unmount the newly installed partition.

	umount mnt/newroot

And reboot to run the new ttylinux system.

4 Add-ons

Add-ons packages, such as thttpd a tiny web server, are available at the ttylinux web site. There also are links to any known off-site ttylinux add-on resources. New add-ons submitted to ttylinux will be considered for inclusion at the web site.

The ttylinux package manager, pacman, has the ability to install add-ons directly from the ttylinux web site. Section 5.9 describes the pacman ttylinux package manager.


5 System Guide

This section gives a short overview of the ttylinux system, its configuration and some of the installed programs.


5.1 Boot Parameters

Boot parameters are typed as a command line in the boot loader, before the Linux kernel is loaded. You will see these options when you boot the ttylinux CD-ROM.

enet .................. Startup networking for Ethernet interfaces found by
                        the kernel. DHCP is used. Any started interface will
                        be eth0, eth1, eth2 or eth3.

nofsck ................ Do not run fsck on any file systems.
 
nosshd ................ Do not start sshd or make ssh keys; recommended for
                        any CPU slower than 1 Ghz. A script that makes the
                        ssh keys will be left in the /root directory.

hwclock=(local|utc) ... The hardware (CMOS) clock keeps local or UCT time.

tz=<timezone> ......... Set timezone to <timezone> by setting the TZ
                        environment variable. Example: tz=GMT-8  See the
                        following URL for a complete description of TZ.
         http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html#TZ-Variable

If you've installed ttylinux and are using lilo, or some other boot loader, ttylinux will still use these boot options even if the boot loader does not show them.

5.2 Basic Features

Upon boot-up, ttylinux provides 6 text consoles for login. There is one initial user account: root, the administrator account, with password password.

The syslogd and klog daemons are running and logging kernel and system messages to the file /var/log/messages.

The available text editor is vi; invoke it by typing vi /path/to/filename. This version of vi is a minimal version provided by busybox. Documentation and help for using vi is available in many places on the web.

For manipulation of users, groups and passwords, the tools adduser, addgroup, deluser, delgroup and passwd are present.

If you have not changed the timezone and keyboard settings as outlined in the configuration section, section 3.4.6 above, ttylinux will use its default settings. The default timezone is UTC, the default keyboard mapping is for a US keyboard.

The inetd super-server and the dropbear SSH server are running by default. An FTP or TFTP server will be forked by inetd when receiving either a connect from an FTP or TFTP client, respectively.

ttylinux 9.2 has no telnet server or client; the dropbear SSH client is used to remotely log in to other hosts.

ttylinux includes a basic packet filtering firewall which is enabled by default. Section 5.7 below describes the configuring the ttylinux firewall.


5.3 Bootup, Shutdown and System Configuration

On system bootup, the init process runs the /etc/rc.d/rc.sysinit script to setup the system, such as setting the clock, system font, keyboard map and checking the file systems. rc.sysinit also runs the /etc/rc.d/rc.local script and then runs all the programs in the /etc/rc.d/rc.startup directory, all with the command line parameter start.

For ttylinux systems installed by the /sbin/ttylinux-flash script, the system startup script /etc/rc.d/rc.sysinit attempts to mount the drive that is boots from and run a script. This ttylinux system is a RAM disk system, changes made to files are not retained for the next boot because the file system is in RAM. The feature of mounting the booted drive and running a startup script provides the user with a persistent boot-time startup configuration that is retained from one boot to the next. This user-maintainable startup script on the boot drive is in the config/ttylinux directory; a default version of this script is put onto the drive when the url/sbin/ttylinux-flash script is run. This script is a very convenient place to configure your particular network interface for ttylinux startup.

On system shutdown, the script /etc/rc.d/rc.sysdone runs. This script runs all the programs in the /etc/rc.d/rc.shutdown directory and then runs the /etc/rc.d/rc.local script, all with the command line parameter stop.

All the programs in /etc/rc.d/rc.startup and /etc/rc.d/rc.shutdown are symbolic links that reference actual shell scripts or binary programs; they are run in the ASCII order of their file names. These symbolic links are named with leading numbers to help control their ordering e.g., 10.network is the symbolic link the the network startup program. The actual programs are in /etc/rc.d/init.d. Removing a symbolic link disables the program from starting up. These programs typically are shell scripts; they are commonly called initscripts.

Initscripts can be interactively invoked. The following command runs the network script /etc/rc.d/init.d/syslog with the command line option stop.

	service syslog stop

All scripts use the command line options start, stop, reload, restart and status. They print a list of supported options if they are called with no option present.

The initscripts define the basic ttylinux bootup system configuration. The initscripts are configurable to an extent; thus the bootup configuration is configurable to an extent. The bootup system configuration is specified in ASCII text files in the /etc/sysconfig directory; this directory is intended to have only files that are read by the various initscripts. All files read by initscripts for configuration options should reside in /etc/sysconfig.

There are two files in /etc that describe your ttylinux build-time configurations. /etc/ttylinux-host is a text file that describes something about the host architecture that built your ttylinux distribution. /etc/ttylinux-target is a text file that describes some things about the architecture of your running ttylinux distribution.

5.4 Shell Environment

The default shell used by ttylinux is GNU bash. The shell environment of aliases and variables is in /etc/profile; view this file after login to become familiar with the default shell environment.

Upon login, the PATH environmental variable has the following paths in the order listed.

	/bin
	/usr/bin
	/sbin
	/usr/sbin

Put additional, or overriding, shell environment in scripts in the /etc/profile.d directory; do not change /etc/profile in order to avoid losing changes when updating ttylinux.

5.5 Using Dropbear for SSH

SSH, or secure shell, is a protocol for remote login with an advantage over telnet being that it can use public key authentication instead of passwords. Another advantage over the telnet protocol is that plain text is not transfered; the data sent between the host connections is encrypted.

dropbear is a small SSH v2 server and client package. Keys are generated and the server is started on system bootup by default, unless either the ttylinux dropbear starup script detects the CPU is slower than 1 GHz or the nosshd boot options was specified.

dropbear allows password and public key authentication. Public key authentication can use DSS and RSA keys and works with keys generated by the popular OpenSSH package. Having a public key from OpenSSH in the file .ssh/authorized_keys should allow secure login from the machine that has the corresponding private key. The permissions on the .ssh directory must not include group or other write permission, otherwise dropbear will refuse public key authentication.

The SSH client program is called dbclient. It is different from the server in that it cannot use keys in OpenSSH format. You can use the dropbearconvert program to convert an OpenSSH format key for use by dbclient or you can use dropbearkey to create a new key.

To convert an OpenSSH key stored in  /.ssh/id_rsa, do:

	dropbearconvert openssh dropbear \
		~/.ssh/id_rsa ~/.ssh/id_rsa.db

The new key will be stored in  /.ssh/id_rsa.db. You can use the -i switch to dbclient to make it use your new key for authentication. The public key part of the old OpenSSH key can be used as-is for pasting into your  /.ssh/authorized_keys file. Conversion is only needed for the private key.

To create a new RSA key to store in  /.ssh/id_rsa.db, you can use the following command:

	dropbearkey -t rsa -f ~/.ssh/id_rsa.db

The public key part of the new key will be printed to the screen. You can put it into the  /.ssh/authorized_keys file on all machines where you want to be able to login using your new private key stored in  /.ssh/id_rsa.db. You can create a DSS key instead of an RSA key by using -t dss instead of -t rsa. Should you lose the public key, you can always get it back by using the private key and the -y switch to dropbearkey:

	dropbearkey -y -f ~/.ssh/id_rsa.db

If you want to use scp to copy files from another machine, the standard scp program from OpenSSH is included with dropbear and ttylinux.

5.6 Using an Ethernet Network

ttylinux is ready to use Ethernet networking. DHCP will be used when starting up the Ethernet network, unless configured otherwise.

The Ethernet network interface configuration is specified in the text file:

	/etc/sysconfig/network-scripts/ifcfg-eth0

This file has specification in the form of "ITEM=value". Edit this file to set the proper Ethernet interface IP addresses, change the Ethernet DHCP usage and to enable Ethernet networking. To enable Ethernet networking, the line ENABLE=no must be changed to ENABLE=yes. To disable DHCP, the line DHCP=yes must be changed to DHCP=no.

After configuring the Ethernet network interface, restart the networking subsystem with the following command.

	service network restart

See the description of the /sbin/sysconfig script in section 5.10 for scripted help in setting up the Ethernet network interface configuration.

The Ethernet network interface, commonly referred to as eth0, can be started and stopped independently from the entire network subsystem with the following commands.

Startup eth0 with:

	ifup eth0

Shutdown eth0 with:

	ifdown eth0


5.7 Using the Firewall

The ttylinux firewall script sets the firewall to drop all new network input except for the ports explicitly specified in the firewall configuration file /etc/firewall.conf. The default firewall configuration specified in /etc/firewall.conf allows connections for FTP, TFTP, SSH, HTTP and the unprivileged UDP ports 1024 through 65535. The /etc/firewall.conf firewall configuration file has a very simple syntax that includes comments; the default file contains comments explaining its syntax and should be easy to understand and update.

Outgoing traffic is not firewalled at all and there is no configuration file for controlling outgoing traffic.

5.8 Using Dialup

ttylinux 9.2 is does not directly support dial-up networking with PPP and has no support at all for ISDN. Previous versions of ttylinux did have PPP and ISDN support; their package structure is being re-organized and they may return in later 9.X version of ttylinux.

ttylinux 9.2 does have the PPP binaries: /usr/sbin/pppd and /usr/sbin/chat, but currently it is up to you to configure and use them.


5.9 Package Management

Package management is handled by shell script /usr/bin/pacman; since the directory /usr/bin is in the PATH, pacman is invoked from the shell command line by typing its name, pacman. Use pacman to install and remove packages, and to query the database of installed packages and files.

The binary packages used by ttylinux are tar archives compressed with the bzip2 algorithm. All the packages that normally come with the ttylinux distribution are available on the download page at the ttylinux web site; this is for reinstalling any packages that may have been removed from a ttylinux system.

Take care to install packages for your architecture i.e., i486, i686 or x86_64; read the package names carefully.

To install the package bash-3.2-i486.tbz, which must be residing in the current directory, you would use the following command:

	pacman -i pkg-bash-3.2.tbz

Three different options are available for querying the database of installed packages and files. To get a list of all installed packages, run

	pacman -qa

To find out which package the file /bin/login belongs to, use

	pacman -qf /bin/login

To list all files from the e2fsprogs-1.41.3 package, run

	pacman -ql e2fsprogs-1.41.3

If you want to remove a package, you can do so by use of the -e option. To remove the e2fsprogs-1.41.3 package, you would use the following command:

	pacman -e e2fsprogs-1.41.3

You can also use the -v option to get verbose output during installation and removal of packages. pacman will then list all the files it has installed or removed.

pacman Repository

pacman can list the available packages on an external repository and install directly from an external repository via http. pacman retreives packages only for the running ttyliux version, unless overridden with the -vers=<vers> option.

To query the deafult ttylinux.net repository, use

	pacman -qr

To query the waldo.net repository, which doesn't actually exist, use

	pacman --repo=waldo.net -qr

To install the package bash-3.2-i486.tbz from the ttylinux.net repository, you would use the following command:

	pacman --repo=ttylinux.net -i pkg-bash-3.2.tbz

pacman Database

The pacman script uses directory /usr/share/ttylinux which has one file per installed package, each file containing a listing of all the files that belong to the installed package.


5.10 Using the sysconfig Script

The /sbin/sysconfig shell script can be used to set, and to show, the fields in various ttylinux system configuration files; it can set or show any value for any "ITEM=value" line in any configuration file in the /etc/sysconfig and /etc/sysconfig/network-scripts directories.

The following commands sets "ENABLE=yes" and "DHCP=yes" in the /etc/sysconfig/network-scripts/ifcfg-eth0 file.

	sysconfig -nc ifcfg-eth0.enable=yes
	sysconfig -nc ifcfg-eth0.dhcp=yes

The "-nc" option in the above examples tells the sysconfig script to work on files in the /etc/sysconfig/network-scripts directory. The second option is in the form file.item=value.

To change the IP address of the Ethernet network interface, with 192.168.1.100 as the example IP address, with a netmask of 255.255.255.0 and standard subnet gateway and broadcast addresses, use the following sequence of sysconfig script commands.

	sysconfig -nc ifcfg-eth0.ipaddress=192.168.1.100
	sysconfig -nc ifcfg-eth0.network=192.168.1.0
	sysconfig -nc ifcfg-eth0.netmaks=255.255.255.0
	sysconfig -nc ifcfg-eth0.gateway=192.168.1.1
	sysconfig -nc ifcfg-eth0.broadcast=192.168.1.255

Use "-sc" for the first option to the sysconfig script in order to work with system configuration files in the /etc/sysconfig directory.

Use the following command to get complete, up-to-date help description directly from /sbin/sysconfig

	sysconfig --help

5.11 Depricated and Legacy Items

5.11.1 Dial-up Networking

ttylinux 9.2 is does not directly support dial-up networking with PPP and has no support at all for ISDN. Previous versions of ttylinux did have PPP and ISDN support; their package structure is being re-organized and they may return in later 9.X version of ttylinux.

ttylinux 9.2 does have the PPP binaries: /usr/sbin/pppd and /usr/sbin/chat, but currently it is up to you to configure and use them.

5.11.2 devfs

Support for devfs was removed from ttylinux Version 4.0, in Aug 2004. There is no current plan to use a dynamic device file system.

6 Contact and Help

Reporting bugs in ttylinux and its documents is appreciated. For bug reports, suggestions, or anything else about ttylinux that you think is important, feel free to contact me. You can reach me by email at:

Douglas Jerome <douglas@ttylinux.org>

There is a web-based forum that is active from time to time; it is active when this was written, December 2008, and is intended to be active as long as minimalinux is supporting ttylinux, barring spammer abuse.

/forum/

Help may be available on irc, although it is very low bandwith and usually more appropriate for inane banter.

irc.freenode.net #ttylinux

A. ttylinux-specific Commands Overview

Separate from the initscripts in /etc/rc.d/initd directory, the following table lists the ttylinux-specific scripts intended to be available for ttylinux root users.

Script Directory Usage
ifdown /sbin Shutdown Ethernet Network Interface
ifup /sbin Startup Ethernet Network Interface
service /sbin Execute a script in /etc/rc.d/init.d
shutdown /sbin Reboot or Shutdown the System
sysconfig /sbin Modify a System Configuration File
ttylinux-flash /sbin Copy ttylinux to Flash Disk
ttylinux-installer /sbin Install ttylinux onto A Disk
pacman /usr/bin ttylinux Package Manager


B. Flash_Disk_Howto.txt

How to Put ttylinux on a Flash Disk and Make it Bootable
Copyright (C) 2008-2010 Douglas Jerome <douglas@ttylinux.org>


FILE NAME

	$RCSfile: Flash_Disk_Howto.txt,v $
	$Revision: 1.11 $
	$Date: 2010/03/01 02:33:11 $

PROGRAM INFORMATION

	Developed by:	ttylinux project
	Developer:	Douglas Jerome, drj, <douglas@ttylinux.org>

FILE DESCRIPTION

	This document is a guide to putting ttylinux on a flash disk and making
	the it bootable.

CHANGE LOG

	28feb10	drj	Corrected for the latest CD-ROM layout and added timeout
			to the boot loaders to allow for boot options.

	19dec09	drj	Corrected the description of the two required flash
			drive directories. credit <legendre@nerp.net>

	01sep09	drj	Updated to be consistent with revised ttylinux-flash
			script and the CD-ROM directory and file structure.

	07dec08	drj	Changed some descriptions for using the syslinux
			executable program on the ttylinux CD-ROM.

	04dec08	drj	Added suggestions on mounting the CD-ROM and USB disk.

	22nov08	drj	Added failure path descriptions.  Finished testing the
			installation processes.  Added section numbers and the
			outline.

	22nov08	drj	Changed ram0 location from flash disk to /tmp.  Fixed
			the device referenced by the syslinux command.  Added
			description of lilo's anomalous behavior.  Fixed the
			fdisk usage in the description of boot problems.

	21nov08	drj	Finished and baselined first version for ttylinux.


                ------------------------------------------------


How to Put ttylinux on a Flash Disk and Make it Bootable


-- Document Outline --
1. Preface
2. Introduction
3. Lilo Method
4. Syslinux Method
5. Automated Help
6. Boot Problems


==========
1. Preface
==========

Caveat:  The syslinux method is known to work with syslinux-3.72.
Caveat:  Instead of booting ttylinux, your flash disk may become unusable, but
         that is not known to have happened.

Advice:  Read before doing; reading does not take very long.  Look at the end
         of this short document for problems and possible resolutions.


===============
2. Introduction
===============

Flash disks include USB disks which are often called flash drives, pen drives,
USB memory sticks, travel drives, etc.

This file describes two methods of copying ttylinux from its bootable CD-ROM
and putting it onto a flash disk that is also made bootable.  The syslinux
and lilo methods both can be done by ttylinux, but notice the syslinux program
that makes the flash disk become bootable is not in the ttylinux file system,
it is in the root directory on the ttylinux CD-ROM.  These methods probably
only make sense on a Linux system, particularly the lilo method.

You should save all your data on the flash disk to somewhere else and then
remove all files and directories from the flash disk.  Making a mistake in this
process can endanger any data on the flash disk.  Also, if the Linux kernel is
too far from the beginning of the flash disk memory it may not be bootable;
this has nothing to do with where the file name is in a directory listing or in
Windows explorer.

You can format the flash disk to be a Linux file system, but leaving a USB disk
in Windows format, probably vfat aka W95 FAT32, is very convenient.

Prerequisites:  Depending upon the method you use, you need to have privilege
                to write to the flash disk device e.g. /dev/sdc or to write to
                its mountable partition you want to use e.g. /dev/sdc1, and
                with the lilo method you need to create a device node.  It is
                therefore very likely you need to be root.

                You need to *know* the flash disk device node e.g. /dev/sdc and
                its mountable partition you want to use e.g. /dev/sdc1.  Read
                the previous sentence again, note the distinction between the
                disk and partition devices.

In the following descriptions <disk> and <partition> are used to represent
device nodes in the /dev directory.

<disk> is the device node of the entire flash disk e.g. sdc, in which case
       /dev/<disk> represents /dev/sdc.

<partition> is the device node of the mountable partition on the flash disk
            that you want to use to store the Linux kernel and ttylinux file
            system e.g. sdc1, in which case /dev/<partition> represents
            /dev/sdc1.

In the following descriptions, /mnt/flash references the mount point in your
file system to which the flash disk mounts.  Your actual mount point may be
different, substitute accordingly.

A USB disk partition probably should be mounted with the following mount
command.  The second command gives you the UUID of the mounted partition, it
may not work, but if it does then write down or otherwise save the UUID.

     $ mount -t vfat /dev/<partition> /mnt/flash
     $ blkid /dev/<partition>

/mnt/cdrom represents the location of the mounted CD-ROM in the following
descriptions.

Have the ttylinux boot CD-ROM in the CD-ROM drive and mount it.  The CD-ROM
should be mounted as type iso9660 e.g., mounted by the following command.

     $ mount -t iso9660 /dev/<disk> /mnt/cdrom

If you have an image of the ttylinux CD-ROM mounted via loopback device, or
have the files from the ttylinux CD-ROM in another directory, you can use that.

In the following descriptions there are example commands; they are prefixed by
a shell prompt of "$ ", and comments to shell commands begin with the shell
comment character '#".


==============
3. Lilo Method
==============

Warning:  After performing this method subsequent uses of the syslinux method
          may have no affect, or misboot with odd errors, or the lilo boot
          loader may remain on the flash disk and continue to boot the kernel.
          I've never seen the syslinux method work after using this lilo
          method.  There is a way to fix this; it is described at the end of
          the syslinux method.

Mount the flash disk.  The following description uses /mnt/flash to reference
the mount point of the flash disk.  Did you remember to first save everything
you want to keep off the flash disk and remove everything from it?  After
mounting the flash disk, create two new directories named "boot" and "config"
on the flash disk.

     $ mkdir /mnt/flash/boot
     $ mkdir /mnt/flash/config

The flash disk should now have nothing on it except the two empty directories
just made, /boot and /config.

Copy the ttylinux Linux kernel and ttylinux file system image from the CD-ROM
onto the flash disk; put them into the boot directory.

     $ cp /mnt/cdrom/boot/vmlinuz          /mnt/flash/boot/
     $ cp /mnt/cdrom/boot/filesys.gz       /mnt/flash/boot/
     $ cp /mnt/cdrom/config/ttylinux-setup /mnt/flash/config/ttylinux

You need a ram0 device node for lilo to reference during the boot installation.
If you don't have one in /dev then you need to make one somewhere; it is better
to NOT make one in /dev in the case your system uses udev.  You can make one in
/tmp with the following command.

     $ mknod -m 660 /tmp/ram0 b 1 0

A lilo configuration file is needed.  It is convenient to put it on the flash
disk in the boot directory; the file is /mnt/flash/boot/lilo.conf.  Use the
following example lilo.conf file, changing <disk> and </mnt/flash> and
</dev/ram0> to be the actual values.  Use ttylinux-flash=<UUID> ONLY if you got
the UUID when previously mounting the USB disk partition, replacing <UUID> with
the actual UUID value.

NOTE The location of the ram0 device is the actual one you want to use; if you
     didn't create one then it probably is /dev/ram0.

NOTE Everything between the dashed lines is the /mnt/flash/boot/lilo.conf file.

-------------------------------------------------------------------------------
boot = /dev/<disk>
disk = /dev/<disk> bios=0x80
map  = </mnt/flash>/boot/map

install     = menu
menu-scheme = Yb:Yk:kb:Yb
menu-title  = "LILO (LInux LOader) boot ttylinux"

compact
default = ttylinux
lba32
prompt
timeout = 150

image=</mnt/flash>/boot/vmlinuz
     append = "ro ttylinux-flash=<UUID>"
     label  = ttylinux
     root   = </dev/ram0>
     initrd = </mnt/flash>/boot/filesys.gz
     read-only
-------------------------------------------------------------------------------

After the lilo.conf file is correct, execute lilo to make the flash disk
bootable with these two commands.

     $ lilo -M /dev/<disk> mbr
     $ lilo -C /mnt/flash/boot/lilo.conf

There probably are many possible problems.  If there were no FATAL problems
reported from lilo, unmount and reboot the flash disk.

----------------
Possible Problem
----------------

Lilo may detect a partition problem and give you message like the following:

     Warning: boot record relocation beyond BPB is necessary: /dev/sdc
     Added ttylinux *
     Fatal: LILO internal error:  Would overwrite Partition Table

--------------------
Possible Resolutions
--------------------

If you have this problem you may want to do one of the following:

=> If you are using a USB disk then you can use a Windows-based USB boot disk
   tool; several are freely available.

=> Use a commercial partition tool to fix the flash disk partition table.

=> Use a different flash disk.


==================
4. Syslinux Method
==================

You need to have the syslinux executable program.  The root directory of the
ttylinux CD-ROM should have the syslinux executable program from syslinux-3.72.

Other syslinux sources: You may have it in your current linux distribution.  Or
you can get the latest version from
http://www.kernel.org/pub/linux/utils/boot/syslinux/ and after untarring it,
find the syslinux executable in the linux directory.

Caveat:  The syslinux method is only known by the author to work with
         syslinux-3.72; it probably works with newer versions and a few of the
         older versions.

Mount the flash disk.  The following description uses /mnt/flash to reference
the mount point of the flash disk.  Did you remember to first save everything
you want to keep off the flash disk and remove everything from it?  The flash
disk should now have nothing on it.

NOTE  The following lilo fixup also fixes many USB disks that do not properly
      boot.

NOTE  If you are doing this with a flash disk that previously was booting from
      a lilo boot loader e.g., you previously used the above lilo method, then
      perform this lilo operation before continuing:

      $ lilo -M /dev/<disk> mbr

Mount the flash disk.  The following description uses /mnt/flash to reference
the mount point of the flash disk.  Did you remember to first save everything
you want to keep off the flash disk and remove everything from it?  After
mounting the flash disk, create some new directories on the flash disk:

     $ mkdir /mnt/flash/boot
     $ mkdir /mnt/flash/boot/syslinux
     $ mkdir /mnt/flash/config

Copy the syslinux help message files from the CD-ROM onto the flash disk.  Copy
the ttylinux Linux kernel and ttylinux file system image files from the CD-ROM
onto the flash disk:

     $ cp /mnt/cdrom/boot/vmlinuz          /mnt/flash/boot/
     $ cp /mnt/cdrom/boot/filesys.gz       /mnt/flash/boot/
     $ cp /mnt/cdrom/boot/boot.msg         /mnt/flash/boot/syslinux/
     $ cp /mnt/cdrom/boot/help.msg         /mnt/flash/boot/syslinux/
     $ cp /mnt/cdrom/config/syslinux       /mnt/flash/config/syslinux
     $ cp /mnt/cdrom/config/ttylinux-setup /mnt/flash/config/ttylinux

A syslinux configuration file is needed.  It must be put on the flash disk in
the boot/syslinux directory; the file is /mnt/flash/boot/syslinux/syslinux.cfg.
Use the following example syslinux.cfg file.  Use ttylinux-flash=<UUID> ONLY if
you got the UUID when previously mounting the USB disk partition, replacing
<UUID> with the actual UUID value.  Everything between the dashed lines is the
/mnt/flash/boot/syslinux/syslinux.cfg file.
long.

-------------------------------------------------------------------------------
default ttylinux
display boot.msg
prompt  1
timeout 150

F1 boot.msg
F2 help.msg

label ttylinux
        kernel /boot/vmlinuz
        append initrd=/boot/filesys.gz root=/dev/ram0 ro ttylinux-flash=<UUID>
-------------------------------------------------------------------------------

Now make the flash disk bootable with syslinux; notice the partition device is
used, not the disk device.

     $ syslinux -d boot/syslinux /dev/<partition>

There probably are many possible problems.  If there were no problems, unmount
and reboot the flash disk.

----------------
Possible Problem
----------------

When executing the syslinux command you see an error message something like
"Cluster sizes larger than 16K not supported".

--------------------
Possible Resolutions
--------------------

Install a more recent version of syslinux.


=================
5. Automated Help
=================

It really is best to use the script described herein.

For the automated help described below, both the CD-ROM and the flash disk must
be mounted before executing the ttylinux-flash script.

There is a shell script in the ttylinux file system that does a variation of
the lilo and syslinux methods.  Backup anything you want to keep from your
flash disk before using the script.  The script is invoked with a command line
option telling it which method to use; guess which option does which.

ttylinux-flash --lilo     <CD-ROM path> <flash disk path> <flash disk device>
ttylinux-flash --syslinux <CD-ROM path> <flash disk path> <flash disk device>

The following command examples use the same conventions as above for the paths
and device nodes.

ttylinux-flash --lilo     /mnt/cdrom /mnt/flash /dev/<disk>
ttylinux-flash --syslinux /mnt/cdrom /mnt/flash /dev/<disk>

If you want to run this script from a Linux system other than ttylinux, then
run it from the ttylinux mounted at /mnt/cdrom, it will be
/mnt/cdrom/sbin/ttylinux-flash.


================
6. Boot Problems
================

General
-------

Some flash disks seem to have a boot problem, something wrong with their zero
block Master Boot Record (MBR).  Run fdisk on the disk device /dev/<disk> to
see if the Boot flag is set on the partition that has the Linux kernel,
/dev/<partition>.

     # Check for the Boot flag
     #
     fdisk -l /dev/<disk>

If the Boot flag is not set, use fdisk to toggle the bootable flag; the fdisk
command is 'a'.  The fdisk usage will look something like the following, if the
partition with the Linux kernel is 1.

     $ fdisk /dev/<disk>
     Command (m for help): a
     Partition number (1-8): 1
     Command (m for help): w

It also is best to use this lilo command, after having used fdisk to set the
partition bootable flag:

     $ lilo -M /dev/<disk> mbr

Strange Lilo Boot Errors
------------------------

If you get part of the word LILO and then nothing or a repeating sequence of
numbers or words, or if you get "Can't load operating system" or even nothing
at all: put the flash disk back into the computer from wich you where loading
it with ttylinux and try this lilo command:

     $ lilo -M /dev/<disk> mbr

Try bootable again after executing the above command; if the flash disk still
doesn't correctly boot, you may need to repeat either the lilo or syslinux
method of installing ttylinux.


[eof]