What is a Daemon?

A daemon (or service) is a background process that is designed to run autonomously,with little or not user intervention. The Apache web server http daemon (httpd) is one such example of a daemon. It waits in the background listening on specific ports, and serves up pages or processes scripts, based on the type of request.

Creating a daemon in Linux uses a specific set of rules in a given order. Knowing how they work will help you understand how daemons operate in user land Linux, but can operate with calls to the kernel also. In fact, a few daemons interface with kernel modules that work with hardware devices, such as external controller boards, printers,and PDAs. They are one of the fundamental building blocks in Linux that give it incredible flexibility and power.

Throughout this HOWTO, a very simple daemon will be built in C. As we go along, more code will be added, showing the proper order of execution required to get a daemon up and running.

Basic Daemon Structure

When a daemon starts up, it has to do some low-level housework to get itself ready for its real job. This involves a few steps:

  • Fork off the parent process
  • Change file mode mask (umask)
  • Open any logs for writing
  • Create a unique Session ID (SID)
  • Change the current working directory to a safe place
  • Close standard file descriptors
  • Enter actual daemon code

Introduction to FTS Linux Installation The purpose of this guide is to help you get an FTS Linux system up and running on an Intel 80x86 based System. In addition to the platform, you will also need:

  • an x86 PC running Linux, fitted with an NIC (Ethernet) card
  • a network router
  • suitable cables and connectors to link these devices, but only Ethernet is supported from Linux hosts
  • if you require access to the Linux console using a serial connection, a terminal that can plug into the RS232 port on the SoC platform or a serial cable to connect this port to the host PC (which will then emulate a terminal)
  • A target board connection kit appropriate to your architecture

The purpose of the PC is to build and host the software to run on the target platform. It may also perform the roles of Network File System (NFS) server and terminal emulator.

 Linux Target Board Setup

Getting Started with FTS Linux

This section describes one way of getting a newly installed Linux system running successfully on the target hardware. 

The instructions are specifically tailored for a target with an Intel 80x86 Architecture, but the general principles apply to all types of hardware and can be easily adapted to other devices. Even if the methods described here do not correspond with your exact requirements, they are designed to provide a good starting point from which to devise your own methods.

Note: These instructions assume that the target hardware you are using is already supported by FTSLinux.

The easiest way to monitor the behavior of the target Linux system, to develop and run applications is to run an interactive shell on the target. 

An interactive shell provides the ability to run commands and observe the results of those commands. There are several different ways to do this, depending on the connectivity to the target system. 

The Getting Started guide starts with a description of these monitoring tools (connected either using a serial port or across the network) together with instructions on how to use them.

It then describes how to build and then boot the Linux kernel on the target before describing the Network File System and how to build user programs for the target. The final step is an example Hello World program.

  •  Connecting through the serial port
  •  Connecting through the network
  •  Building the target Linux kernel
  •  Booting the Kernel
  •  Network File System (NFS)
  •  Building user programs
  •  The GNU tools
  •  Installing the GNU tools
  •  A simple example program - Hello World


Introduction To U-Boot

The U-Bootutility is a multi-platform, open-source, universal boot-loader with comprehensive support for loading and managing boot images, such as the Linux kernel. It supports the following features:

  • Network download: TFTP, BOOTP, DHCP, NFS
  • Serial download: s-record, binary (via Kermit)
  • Flash management: copy, erase, protect, cramfs, jffs2
  • Flash Types: CFI NOR-Flash, NAND-Flash
  • Memory utilities: copy, dump. crc, check, mtest
  • Mass Storage Devices: IDE, SATA, USB
  • Boot from disk: raw block, ext2, fat, reiserfs
  • Interactive shell: choice of simple or "busybox" shell with many scripting features.

This book is a quick guide to getting started. For full details of U-Boot's features please refer to the README file and visit the official website

 When the host Linux PC has been set up in accordance with the instructions provided with your chosen distribution, the next step is to install the FTSLinux distribution. Any changes that are needed to the host's installation are described later in the Getting Started Guide.

These are main stages in installing the FTSLinux Distribution.

  • The first stage is obtaining a copy of the distribution. You may already have this as a set of RPMs, either on a CD, or as part of an application specific distribution. If not, then download the distribution from the Linux FTP Server.
  • Next, set up the directory where you wish to install the FTSLinux distribution. In most cases, this only requires checking that you have enough space on that disk partition.
  • The recommended method for installing FTSLinux is to use the installer script. This script contains all the necessary commands for installing the distribution from a CD-ROM, from the local filesystem or over the internet

The detailed installation procedure is described in the following steps.

Supported Architecture: Intel
Introduction to FTS Linux Installation
Downloading the Distribution
Using the Installer Script
The Installation Directories
Installing using RPMs
Using YUM Tools
Updating the FTSLinux Distribution
Uninstalling FTS Linux