• No results found

Manipulating Boot Time Parameters

The Linux kernel is a program just like any other program (well, maybe that’s a bit of oversimplifica- tion): It has a command line, and you can specify options and parameters to the kernel when you boot your system.

Each time you boot your system, the boot loader pauses for a moment at the boot selection screen — you usually hit Enter (or just wait for the built-in timer to expire) when you see the selection screen, and your computer happily boots the Linux kernel using the default boot parameters. Linux can do a lot more.

If you’re running Fedora Linux, press the A key while the boot selection screen is displayed to modify the

TABLE23-1: FEDORABOOT-LINEPARAMETERS

To Do This Make This Change to the Timesaving Bonus Info Default Linux Command Line

View detailed boot Remove the rhgb(Red Hat Removing rhgbsaves a little bit of boot time, and you messages (Fedora only). Graphical Boot) from the have a better starting point if you have to investigate a

end of the command line. boot problem. 29_571737c23.qxd 7/2/04 9:04 PM Page 154

Manipulating Boot Time Parameters

155

To Do This Make This Change to the Timesaving Bonus Info Default Linux Command Line

View detailed boot Remove splash=silentfrom Enabling detailed boot messages can help you pinpoint messages (SuSE or the command line. the cause of a boot problem.

Mandrake).

Make a menu of screen size Add the vga=askoption to the Choose a larger screen resolution to fit more text on the options appear when you end of the command line. screen. If you like a certain text size, you can make the boot. For example: change permanent by changing the menu.lstfile in the

grub append> ro root= /boot/grubdirectory. To do so, open the file with your LABEL=/ rhgb vga=ask favorite text editor and append your changes to the line starting with the word kernel. Save the file when you’re finished, and next time you boot, the changes take effect. Be careful when you change this file because it’s easy to make your system hard to boot.

Include more details in the Add the word debugto the If you’re having problems booting, this is a quick way boot process as the system command line. to find the problem.

boots. For example:

grub append> ro root= LABEL=/ rhgb debug

If you don’t use any USB Add the no usbcommand. You may gain a bit of CPU performance. Warning:Make devices, you can turn off For example: sure you don’t depend on USB devices (like mice) the USB device modules. grub append> ro root= before you disable this module.

LABEL=/ rhgb no usb

Turn off power- Add the acpi=offcommand You may want to do this if your laptop powers off management to the GRUB command line. intermittently or has battery problems (even when it’s

control features. For example: plugged in).

grub append> ro root= LABEL=/ rhgb acpi=off

Boot into a runlevel other Add the runlevel (1–5) to the Server machines typically don’t need a graphical environ- than the default. end of the command line. ment most of the time (why run X Windows on a mail or

For example: Web server?). Specify the runlevel on the command grub append> ro root= line if you need to do system maintenance work and want a LABEL=/ 5 friendly desktop environment. See Technique 22 for more

information about runlevels.

Boot into single-user mode Add an Sto the end of the This is incredibly handy if you forget the rootpassword. without a password. command line. When you’re at the command line, you can change the

For example: rootpassword with the command sh-2.05b# passwd. grub append> ro root= Enter a new password and confirm the new password when LABEL=/ rhgb S prompted. When you’re finished, type the command

sh-2.05b# rebootto reboot the system so you can log in with your newly assigned password. Warning:Anyone can use the Soption. Be sure you know who has physical access to your computer because with this tidbit of knowl- edge, anyone can bypass the rootpassword.

(continued)

Technique 23: Taking Good Care of Your Kernel

156

TABLE23-1 (continued)

To Do This Make This Change to the Timesaving Bonus Info Default Linux Command Line

Boot into emergency repair Add the word emergencyto the Boot into emergency mode if you discover a problem mode. end of the command line. that prevents you from booting into single-user (or multi-

For example: user) mode. When you boot into emergency mode, Linux grub append> ro root= does not run any of the normal startup scripts — you’re LABEL=/ emergency dumped at a command line, and you’re ready to fix what-

ever it is that’s gone wrong. 29_571737c23.qxd 7/2/04 9:04 PM Page 156

24

Creating a Custom

Kernel

F

edora is a collection of applications, daemons, and drivers with a Linux kernel at the core. The kernel deals with hardware and pro- vides basic functions such as creating processes, managing privi- leges, and managing file systems.

In most cases, you don’t need to build your own kernel — plenty of well- configured kernels are available for use. You may need features that aren’t currently supported by the kernel included in the most recent Fedora release. You may want to

Add support for unusual hardware — USB scanners, cameras, joy- sticks, and sound cards.

Use additional encryption features that aren’t part of the standard Fedora kernel.

Explore alternative file systems.

Omit drivers for devices you may never have.

Omit amateur radio support — unless you’re really into amateur radio.

Many kernel features are included in the form of modules— chunks of code that are not loaded until you actually use the features. Modules don’t take up a lot of space if you don’t use them, but removing the unused mod- ules will save you time when you’re rebuilding the kernel. You can also gain some security by omitting modules that you don’t need.

In this technique, we show you how to build a kernel customized for your needs, based on a safe and sound prototype, and with all the drivers that you need to get your work done quickly.

Technique

Save Time By

Building a custom kernel that suits your needs

Adding the kernel source code and dependencies in one easy step with the Package Manager

Adding device drivers or new file systems to your kernel

Technique 24: Creating a Custom Kernel

158

Step 1: Making an Emergency

Plan, or Boot Disk

Before building a custom kernel, you need to make a boot disk. A boot disk gives you a way back into your system in a kernel emergency. If you’re running Mandrake or SuSE Linux, you can also create a res- cue disk. A rescue disk is similar to a boot disk, but it also contains diagnostics that can tell you a little more about your computer if you run into boot prob- lems. The process of creating a boot (or rescue) disk varies by distribution.

To make a boot disk on a Fedora or Mandrake com- puter, follow these steps:

1.

Insert a floppy disk in your drive, open the ter- minal window, and give yourself superuser privileges.

2.

Type the following command: # /sbin/mkbootdisk `uname -r`

After some whirring and clicking, your floppy is bootable.

3.

To test the floppy (a good idea), shut down completely and restart.

To make a rescue disk on a Mandrake system, follow this procedure:

1.

Insert a floppy disk in your drive, open the ter- minal window, and give yourself superuser privileges.

2.

Type the following command and press Enter: # /sbin/mkrescue

3.

To test the floppy (a good idea), shut down completely and restart.

If you’re running SuSE Linux, use the YaST control center to create a boot disk or a rescue disk (or both):

1.

Open the main menu and choose SystemYaST.

Reconfiguring Your Kernel —

Ready, Set, Go!

The kernel that’s included with the Fedora release is a well-functioning and stable piece of software — versatile, dependable, and sturdy. But what if it doesn’t include the functionality you need?

No problem — you can just rebuild it. Stick with us, and we’ll show you how to make it bigger, better, and stronger . . . whatever you need.

The process of rebuilding your kernel involves sev- eral steps, and each step is covered in the following sections. Here’s an overview of the process:

1.

Make a boot disk.

2.

Find the source code.

3.

Configure the new kernel.

4.

Customize the kernel.

5.

And, finally, build the kernel.

Related documents