EasyManua.ls Logo

Linux Pocket Linux Guide User Manual

Default Icon
67 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #48 background imageLoading...
Page #48 background image
Chapter 8. Filling in the Gaps
8.1. Analysis
The root disk has come a long way since its humble beginnings as a statically−linked shell. It now shares
many features with the popular, ready−made distributions. For example it has:
Several common utilities like cat, ls and so on.
Startup scripts that automatically check and mount filesystems.
Graceful shutdown capability.
Support for multiple users and virtual terminals.
As a final test, we can put the root disk up against the Filesystem Hierarchy Standard (FHS) requirements for
the root filesystem. (We will ignore anything in the /usr hierarchy because of space constraints.) Compared
to FHS requirement, the only files missing are a few commands in the /bin directory. Specifically, the root
disk lacks the following commands:
more
ps
sed
In addition to the required commands, it might be nice to include the "ed" editor listed as an option by the
FHS. It is not as robust as vi or emacs, but it works and it should fit onto the tiny root filesystem.
So in order to finish up this phase of the project, we need to accomplish the following goals:
Add the more, ps and sed commands.
Install the optional ed editor.
8.2. Design
8.2.1. more
There is a more command that comes with util−linux, but it will not work for this project. The reason is
because of library dependencies and space constraints. The util−linux supplied more needs either the
libncurses or libtermcap to work and there just is not enough space on the root disk floppy to fit everything in.
So, in order to have a more command we will have to get creative.
The more command is used to display a file page by page. It's a little like having a cat command that pauses
every twenty−five lines. The basic logic is outlined below.
Read one line of the file.
Display the line on the screen.
If 25 lines have been displayed, pause.
Loop and do it again.
Of course there are some details left out like what to do if the screen dimensions are not what we anticipated,
but overall it is a fair representation of what more does. Given this simple program logic, it should not be hard
Chapter 8. Filling in the Gaps 42

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the Linux Pocket Linux Guide and is the answer not in the manual?

Linux Pocket Linux Guide Specifications

General IconGeneral
TitleLinux Pocket Guide
AuthorDaniel J. Barrett
PublisherO'Reilly Media
FormatPaperback
LanguageEnglish

Summary

Legal Information

Copyright and License

Legal text regarding document usage and permissions.

Disclaimer

Legal text disclaiming warranties and responsibilities for document use.

Introduction

About Pocket Linux

Overview of the guide's purpose and target audience.

Prerequisite Skills

Lists necessary skills for following the guide.

Project Format

Explains the chapter structure: Analysis, Design, Construction, Implementation.

Chapter 1: Project Initiation

The Goal of Pocket Linux

Outlines the objectives and constraints of the Pocket Linux project.

Working Within The Constraints

Discusses the limitations and advantages of the project's design.

Chapter 2: A Simple Prototype

2.1. Analysis

Defines the goals for the initial minimal working system.

2.2. Design

Outlines the components needed for a basic boot/root disk set.

2.2.1. Simplification

Focuses on essential components, ignoring complexity.

2.2.2. Boot Disk

Details requirements for the boot disk, including GRUB and kernel.

2.2.3. Root Disk

Describes requirements for the root disk, including BASH and /dev files.

2.3. Construction

Steps for building the boot and root disk floppies.

2.3.1. Prepare the boot disk media

Instructions for formatting and mounting the boot diskette.

2.3.5. Build the Linux kernel

Steps for configuring and compiling the Linux kernel.

2.3.9. Build BASH

Compiling and stripping the BASH shell for the root disk.

2.4. Implementation

Steps to start and test the prototype system.

2.4.1. System startup

Detailed instructions to boot the Pocket Linux system.

Chapter 3: Saving Space

3.1. Analysis

Discusses limitations of the prototype and goals for space saving.

3.2. Design

Outlines techniques for space saving: shared libraries, stripped binaries, compressed filesystem.

3.2.1. Shared Libraries

Rebuilding BASH to use shared libraries.

3.2.3. Compressed Root Filesystem

Using a ramdisk approach for a compressed filesystem.

3.3. Construction

Steps for building the compressed root filesystem using a ramdisk.

3.3.2. Rebuild the BASH shell

Reconfiguring BASH without static linking.

3.3.6. Compress the ramdisk image

