Building Tablet PC Applications (Pro-Developer)

The command-line interface commands available to help you install Red Hat Linux are fairly straightforward. Since Red Hat Linux is installed through a graphical interface, you don t need a lot of text commands. As you probably know, you can install Red Hat Linux without using any text commands. However, if you need a text command, it s probably critical to your installation.

Installation commands fall into four categories: preparing your hard disk, preparing a boot disk, setting up a network server, and setting up a Kickstart installation.

Preparing Your Hard Disk

You could rely on Disk Druid, as illustrated in Chapter 03 , to configure partitions on your hard disk(s). However, Disk Druid can t split existing partitions like fips can. You don t have access to Disk Druid once Linux installation is complete. And it doesn t have the same degree of control over new partitions as fdisk . Also, while parted is dangerous (changes are immediate), it does resize partitions.

Splitting Partitions

The Linux partition splitter is fips . This tool can only run from the MS-DOS command-line interface. As discussed in Chapter 02 , if you have a Microsoft Windows operating system before XP, you can run it by restarting Microsoft Windows in MS-DOS mode. Otherwise, you need an MS-DOS boot disk, or something like the Microsoft Windows 98 startup disk.

When you run fips , follow these steps:

  1. Copy fips.exe to a bootable floppy disk.

  2. Restart your computer in MS-DOS mode; an MS-DOS or Microsoft Windows 98 boot disk is good for this purpose.

  3. Run the fips.exe command from a DOS prompt. It is better if you run it from a different physical drive, such as a floppy, or the Red Hat Installation CD.

  4. The fips command should read the partitions on your hard disk. Select the partition you want to split from the partition table that appears.

  5. Specify a cylinder where you want the partition to be split.

  6. Examine and confirm or change the new partition table.

Creating New Partitions

A split partition still needs to be assigned and formatted. You can do this with Disk Druid during Red Hat Linux installation or with fdisk at any time in Linux. If you have more than one hard disk, you ll need to specify the hard disk device. The syntax is:

# fdisk [-l] [-s partition] [device]

Here are several examples:

fdisk -l    Lists the partitions on all hard disks.

fdisk -s /dev/sda1    Returns the size of the first partition on the first SCSI hard drive.

fdisk /dev/hda    Starts the fdisk utility on the first IDE hard drive.

Once at the fdisk prompt, you can run the commands shown in Table A.1.

Table A.1: Commands at the fdisk Prompt

Command

Result

a

Sets or unsets the bootable flag. You need to make at least one primary partition on one of your first two hard disks bootable.

b

Edits the label (if you have a Berkeley Standard Distribution partition).

c

Toggles the DOS compatibility flag. If you have a problem reading partitions, turn this off; it sometimes causes problems with the borders of a partition.

d

Deletes a partition. Before a partition is actually deleted, you need to select the partition number.

l

Lists known partition types. Over 100 different partition types are available.

m

Shows available fdisk commands.

n

Configures a new partition.

p

Lists the current partition table.

q

Exits fdisk without saving changes.

t

Allows you to change the partition system ID. You ll also need the partition number and the ID of the partition type you want, based on the known partition types (which you can find with the l command).

u

Toggles the display size of partitions between sectors and cylinders .

v

Verifies the current partition table.

w

Writes your changes and exits from fdisk . No changes are written to the partition table until you execute this command.

Creating or Resizing Partitions

There s a more flexible but in my opinion dangerous GNU tool known as parted . It works in a similar fashion to fdisk but can do more. The syntax is simple; the following command opens the second IDE hard disk for editing. If you don t specify a hard disk, parted opens the first available hard disk by default.

# parted /dev/hdb

It is worth restating that this is a dangerous command; once you run some of the options, you may erase all of the data on a partition or an entire hard disk. In addition, while you can format a hard disk partition with parted , you can only format to ext2; parted ext3 formatting is not available as of this writing.

Once at the (parted) prompt, you can run the commands shown in Table A.2.

Table A.2: Commands at the parted Prompt

Command

Result

check number

Runs a basic filesystem check on the specified partition number . For a list of partition numbers , run the print command.

cp device fr-number to-number

Copies a filesystem on a specified device such as /dev/sda from a partition number ( fr-number ) to a different partition ( to-number ). Not yet an active option (as of this writing).

help

Prints a list of available commands.

mklabel label

Overwrites an entire hard disk with a label type such as bsd, loop, mac, or msdos. A dangerous command.

mkfs number format

Formats the specified partition; ext3 formats are not yet supported.

mkpart type format start end

Creates a new partition, of type primary, logical, or extended, of a specified format , with a start and end in MB. The format option does not work as of this writing.

mkpart type format start end

Creates a new partition, of type primary, logical, or extended, of a specified format , with a start and end in MB.

move number start end

Moves the specified partition to a new location on the drive, with a start and end in MB.

print

Displays the current partition table.

quit

Exits parted .

resize number start end

Resizes the specified partition with a start and end in MB.

rm number

Removes the specified partition.

select device

Points parted at a different device, such as /dev/sda .

Preparing a Boot Disk

Three basic commands are available that let you copy the contents of a Red Hat Linux image file onto a floppy disk. Two are usable in Linux; the other is designed for Microsoft operating systems.

Creating a Boot Disk in a Microsoft OS

The rawrite command copies the contents of an image file, such as boot.img , to a floppy disk. The standard approach is to go into MS-DOS mode and run the rawrite command. Assuming rawrite is on the dosutils subdirectory of your D: drive, you re prompted with the following commands:

D:\> \dosutils\rawrite Enter disk image source file name: d:\images\boot.img Enter target diskette drive: a Please insert a formatted diskette into drive A: and press -ENTER-:

Alternatively, on the first Red Hat Linux installation CD, there is a \dosutils\rawritewin\ rawwritewin.exe command that provides a GUI for the same purpose. It opens the RawWrite window shown in Figure A.1.

Figure A.1: RawWrite for Windows      

In Linux, it s common to use the dd command to convert an image file like boot.img to a floppy disk. For example, the following command copies the files from boot.img to the first floppy drive device on your system:

# dd if=/mnt/cdrom/images/bootdisk.img of=/dev/fd0

However, Linux understands the format of an image file. So you can just read it directly to the floppy drive device with a command like the following:

# cat /mnt/cdrom/images/bootdisk.img > /dev/fd0

Setting Up a Network Server

It s possible to set up an FTP, NFS, or HTTP network server with the Red Hat Linux installation files and packages. For details of this process, read Chapter 04 . But in any of these cases, you ll want to copy the files from all Red Hat Linux installation CDs to a shared directory, such as /mnt/source . Once a Red Hat Linux installation CD is mounted, copy its files with the following command:

# cp -ar /mnt/cdrom/RedHat /mnt/source

Setting Up a Kickstart Installation

The details of setting up a Kickstart installation are covered in Chapter 05 . To summarize, there s already a Kickstart file available; the settings that correspond to how you installed Red Hat Linux are stored in the /root directory in anaconda-ks.cfg . You can modify this file to meet your needs on another computer; remember to activate the partition commands, which are commented out by default.

The easiest way to set up a Kickstart installation is to copy the desired file as ks.cfg on a boot floppy. At the Red Hat Linux installation prompt, enter this command:

boot: linux ks=floppy

 

Категории