Unmounting, dumping, and compressing the ramdisk.

3.4. Implementation

Steps to boot and test the space-optimized system.

3.4.1. System startup

Booting the system with the compressed root disk.

Chapter 4: Some Basic Utilities

4.1. Analysis

Discusses the need to add more utilities to the root disk.

4.2. Design

Plans for adding common external commands like cat, ls, mkdir, rm.

4.2.1. Determining Required Commands

Using FHS to identify necessary commands.

4.2.4. Downloading Source Code

Instructions for downloading package source code.

4.3. Construction

Steps for building and installing new utilities.

4.3.1. Create a staging area

Setting up a temporary directory for building.

4.3.3. Install binaries from GNU coreutils

Compiling and installing core utilities.

4.3.6. Create a compressed root disk image

Compressing the updated root filesystem.

4.4. Implementation

Steps to boot and test the system with new utilities.

4.4.1. System startup

Booting the system with a read-write root filesystem.

4.4.2. Testing new commands

Verifying the functionality of newly added utilities.

Chapter 5: Checking and Mounting Disks

5.1. Analysis

Discusses the need for disk mounting and checking capabilities.

5.2. Design

Planning to implement fsck and mount utilities.

5.2.1. Determining necessary utilities

Identifying fsck, mount, umount based on FHS.

5.2.3. Automating fsck and mount

Designing a script to check and mount filesystems.

5.2.4. File dependencies

Identifying necessary files like /etc/fstab and /dev entries.

5.2.4.1. /etc/fstab

Creating the fstab file for filesystem configuration.

5.3. Construction

Steps for installing utilities and creating configuration files.

5.3.1. Install utilities from e2fsprogs

Compiling and installing fsck and mke2fs.

5.3.2. Install utilities from util-linux

Compiling and installing mount, umount, and others.

5.3.6. Create the fstab and mtab files

Setting up filesystem configuration and tracking files.

5.3.7. Write a script to check and mount local filesystems

Creating the `local_fs` startup script.

5.3.8. Create a compressed root disk image

Compressing the updated root filesystem.

5.4. Implementation

Steps to boot and test the system with mounting capabilities.

5.4.1. System startup

Booting the system and checking startup scripts.

5.4.2. Test the local_fs script

Verifying the automated filesystem mounting script.

Chapter 6: Automating Startup & Shutdown

6.1. Analysis

Discusses improving system startup, shutdown, and manual processes.

6.2. Design

Planning to automate boot parameters, use init daemon, and implement graceful shutdown.

6.2.1. Determining necessary utilities

Identifying init daemon, shutdown, halt, reboot.

6.2.4. Designing a simple GRUB configuration file

Creating `menu.lst` for automated booting.

6.2.5. Outlining start-up scripts

Planning System V style init scripts.

6.3. Construction

Steps for creating startup scripts and configuring the system.

6.3.1. Create a GRUB configuration file

Writing the `menu.lst` file.

6.3.3. Create /etc/inittab file

Configuring the init daemon's behavior.

6.3.4. Create /etc/init.d/rc script

Creating the main runlevel script.

6.3.5. Modify /etc/init.d/local_fs script

Adapting the mounting script for start/stop.

6.3.8. Create rcN.d directories and links

Organizing startup scripts into runlevel directories.

6.4. Implementation

Steps to boot and verify automated startup/shutdown.

6.4.1. System Startup

Booting the system with automated configuration.

6.4.2. Verify success of startup scripts

Checking if filesystems are mounted and hostname is set.

6.4.3. System shutdown

Performing a graceful system shutdown.

Chapter 7: Enabling Multiple Users

7.1. Analysis

Discusses moving from single-user to multi-user mode.

7.2. Design

Planning for multi-user capability and virtual consoles.

7.2.1. The login process

Outlining the steps for user login.

7.2.3. Creating support files

Preparing necessary configuration files and device nodes.

7.2.3.1. Device nodes

Creating /dev entries for virtual consoles.

7.2.3.3. /etc/passwd

Creating a minimal passwd file for users.

7.2.3.5. Conventions

Guidelines for user/group naming and ID assignment.

7.2.4. Dependencies

Identifying libraries required for login, like libnss_files.

7.3. Construction

Steps for implementing multi-user support.

7.3.2. Modify inittab for multi-user mode

Configuring `inittab` for multiple virtual terminals.

7.3.3. Create tty devices

Creating device nodes for virtual terminals.

7.3.4. Create support files in /etc

Creating essential configuration files like `nsswitch.conf`.

7.3.6. Set directory and file permissions

Applying appropriate permissions for multi-user security.

7.3.7. Create the root disk image

Compressing the system with multi-user support.

7.4. Implementation

Steps to boot and test multi-user features.

7.4.2. Add a new user to the system

Creating a new user account and group.

Chapter 8: Filling in the Gaps

8.1. Analysis

Identifying missing commands according to FHS, like `more`, `ps`, `sed`, `ed`.

8.2. Design

Planning to add the missing commands, including a custom `more` script.

8.2.1. more

Designing a simple shell script to emulate the `more` command.

8.2.3. ps, sed & ed

Identifying sources for `ps`, `sed`, and `ed` packages.

8.3. Construction

Steps for implementing the missing utilities.

8.3.1. Write a "more" script

Creating the shell script for the `more` command.

8.3.3. Install ps

Compiling and installing the `ps` utility.

8.3.4. Install sed

Compiling and installing the `sed` utility.

8.3.5. Install ed

Compiling and installing the `ed` editor.

8.3.7. Ensure proper permissions

Setting permissions for the new utilities.

8.3.8. Create the root disk image

Compressing the system with the new utilities.

8.4.2. Test the "more" script

Using the custom `more` script with `dmesg` and `local_fs`.

8.4.3. Use ps to show running processes

Demonstrating the `ps` command.

8.4.4. Run a simple sed script

Using `sed` to modify `/etc/passwd`.

Chapter 9: Project Wrap Up

9.1. Celebrating Accomplishments

Summarizes the achievements of the project.

9.2. Planning Next Steps

Discusses future expansion possibilities for Pocket Linux.

Appendix A: Hosting Applications

A.1. Analysis

Discusses expanding Pocket Linux to run applications like mp3blaster.

A.2. Design

Planning for audio hardware support, mp3blaster space, and audio file access.

A.2.1. Support for audio hardware

Kernel and /dev configuration for sound cards.

A.2.1.1. Kernel support for audio

Building a kernel with built-in audio support.

A.2.2. Creating space for the program

Strategies for adding mp3blaster, including compressed floppies.

A.2.2.1. Mounting additional compressed floppies

Loading compressed images from floppy to ramdisk.

A.2.3. Accessing audio files

Handling audio files and potential CD-ROM support.

A.2.4. Other required files

Identifying libraries and terminfo for mp3blaster.

A.3. Construction

Steps to build the enhanced system.

A.3.1. Create an enhanced boot disk

Building a new kernel with additional hardware support.

A.3.1.1. Build a new kernel

Configuring kernel options for audio and CD-ROM.

A.3.2.2. Install the gunzip binary

Compiling and installing gunzip.

A.3.2.3. Write a startup script to mount a compressed floppy

Creating a script to load the /usr image.

A.3.3. Create a compressed /usr disk for mp3blaster

Building the /usr disk with mp3blaster.

A.3.3.1. Create a staging area

Setting up a staging directory for the /usr disk.

A.3.3.2. Install the mp3blaster program

Downloading and compiling mp3blaster.

A.3.4. Create a data diskette for testing

Creating a floppy for sample audio files.

A.4. Implementation

Steps to test the hosted application.

A.4.1. System Startup

Booting the system with the enhanced diskettes.

A.4.5. Play a sample file

Using mp3blaster to play an audio file.

Appendix B: GNU Free Documentation License

B.1. PREAMBLE

Explains the purpose and freedoms granted by the license.

B.2. APPLICABILITY AND DEFINITIONS

Defines terms and scope of the license.

B.3. VERBATIM COPYING

Conditions for copying and distributing the document verbatim.

B.5. MODIFICATIONS

Guidelines for creating and distributing modified versions.

B.6. COMBINING DOCUMENTS

Rules for combining this document with others.

B.7. COLLECTIONS OF DOCUMENTS

Procedures for creating document collections.

B.9. TRANSLATION

Guidelines for distributing translated versions.

B.10. TERMINATION

Conditions under which the license can be terminated.

B.11. FUTURE REVISIONS OF THIS LICENSE

Information on future license versions.