Installing Gentoo Linux - Computer Engineering Technology
Transcription
Installing Gentoo Linux - Computer Engineering Technology
v1.81 Installing Gentoo Linux Installing Gentoo Linux by Ted Kosan Copyright © 20012 by Ted Kosan This work is licensed under the Creative Commons AttributionNonCommercial-NoDerivs 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ 1/124 v1.81 Installing Gentoo Linux 2/124 Table of Contents Installing Gentoo Linux.............................................................................................................................1 1 Why bother to manually install an operating system?...........................................................................4 2 Which operating system to install?........................................................................................................4 3 The Parts Of An Operating System........................................................................................................5 4 The GNU/Linux operating system.........................................................................................................6 5 What is a GNU/Linux distribution?.......................................................................................................7 6 Gentoo GNU/Linux, a good distribution for our purposes....................................................................8 7 Obtain an IBM PC compatible computer to install Gentoo Linux on....................................................8 8 Download the minimal install .iso image, check it, and then burn it on a CD.....................................10 9 Boot your computer with the CD.........................................................................................................11 9.1 Your computer must be plugged into an Ethernet network that is attached to the Internet for these instructions to work..................................................................................................................................11 10 Exploring the copy of Gentoo Linux that is on the CD itself............................................................19 11 Testing the network connection.........................................................................................................19 12 Exploring the CD's filesystem............................................................................................................21 13 Managing storage device complexity.................................................................................................28 14 Abstraction.........................................................................................................................................28 15 Interfaces............................................................................................................................................29 16 Different types of devices can provide the same abstract interface...................................................30 17 Block devices and character devices are abstract interfaces..............................................................31 18 All devices are bound to names in the /dev directory........................................................................32 19 Partitioning the main storage device..................................................................................................34 20 Placing filesystems on the partitions..................................................................................................44 21 Mounting the boot and root partitions................................................................................................47 22 Setting the system's date and time......................................................................................................50 23 Preparing to extract the standard Gentoo directory hierarchy into the /dev/sda3 top-level root partition....................................................................................................................................................51 24 Extracting the standard Gentoo directory hierarchy into the /dev/sda3 top-level root partition........54 25 Downloading and extracting the portage tree....................................................................................56 26 Changing the top-level root directory from the CD to the /dev/sda3 root partition...........................60 27 Terminals and shells: interfaces to the operating system...................................................................66 28 Customizing the shell that is being used by the default terminal emulator.......................................71 29 The nano text editor...........................................................................................................................74 30 USE flags...........................................................................................................................................78 31 The /etc/make.conf file.......................................................................................................................79 32 Emerging the kernel's source code.....................................................................................................80 33 Configuring the kernel......................................................................................................................84 34 How to select kernel options..............................................................................................................90 35 Selecting your CPU's processor family.............................................................................................92 36 Selecting the IDE device driver.........................................................................................................92 37 Selecting the SCSI device drivers (VirtialBox users should skip this section)..................................96 38 Selecting the Ethernet network chip driver........................................................................................99 39 Selecting the device driver for the video card..................................................................................102 v1.81 Installing Gentoo Linux 3/124 40 Selecting the device driver for the sound card ................................................................................103 41 Selecting the ext3 filesystem option................................................................................................106 42 Saving the kernel configuration file and viewing it.........................................................................108 43 Compiling the kernel........................................................................................................................109 44 Configuring the system....................................................................................................................112 45 Configuring the /etc/fstab file..........................................................................................................112 46 Configuring the network..................................................................................................................114 47 Services and the network service.....................................................................................................115 48 Emerging the DHCP client..............................................................................................................116 49 Installing additional services............................................................................................................116 50 Installing and configuring the bootloader........................................................................................116 51 Setting the root password and adding a user account......................................................................118 52 Rebooting the machine.....................................................................................................................120 Shutting Down VirtualBox Before Installation Is Complete.................................................................122 1 Shutting Down Before chroot Is Executed........................................................................................122 1.1 If you need to shutdown the virtual machine before the chroot command was executed, here is what you need to type:...........................................................................................................................122 2 Shutting Down After chroot Is Executed...........................................................................................122 2.1 If you need to shutdown the virtual machine after the chroot command was executed, here is what you need to type:....................................................................................................................................122 ====.......................................................................................................................................................122 Howto Access via ssh a Virtualbox Guest machine..........................................................................122 Installing Gentoo Linux v1.81 1 2 3 4 5 6 7 8 9 10 11 4/124 1 Why bother to manually install an operating system? 1.1 This document will guide you through manually installing an operating system. You might ask yourself "why bother to manually install an operating system when it is much easier to install one automatically with a CD?" Manually installing an operating system does take a great deal of time and effort. For people who just want to use a computer as a tool, automatically installing an operating system is usually the best choice. However, if you have a deeper interest in computers beyond just using them as tools, then the knowledge you will gain from manually installing an operating system will be very valuable. 2 Which operating system to install? 12 13 14 15 16 17 18 19 20 21 22 23 2.1 After you have made the decision to manually install an operating system, the next decision to make is which one to install? Since the most widely available kind of computer today is the IBM PC compatible computer, selecting an operating system that runs on this type of computer is a good choice. Another thing to consider is that some operating systems are proprietary while others are free (with free here meaning one does not need to pay for them). Some free operating systems also have an open source license which means that the source code for the operating system can be viewed, used, and modified by anyone who agrees to the license. If your goal is to learn as much about an operating system as possible, my opinion is that the best kind of operating system to work with is a no-cost one that has a widely-used open source license. 24 25 2.2 Here is a list of the most popular operating systems that currently run on IBM PC compatible computers: 26 27 28 29 30 31 32 33 34 35 - Microsoft DOS. FreeDOS. Microsoft Windows. Mac OS X. FreeBSD (Berkley Standard Distribution). Solaris. GNU/Linux. 2.3 Of these operating systems, both versions of DOS are obsolete for most purposes and not much knowledge would be gained by installing them. All of Microsoft's operating systems are proprietary and closed source which Installing Gentoo Linux v1.81 36 37 38 39 40 41 42 5/124 limits their effectiveness for learning about operating systems. FreeBSD, Solaris, and GNU/Linux are all no-cost open source operating systems that are suitable for learning about operating systems. In this document we will focus on GNU/Linux. 3 The Parts Of An Operating System 3.1 Operating systems for PC and server class computers usually consist of the parts shown in Figure 1. Figure 1 Application Programs System Utility Programs Operating System Kernel Computer System Device Drivers Hardware 43 44 45 46 47 48 49 50 3.2 The kernel is the core part of an operating system and it is actively running in the computer's memory map while the computer is on. It controls and coordinates almost all of the resources in the computer and the computer would cease to function if the kernel was removed. The kernel accesses the computer's hardware through special programs called device drivers and each piece of hardware needs to have a device driver written for it before the kernel can access it. Examples of hardware that need device drivers before the kernel can access them include the following: 51 - Keyboard. 52 - Hard Drive. 53 - CDROM Drive. 54 - Video Card. 55 - Sound Card. v1.81 Installing Gentoo Linux 6/124 56 57 58 59 60 61 3.3 The kernel of an operating system provides the core functionality of a computer, but deep software and operating systems knowledge is needed to access this functionality and the access techniques are tedious. In order to make the operating system easier to use, system utility programs are included with it that access the kernel and then make its resources available to other utility programs and application programs. 62 63 64 65 3.4 A significant amount of the effort that is needed to manually install an operating system consists of installing its system utility programs, selecting which device drivers are needed for the computer's hardware, and configuring the kernel. 66 4 The GNU/Linux operating system 67 68 69 70 71 72 73 74 75 4.1 In order to understand what GNU/Linux is, one must first understand a little bit about UNIX because GNU/Linux is modeled after UNIX. UNIX is an operating system that was developed for mainframe and minicomputers in the 1960s and 1970s at AT&T Bell Laboratories. AT&T licensed UNIX to universities, governments, and companies throughout the 1970s and the license included access to the operating system's source code, which was mostly written in the C programming language. A number of UNIX versions were created by companies and universities throughout the 1970s and 1980s and it became widely adopted. 76 77 78 79 80 4.2 In 1983, Richard Stallman announced the GNU project and one of its goals was to create a UNIX-like operating system which consisted of 100% open source software. By the early 1990s, the GNU project had succeeded in creating most of the software needed for an operating system, except a kernel and device drivers. 81 82 83 84 85 86 87 88 89 90 91 92 4.3 In 1991 Linus Torvalds, a student at the University of Finland, wanted an open source version of UNIX that would run on standard personal computers. Since one did not exist at the time, he decided to start a project to create one and he used the communications capabilities of the Internet to invite people from all over the world to help him. The project started by developing a kernel called "Freax" which stood for "free UNIX". The person who maintained the FTP server that the Freax software was placed on created a directory for it called "Linux" and the kernel became known as "Linux" soon afterwards. Instead of creating a kernel and all of the system utility software for it, the Linux developers decided to adapt their kernel to the already existing GNU systems software thereby creating the GNU/Linux open source operating system. Figure 2 shows the relationship between the Installing Gentoo Linux v1.81 93 7/124 GNU software and the Linux kernel. Figure 2 Application Programs System Utility Programs GNU Kernel Linux Kernel Device Drivers Hardware 94 5 What is a GNU/Linux distribution? 95 96 97 98 99 100 101 102 103 104 105 106 5.1 The source code needed to build a GNU/Linux system exists on numerous servers on the Internet and these servers are located throughout the world. Before a GNU/Linux system can be built, copies of this source code need to be brought into one place, compiled, configured, and then tested. While it is possible for an individual to do this, it takes a significant amount of skill and experience to accomplish. GNU/Linux distributions were created to help solve this problem. A GNU/Linux distribution is usually put together by a group of experienced developers who copy the source code needed to create a GNU/Linux distribution into one place, compile and configure it, and then make the result available to others. There are numerous GNU/Linux distributions available and new ones are being created all the time. Some distributions are cost-free while others are commercial. 107 5.2 The following is a list of the more popular GNU/Linux distributions: 108 - Debian. 109 - Fedora. 110 - Gentoo. 111 - Knoppix. 112 - Linspire. 113 - LFS (Linux From Scratch). 114 - Red Hat Enterprise. 115 - SUSE. 116 - Ubuntu. Installing Gentoo Linux v1.81 117 118 8/124 - Mint. 6 Gentoo GNU/Linux, a good distribution for our purposes 119 120 121 122 123 124 6.1 Of the GNU/Linux distributions listed in the previous section, LFS is too difficult to install for a first-time GNU/Linux user and the rest of the distributions except Gentoo are too easy to install. I have found that Gentoo GNU/Linux (or Gentoo Linux for short) is easier to install than LFS but difficult enough so that one learns a great deal during the installation process. 125 126 6.2 Here is the URL for the Gentoo Linux main website. Look through the website and then continue reading: 127 128 129 130 131 132 133 134 135 136 137 138 139 140 http://gentoo.org 6.3 The normal way that a beginner learns how to install Gentoo Linux is by reading the Gentoo Installation Manual and following the step-by-step instructions that are contained there. The Installation Manual, however, assumes that the user has a mid-level computer background and it leaves out information that a beginner would find useful. This document covers much of the same material that the Gentoo Installation Manual does, but it moves slower through the installation process and contains more detailed explanations. 7 Obtain an IBM PC compatible computer to install Gentoo Linux on 7.1 Since IBM PC compatible computers are the most common type of computer, this document focuses on installing Gentoo Linux on these type of machines. The machine you select should have the following minimum requirements: 141 - i686 CPU. 142 - 348MB of RAM. 143 - 8GB hard drive. 144 - CDROM drive. 145 146 147 7.2 As an alternative, you can use a virtual machine that emulates an x86-based PC (recommended). 7.2.1 If you choose this route, you must first download VirtualBox and v1.81 148 149 Installing Gentoo Linux 9/124 install it (http://www.virtualbox.org). After VirtualBox has been installed, your next step is to create a virtual machine using the following steps: 150 151 7.2.1.1 Select "Machine -> New" to launch the New Virtual Machine Wizard. 152 7.2.1.2 Press the "Next" button. 153 154 7.2.1.3 Give the machine a name (like gentoo_kosan_1) and select "Linux 2.6" as the OS Type. 155 7.2.1.4 Press the "Next" button to go to the "Memory" dialog. 156 7.2.1.5 Set the machine's RAM to 1024 MB. 157 7.2.1.6 Press the "Next" button to go to the "Virtual Hard Disk" dialog. 158 7.2.1.7 Select "New" to create a new Boot Hard Disk. 159 7.2.1.8 Select "Next" to go to the "Virtual Disk Image Type dialog. 160 161 7.2.1.9 Keep the default selection of Image Type (which is "Dynamically expanding image.". 162 163 7.2.1.10 Select "Next" to go to the "Virtual Disk Location and Size" dialog. 164 165 7.2.1.11 Keep the default "Image File Name" and set the image size to 21 GB. 166 167 7.2.1.12 Press "Next" to go to the "Summary" dialog and then press "Finish". 168 169 170 7.2.1.13 You should now be back to the "Virtual Hard Disk" dialog. Press "Next" to go to the "Create New Virtual Machine Summary" and verify your selections. 171 7.2.1.14 Press "Finish". 172 7.2.1.15 You should now be back at the "VirutalBox OSE" window. 173 174 7.2.2 If you need to shutdown VirtualBox before gentoo is installed on the hard drive, see appendix A. v1.81 Installing Gentoo Linux 10/124 175 176 8 Download the minimal install .iso image, check it, and then burn it on a CD 177 178 179 180 181 8.1 Many GNU/Linux distributions enable the user to download a .iso file that contains a bootable software image that can be burned onto a CDROM. After the image has been burned on the CDROM, the CDROM can be used to boot the machine into a GNU/Linux environment and then this environment can be used to install GNU/Linux on a hard drive. 182 183 184 185 8.2 The latest Gentoo Linux bootable image for x86-based PCs is called install-x86-minimal-xxx.iso (xxx represents a date number such as 20110315. You must use a browser to view the 206.21.94.61/gentoo directory to determine what the actual filename is.). 186 8.3 Download the .iso file. 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 8.3.1 Obtain the file install-x86-minimal-xxx.iso from http://206.21.94.61/gentoo . This is the file that you will be burning onto a CD. You have a problem, though. What if the file is corrupted? It would not be good to spend time burning the file onto a CD, booting a computer with it, getting half way through the installation process, and then discovering that a part of the file was corrupted. Most files that are downloaded from the Internet are checked to make sure they are not corrupted by using a hash algorithm. 8.4 Check the .iso file with a hash algorithm. 8.4.1 A program that implements a hash algorithm scans every byte in a file and generates a number that is sometimes called the digital fingerprint or message digest of the file. As long as the bytes in the file do not change, each time a given hash algorithm is run on a file the same message digest number is generated. A popular hash algorithm is called MD5 and here is an example MD5 message digest for the install-x86minimal-xxx.iso file: 1e75c6830cefff313fcef4320e3b5d0e 204 205 206 207 208 8.4.2 This number is in hexadecimal (or base 16) format and this format is widely used with computers. Before a given file is made accessible on the Internet, a hash algorithm is run on it and a message digest number is generated. This digest number is put into a separate small file and then both the main file and the message digest file are placed on the Internet. 209 8.4.3 When a user wants to obtain a copy of the main file, both the main file v1.81 Installing Gentoo Linux 11/124 210 211 212 213 214 215 and its digest file are downloaded to the user's computer. The user then runs a program that uses the same hash algorithm as the original one used on the main file. The message digest number that is generated is then compared to the number that is in the separate small file. If the numbers match, then the main file is not corrupted but if they do not match, it is corrupted and it must be downloaded again. 216 217 218 219 8.4.4 If you are using the Windows operating system, download the md5sum.exe program from the server at http://206.21.94.61/gentoo/ and use it to generate a message digest for the install-x86-minimal-xxx.iso file you downloaded. 220 221 222 8.4.5 Download the install-x86-minimal-xxx.iso.DIGESTS file from the server, open it and if the MD5 message digest numbers match, your file is not corrupted. 223 224 225 226 8.4.6 If you will be installing Gentoo on a physical PC, burn the .iso file into a CD. If you are using the VirtualBox virtual machine, you do not need to burn the .iso file onto a CD. Instead, just remember where you placed it on your hard drive so you can tell VirtualBox where to find it. 227 9 Boot your computer with the CD 228 229 9.1 Your computer must be plugged into an Ethernet network that is attached to the Internet for these instructions to work. 230 231 232 233 234 9.2 Turn on your machine and enter the setup utility (usually by pressing <F2>, <F10>, or <Del>) to make sure it is configured to have the CDROM drive as the first boot device. Place the install CD into the CDROM drive and then boot the computer with it. For people that are using VirtualBox, launch the VirtualBox and then do the following: 235 236 9.2.1 From the "VirtualBox OSE" window, Press the "Settings" button, which is the one with the icon of a gear on it. 237 9.2.2 Select "Storage" from the list on the left side of the dialog. 238 9.2.3 Select "Mount CD/DVD Drive". 239 9.2.4 Select the "Empty" icon of a CD under the IDE controller. 240 241 9.2.5 Select the small icon of a folder which is to the right of the "CD/DVD" text. v1.81 Installing Gentoo Linux 12/124 242 9.2.6 Select the "Add" button. 243 244 9.2.7 Use the dialog that is shown to locate and select the .iso file you downloaded earlier. 245 246 9.2.8 Select the "Select" button and you should be sent back to the main "VirutalBox OSE" window. 247 9.2.9 Select the "Ok" button. 248 9.2.10 Select the "Start" button to launch the virtual machine. 249 250 251 252 9.3 When your machine boots from the install CD or image, the first screen it shows should be similar to the following (Note: click inside the black window and press your <space> key once as soon as the boot: prompt appears or the boot process will start before you are ready for it to.): 253 254 255 9.4 The CD will wait for input from the user for a short while and, if no input it given, it will boot the machine using the default configuration. If you press the F1 key, a list of kernels that are available on the CD is shown. v1.81 Installing Gentoo Linux 13/124 256 257 258 259 260 9.5 The kernel named gentoo is the default kernel and the one named gentoo-nofb is a kernel that does not use the frame buffer to switch into graphics mode when it boots. In a moment we will boot the computer using the gentoo-nofb kernel to make it easier to read the information that is displayed when the system is booting. 261 9.6 If you press the F2 key, the following options screen is shown: v1.81 262 263 264 265 266 Installing Gentoo Linux 14/124 9.7 You can press the F3 -F7 keys to read about the options that are available during the boot process. After you are done reading about the options, type gentoo-nofb at the boot: prompt (which is shown next) and the system will begin to boot the copy of Gentoo Linux which is on the CD. v1.81 267 268 269 270 271 272 273 274 Installing Gentoo Linux 15/124 9.8 As Gentoo Linux boots, it is going to show the details of the boot process on the screen. As each part of the operating system is loaded into memory and initialized, it prints a message on the screen which indicates whether it was successfully loaded or not. It may also print information about the hardware it is responsible for, such as the speed of the system's processor or the amount of RAM that it has. The following screen shot shows both of these pieces of information. Can you locate them on the following screen capture? v1.81 275 276 277 278 279 Installing Gentoo Linux 16/124 9.9 A little bit later in the boot process, the CD scans the system to see what the make and model are for the various pieces of hardware in the system and then it loads the device drivers that match this hardware. Device drivers in Linux are often loaded as kernel modules and the following screen shows kernel modules being loaded into RAM: v1.81 Installing Gentoo Linux 17/124 280 281 9.10 When you are asked for which keyboard keymap to select, hitting Enter will select the default mapping which is the US English keymap: 282 283 284 285 286 287 288 289 9.11 Towards the end of the boot process, the CPU is detected, the mouse driver is attached to /dev/input/mice (make a note of this), the main network device is found (usually eth0), and a DHCP (Dynamic Host Configuration Protocol) request is sent to the local network asking for local configuration information. The sound card and video card are then located and finally, a login password is randomly generated so that someone else on the network cannot log into your machine without you knowing about it. These steps can be seen in the following screen shot: v1.81 Installing Gentoo Linux 18/124 290 291 292 293 294 295 296 9.12 The last part of the boot process provides information that describes options that the user may want to explore. One of these options is to launch the ssh server which will permit the user to remotely log into the current machine from another machine on the network. This is useful if the user wants to leave the current machine running at one location (like school) and work through the installation process from another location (like home). For now, though, we will proceed by working right at the machine. 297 9.13 This last screen shot shows the end of the boot process: v1.81 298 Installing Gentoo Linux 19/124 10 Exploring the copy of Gentoo Linux that is on the CD itself 299 300 301 302 303 304 305 10.1 The way that the minimal install CD works is that it boots the machine into the copy of Gentoo Linux that came on the CD itself and then the user enters this environment and uses it to install Gentoo Linux on the system's hard drive. After Gentoo Linux has been successfully installed on the hard drive, the CD is removed, the system is rebooted and the copy of Gentoo that was placed on the hard drive is then used to boot the system from then on. 306 307 308 10.2 Before starting the installation of Gentoo Linux on the system's hard drive, we are going to explore the CD's copy of Gentoo Linux in order to gain a better understanding of the Gentoo Linux environment. 309 310 311 312 313 314 11 Testing the network connection 11.1.1 The first thing I want you to do is to enter the command ifconfig at the command prompt. The ifconfig command is used to configure the system's network interfaces, but it will also show the current configuration of each network interface if it is entered without any additional options. Installing Gentoo Linux v1.81 315 livecd root # ifconfig 316 317 318 319 320 321 322 323 324 eth0 Link encap:Ethernet HWaddr 00:0C:29:92:EB:79 inet addr:10.0.1.8 Bcast:10.0.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe92:eb79/64 Scope:Link UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1 RX packets:79 errors:0 dropped:0 overruns:0 frame:0 TX packets:65 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:11121 (10.8 Kb) TX bytes:11270 (11.0 Kb) Interrupt:17 Base address:0x1400 325 326 327 328 329 330 331 332 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) 20/124 333 334 335 336 11.1.1.1 If your machine does not have a valid IP address , make sure the machine is properly connected to the network. Now, execute the following command: net-setup eth0 and configure your machine to use a wired network and DHCP. 337 338 11.1.1.2 After this command is finished executing, check to make sure you have a valid IP address again using the ifconfig command. 339 340 341 342 343 344 345 346 347 348 349 11.1.2 The output of the ifconfig command executed above shows that this machine has 2 network interfaces attached to it which are called eth0 and lo. The eth0 interface is usually bound to an Ethernet network device and it is also usually the system's main network connection. Ethernet is the most popular networking technology for connecting PCs to networks and it is likely that your PC is attached to a network using Ethernet too. The DHCP request that was sent to the network while the system was booting received a response that configured this machine with IP address 10.0.1.8. Your machine should also have been configured with an address from your network (Note: your address will most likely be different than 10.0.1.8). 350 351 352 353 354 11.1.3 The lo interface is attached to what is called a loopback network, which is a simulated network local to the machine itself. The lo interface is used for testing purposes and for allowing different applications on the machine to communicate with each other even when the machine is not attached to an actual network. Most lo interfaces are given IP address Installing Gentoo Linux v1.81 355 356 21/124 127.0.0.1. 12 Exploring the CD's filesystem 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 12.1.1 The next aspect of the CD's version of Gentoo Linux we are going to explore is its filesystem. A file is a sequence of numbers that are associated with each other. A filename is the name that is given to a file so that the file can be referred to. A filesystem is a system for organizing a storage device (like a hard drive, flash drive or CDROM drive) so that files can be stored on it. Most computers use an hierarchal filesystem which means that the filesystem can contain directories. Directories, which are also called folders in GUIs, are containers that can hold both files and other directories. A directory that is inside of another directory is called a subdirectory and the top-level directory in an hierarchal filesystem is called the root directory (most UNIX-like systems also have a subdirectory in the top-level root directory which is named "root". Even though they have the same name, they are different directories and the purpose of the root subdirectory will be explained later). 372 12.1.2 Issue the following commands: 373 livecd root # cd / 374 375 livecd / # pwd / 376 377 378 379 380 381 382 383 384 385 386 12.1.3 The top-level directory in a Linux system is always given the forward slash symbol (/) as its name. The cd command stands for Change Directory and it allows the user to change from the current working directory to another directory. The new directory is now the working directory, which means it is the directory we are currently working in. The cd / command issued above changed us into the top-level root directory. The pwd command stands for Print Working Directory and it shows which directory we are currently in. When the above pwd command was issued, it indicated that we were now in the / directory. Notice also that the command prompt changed from "livecd root #" to "livecd / #". 387 388 389 390 391 12.1.4 A command prompt is used in a command line interface (CLI) to inform the user that it is ready to accept typed input. Most command prompts can be configured to provide useful information to the user and the one we are working with has been configured to show the name of the working directory. You might be wondering why the prompt had the Installing Gentoo Linux v1.81 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 22/124 working directory name change from root to / and this will be explained shortly. 12.1.5 Now that we are in the top-level root directory, issue the ls command (the 'l' is a lower case L, not a number one): livecd / # ls bin dev home boot etc initrd lib mnt opt proc root sbin sys tmp usr var 12.1.6 The ls command stands for List directory and it shows the contents of the working directory. A directory can contain files or subdirectories and a subdirectory is simply a directory that is inside of another directory. Most of the names that the above ls command listed are the names of the standard subdirectories that are present in the root directory of most Gentoo Linux systems. Figure 3 shows the upper levels of this filesystem along with some of the subdirectories inside of the etc and mnt directories that we will be working with soon. Figure 3 / bin dev etc conf.d 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 home lib opt mnt sys proc boot root usr sbin tmp var init.d cdrom gentoo livecd 12.1.7 You may be wondering how to tell the difference between the names of files and the names of directories when the ls command is executed. If the -l option (which is a lower case L and stands for long listing) is passed to the ls command, it will add extra information to the listing that will indicate this: livecd / # ls -l total 0 lrwxrwxrwx 1 root root 15 Jan 20 19:55 bin -> /mnt/livecd/bin lrwxrwxrwx 1 root root 16 Jan 20 19:55 boot -> /mnt/livecd/boot drwxr-xr-x 15 root root 3120 Jan 20 19:55 dev drwxr-xr-x 49 root root 2120 Jan 20 19:58 etc drwxr-xr-x 2 root root 60 Aug 30 17:04 home drwxr-xr-x 2 root root 40 Jan 20 19:55 initrd lrwxrwxrwx 1 root root 15 Jan 20 19:55 lib -> /mnt/livecd/lib drwxr-xr-x 5 root root 100 Jan 20 19:54 mnt Installing Gentoo Linux v1.81 422 423 424 425 426 427 428 429 lrwxrwxrwx 1 root root dr-xr-xr-x 54 root root drwx------ 4 root root lrwxrwxrwx 1 root root drwxr-xr-x 11 root root drwxrwxrwt 5 root root lrwxrwxrwx 1 root root drwxr-xr-x 12 root root 15 0 140 16 0 100 15 240 Jan Jan Sep Jan Jan Jan Jan Sep 20 20 18 20 20 20 20 18 19:55 19:54 01:43 19:55 19:54 19:55 19:55 01:43 23/124 opt -> /mnt/livecd/opt proc root sbin -> /mnt/livecd/sbin sys tmp usr -> /mnt/livecd/usr var 430 431 432 433 434 435 436 12.1.8 This version of ls places each name in a separate row. The names that represent directories have a row that begins with a letter 'd' and rows that begin with a letter 'l' represent a symbolic link or reference to a separate directory or file. For example, the name etc above refers to a directory that is in the / directory but the name bin is a link that refers to another directory called bin which is inside a directory called livecd. The livecd directory, in turn, is inside the mnt directory. 437 438 439 440 441 442 443 12.1.9 /mnt/livecd/bin is called a path and a path is a concise method for indicating which files and directories are contained within other directories. Paths are read from left to right. In this path, notice that the leftmost character is the '/' character which represents the toplevel directory in the filesystem. The other '/' characters in the path are called path separators and they are used to separate one path name from another. 444 445 446 12.1.10 A file has a '-' character at the beginning of its row and, since none of the above rows begin with a '-', the / directory does not contain any files. 447 12.1.11 Lets change into the bin directory and see what it contains: 448 livecd / # cd bin 449 450 livecd bin # pwd /bin 451 452 453 454 455 456 457 458 459 460 461 462 463 livecd bin # ls arch df awk dir basename dircolors bash dirname bashlogin dmesg bunzip2 dnsdomainname bzcat domainname bzcmp du bzdiff echo bzegrep egrep bzfgrep env bzgrep expr kill killall link ln loadkeys login logname ls lsattr lsmod lsmod.old mkdir printenv ps pstree pstree.x11 ptx pwd rbash rc-status readlink rm rmdir rnano true tty umount uname uniq unlink uuidgen vdir wc who whoami wpa_cli Installing Gentoo Linux v1.81 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 bzip2 bzip2recover bzless bzmore cat chattr chgrp chmod chown chroot cksum comm cp cryptsetup cut date dd false fgrep fuser gawk gawk-3.1.5 grep groups gunzip gzcat gzexe gzip head hostid hostname id igawk install mkfifo mknod mktemp more mount mv nano netstat nice nisdomainname nohup oldfuser passwd pgawk pidof ping ping6 run-parts sed seq setfont sh sleep sort split stat stty su sync tar tee tempfile touch tr 24/124 wpa_passphrase yes ypdomainname zcat zcmp zdiff zegrep zfgrep zforce zgrep zless zmore znew 481 482 483 484 485 12.1.12 The bin directory contains a significant number of files. These files are special because they contain numbers which represent machine language instructions that the CPU can execute directly. The name of this directory stands for binary because programmers sometimes refer to files that contain machine language instructions as binaries. 486 487 12.1.13 Generate a long listing for this directory so that we can confirm that the bin directory contains at least some files: 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 livecd bin total 4828 -rwxr-xr-x lrwxrwxrwx -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x lrwxrwxrwx lrwxrwxrwx lrwxrwxrwx -rwxr-xr-x lrwxrwxrwx lrwxrwxrwx -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x lrwxrwxrwx -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x <snip> # ls -l 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 root root root root root root root root root root root root root root root root root root root root 3212 Sep 18 00:19 arch root 10 Sep 18 01:17 awk -> gawk-3.1.5 root 13644 Aug 31 18:21 basename root 648400 Aug 31 16:04 bash root 116 Sep 18 00:10 bashlogin root 5 Sep 18 01:17 bunzip2 -> bzip2 root 5 Sep 18 01:17 bzcat -> bzip2 root 6 Sep 18 01:17 bzcmp -> bzdiff root 2105 Aug 31 18:30 bzdiff root 6 Sep 18 01:17 bzegrep -> bzgrep root 6 Sep 18 01:17 bzfgrep -> bzgrep root 1677 Aug 31 18:30 bzgrep root 30744 Aug 31 18:30 bzip2 root 8424 Aug 31 18:30 bzip2recover root 6 Sep 18 01:17 bzless -> bzmore root 1259 Aug 31 18:30 bzmore root 17736 Aug 31 18:21 cat root 7840 Aug 31 18:29 chattr root 34148 Aug 31 18:21 chgrp 12.1.14 I did not include the full output from the ls -l command because of its long length. In fact, the listing is so long that it scrolls off the top of Installing Gentoo Linux v1.81 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 25/124 the window which prevents one from seeing everything that was listed. You can fix this problem by issuing the following command: livecd bin total 4828 -rwxr-xr-x lrwxrwxrwx -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x lrwxrwxrwx lrwxrwxrwx lrwxrwxrwx -rwxr-xr-x lrwxrwxrwx lrwxrwxrwx -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x lrwxrwxrwx -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x -rwxr-xr-x --More-- # ls -l | more 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 root root root root root root root root root root root root root root root root root root root root root root root 3212 Sep 18 00:19 arch root 10 Sep 18 01:17 awk -> gawk-3.1.5 root 13644 Aug 31 18:21 basename root 648400 Aug 31 16:04 bash root 116 Sep 18 00:10 bashlogin root 5 Sep 18 01:17 bunzip2 -> bzip2 root 5 Sep 18 01:17 bzcat -> bzip2 root 6 Sep 18 01:17 bzcmp -> bzdiff root 2105 Aug 31 18:30 bzdiff root 6 Sep 18 01:17 bzegrep -> bzgrep root 6 Sep 18 01:17 bzfgrep -> bzgrep root 1677 Aug 31 18:30 bzgrep root 30744 Aug 31 18:30 bzip2 root 8424 Aug 31 18:30 bzip2recover root 6 Sep 18 01:17 bzless -> bzmore root 1259 Aug 31 18:30 bzmore root 17736 Aug 31 18:21 cat root 7840 Aug 31 18:29 chattr root 34148 Aug 31 18:21 chgrp root 31324 Aug 31 18:21 chmod root 36492 Aug 31 18:21 chown root 14496 Aug 31 18:21 chroot 539 540 541 542 543 544 545 546 12.1.15 The ls -l | more command does not send its output to the screen. Instead, the '|' symbol (which is typed by holding down the <shift> key and pressing the backslash '\' key) is used to pipe the output from the ls -l command into the more command. The more command is used to show long output one page at a time so that it can be seen. Press the <space> key to view the next page of output. You can keep pressing the <space> key until all of the output has been viewed, or you can press the 'q' key in order to exit the more command early. 547 548 549 550 551 552 12.1.16 If you look closely at the files that were listed, you will notice the names of three commands that we recently executed (ls, pwd and more). Most commands that are executed at a command line are simply executable files that are present somewhere in the filesystem. You may have noticed that the cd command is not present in the bin directory. We will cover the reason for this later. 553 554 12.1.17 We will now go back to the / directory, change to the etc directory, and then enter the conf.d directory which is inside the etc directory: v1.81 Installing Gentoo Linux 26/124 555 livecd bin # cd / 556 557 558 livecd / # pwd / livecd / # cd etc 559 560 livecd etc # pwd /etc 561 livecd etc # cd conf.d 562 563 livecd etc # pwd /etc/conf.d 564 565 566 567 568 569 livecd conf.d # ls apmd crypto-loop bootmisc dante-sockd clock domainname consolefont env_whitelist cryptfs gpm hdparm hostname ipw3945d keymaps local.start local.stop mdadm net net.example nfs portmap rc rdate slmodem splash 570 571 572 573 574 575 576 livecd conf.d # ls -a . cryptfs .. crypto-loop apmd dante-sockd bootmisc domainname clock env_whitelist consolefont gpm hdparm hostname ipw3945d keymaps local.start local.stop mdadm net net.example nfs portmap rc rdate slmodem splash sshd wireless.example sshd wireless.example 577 578 579 580 581 582 583 584 12.1.18 After changing into the conf.d directory, I executed an ls command followed by an ls -a command. Can you see what the difference is? The ls -a command stands for list all and it will show any hidden names that are in a directory. In this case, two hidden names are in the directory (which are . and ..). If you execute an ls -la command, you will see that the . and .. names both refer to directories. These directories are special, however, because every directory in the filesystem contains these two hidden directories. 585 586 587 588 12.1.19 The . directory refers to the working directory and the .. directory refers to the directory that the working directory is inside of. We are currently working in the /etc/conf.d directory. If we issue a cd .. command, notice what happens: 589 590 livecd conf.d # pwd /etc/conf.d 591 livecd conf.d # cd .. 592 593 livecd etc # pwd /etc v1.81 594 595 596 597 27/124 12.1.20 The cd .. command placed us into the etc directory which is one above the conf.d directory that we were inside of. If we now execute a cd . command, notice that we remain in the etc directory because a single . refers to the working directory: 598 599 livecd etc # pwd /etc 600 livecd etc # cd . 601 602 livecd etc # pwd /etc 603 604 605 606 607 608 609 Installing Gentoo Linux 12.1.21 Change back to the top-level directory by executing a cd .. command or a cd / command. No matter where you are in the directory hierarchy, executing the cd / command will take you back to the top-level directory. You can also pass a path to the cd command and it will move you to the last directory on the path. Lets try this. In the following example, I will change to the top-level directory, change to the /etc/conf.d directory, and then change back to the top-level directory: 610 611 livecd / # pwd / 612 livecd / # cd /etc/conf.d 613 614 livecd conf.d # pwd /etc/conf.d 615 livecd conf.d # cd / 616 617 livecd / # pwd / 618 619 620 621 622 623 624 625 12.1.22 Typing commands and paths can become tedious so most command line interfaces provide a feature to help with this. From the / directory, try typing cd e <tab>. You should see the rest of the etc directory's name automatically filled out. The <tab> key provides automatic command and path completion and it saves a significant amount of typing. You should currently have cd /etc/ on your command line and if you now type con <tab>, the rest of the conf.d's name will be automatically typed and you can then change into this directory. 626 627 628 12.1.23 Here is a list of the standard subdirectories that are typically in a Gentoo Linux's root directory, along with a short explanation of what the purpose of each one is: 629 630 bin - Contains utility programs that can be run from a command line. boot - Holds a bootloader program and the kernel image that will be loaded. Installing Gentoo Linux v1.81 631 632 633 634 635 636 637 638 639 640 641 642 643 644 dev etc home lib mnt opt proc root sbin sys tmp usr var - 28/124 Device drivers are bound to the names in this directory. Contains most of the system's configuration files. Each user on the system gets their own directory in the home directory. Contains the system's library files and kernel modules. Removable storages devices are bound to the names in this directory. Applications that are added to the system are often stored here. Special directory that shows live information about the kernel. The superuser's home directory. Contains utility programs that only the superuser can execute. Similar to proc but allows parameters to also be changed. Space for temporary files. Houses much of the software that is loaded on the system. Contains data that varies as the system runs, such as system logs. 13 Managing storage device complexity 645 646 647 648 649 650 13.1 There are many kinds of storage devices available today including CDROM drives, flash drives, and hard drives. Personal computers and servers usually use a hard drive as their main storage device and this is the kind of storage device we will be installing Gentoo Linux onto. However, Gentoo Linux can be installed onto almost any of the wide range of storage device types that are currently available. 651 652 653 654 655 656 657 13.2 Storage device types are usually implemented in very different ways from each other. For example, a hard drive consists of one or more spinning metal disks which use a magnetic head to write information onto them and read information from them, while flash drives use solid state electronics for these tasks. Something that should be bothering you at this point is how all of these different types of storage devices, along with ones that are yet to be invented, are treated in a uniform way by the operating system. 658 14 Abstraction 659 660 661 662 663 664 665 666 14.1.1 Our world is an extremely complex place and it is becoming more complex all the time. If we did not have ways to deal with all of this complexity, our civilization would collapse and we would be thrown back into stone age conditions. Fortunately, techniques do exist for managing complexity and one of the most powerful of these techniques is called abstraction. Abstraction is the process of strategically hiding certain details of a concept or object so that only those details that are important for a given purpose remain exposed. 667 668 669 14.1.2 As an example, consider the device that city planners use to measure the amount of traffic that passes a given point on a street during a certain time frame. The device usually consists of a rubber hose that is run Installing Gentoo Linux v1.81 29/124 670 671 672 673 across the road and attached to a box with a counter in it. Each time a vehicle's tires roll over the hose, the air pressure in the hose is momentarily increased, a sensor in the box senses this increase, and it advances a counter. 674 675 676 677 678 679 680 14.1.3 From the point of view of the counting system, it does not care whether the vehicle that has just run over it was a small red Chevy car, a green Volkswagen luxury sedan, or a white Mac truck. Details like this are not needed for the purpose of counting vehicles and they would only serve as unwanted distractions. Therefore, the designers of the vehicle counter used abstraction to hide these unwanted details from the device so that only the properties they wanted to measure remained visible. 681 15 Interfaces 682 683 684 685 686 687 15.1.1 Abstraction is used heavily in all areas of computing in order to manage the enormous amounts of complexity contained within this field. One area of computing that takes great advantage of the process of abstraction involves the mechanisms that are used when one computing entity needs to communicate with another computing entity. These communications mechanisms are usually called interfaces. 688 689 690 691 692 693 694 695 15.1.2 Using the terminology of abstraction, an interface is an abstraction of an entity that can be used by other entities to communicate with it. Keyboards, hard drives, CDROM drives, flash drives, video cards, and sound cards all use interfaces to communicate with the computer's motherboard. Software also makes use of interfaces and we will cover some examples of this later. Before we do, though, lets discuss an example of an interface that is in common use in the world today in order to gain a better understanding of how abstraction and interfaces work. 696 697 698 699 700 701 702 703 704 705 15.1.3 This example consists of the interface that humans use to drive a car. If you think about it, almost all of the details about how a car works have been hidden from the driver and the few details they absolutely have to deal with have been abstracted into an automatic-car-operator interface. This automatic-car-operator interface consists of a steering wheel, an accelerator pedal, a brake pedal, and a transmission selection lever which has Park, Drive and Neutral positions on it (most transmissions also have the ability to force the selection of lower gear ranges like L1 and L2 but we will ignore these for this discussion). For the most part, this automatic-car-operator interface is all a person needs to v1.81 Installing Gentoo Linux 30/124 706 707 know in order to operate an automatic car and a knowledge of this interface will give this person the ability to operate any car in the world. 708 709 710 711 712 713 714 715 15.1.4 The interesting thing is that interfaces are more durable (and almost more real) than their implementations. This can be illustrated by imagining a person who was put into hibernation in the 1950s and awakened today. The automatic-car-operator interface in use today is identical to the one used to operate 1950's automatic transmission cars. Therefore, this person would have no problem operating a modern car even though the details of how this automatic-car-operator interface are implemented have changed significantly since the 1950s. 716 717 718 719 720 721 722 723 724 15.1.5 The typical automatic car in the 1950s had a carbureted engine, rear wheel drive, drum brakes, and a hydraulically shifted transmission. The typical modern car has a fuel-injected engine, front wheel drive, disc brakes, and an electronically shifted transmission. A 1950s mechanic that had been placed in hibernation and awakened today would have to be completely retrained before being capable of working on a modern automobile. The reason for this is that a mechanic works with the implementation details behind the automatic-car-operator interface and these details are constantly changing. 725 16 Different types of devices can provide the same abstract interface 726 727 728 729 730 731 732 16.1.1 As discussed in the automatic-car-operator interface example, abstraction and interfaces can be used to manage the changes in complexity that occur when devices are improved over time. Abstraction and interfaces can also be used, however, to allow very different types of devices to act in a uniform way so that these differences are hidden from the users of these devices. The following example will use the automaticcar-operator interface in another way to illustrate this. 733 734 735 736 737 738 16.1.2 In the physical world, there are many things that move around in a primarily two dimensional plane. A partial list of these things include cars, trucks, buses, boats, motorcycles, hovercraft, snowmobiles, and horses. In theory, if a person knew how to use the automatic-car-operator interface, and if they needed to use a motorcycle but had never ridden one before, abstraction and interfaces could assist them. 739 740 741 742 16.1.3 If the motorcycle implemented the automatic-car-operator interface then, when the person looked at the motorcycle, all they would see was the automatic-car-operator interface. They would get 'into' the car, put it in drive, press the accelerator pedal and drive away. The person would v1.81 743 744 745 746 747 748 749 750 751 752 753 754 755 Installing Gentoo Linux 31/124 have no idea that they were actually riding a motorcycle. This concept can even be extended to something like a horse. If a given horse implemented the automatic-car-operator interface then, when a person who knew this interface (but did not know how to ride a horse) looked at the horse, all they would see is the automatic-car-operator interface and they could use this interface to 'drive' the horse. Any of the things in the above list could be made to implement the automatic-car-operator interface and then it could be used by a person who only knew the automatic-caroperator interface to 'drive' it around. 16.1.4 Unix-like operating systems also use abstraction and interfaces to deal with the complexity of change and the complexity of diversity and this is covered in the next section. 17 Block devices and character devices are abstract interfaces 756 757 758 759 760 761 17.1.1 There are numerous kinds of devices that can be attached to a computer including mice, keyboards, sound cards, hard drives, CDROM drives, flash drives, and RAM drives. This creates a significant amount of complexity that needs to be managed and the way that UNIX-like systems manage this complexity is by having all devices implement either the character device interface or the block device interface. 762 763 764 17.1.2 A character device communicates with a computer one byte at a time and examples of devices that implement the character device interface include: 765 Mouse - Sends a series of bytes to the computer as it is moved and clicked. 766 Keyboard - Sends bytes to the computer as its keys are pressed. 767 Sound card - Receives a sequence of bytes from the computer and turns these into sounds. 768 769 17.1.3 Block devices communicate with the computer using groups or blocks of bytes and examples of block devices include: 770 Hard drive - Uses spinning metal disks to hold information using magnetics. 771 CDROM drive - Uses spinning plastic disk to hold information using optics. 772 Flash drive - Uses computer chips to hold information. 773 774 RAM drive - A program that pretends that it is a physical storage devices but it stores its information in RAM. Installing Gentoo Linux v1.81 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 32/124 18 All devices are bound to names in the /dev directory 18.1.1 Change into the /dev directory and execute an ls -l command (I have edited this listing to make it shorter.): livecd dev total 0 drwxr-xr-x lrwxrwxrwx lrwxrwxrwx crw------drwxr-xr-x drwxr-xr-x lrwxrwxrwx crw-rw---lrwxrwxrwx lrwxrwxrwx drwxr-xr-x crw-rw-rwsrwxrwxrwx brw-rw---brw-rw---prw------drwxr-xr-x crw-r----crw-rw---srw-rw-rwdrwxr-xr-x drwxr-xr-x crw-r----drwxr-xr-x lrwxrwxrwx crw-rw-rwcrw-r----lrwxrwxrwx crw-rw-rwdrwxr-xr-x lrwxrwxrwx lrwxrwxrwx crw-rw-rwdrwxr-xr-x lrwxrwxrwx drwxr-xr-x lrwxrwxrwx lrwxrwxrwx lrwxrwxrwx crw-rw---drwxr-xr-x crw-rw-rwcrw-rw---crw------crw-rw---crw-rw---- # ls -l 3 1 1 1 5 2 1 1 1 1 2 1 1 1 1 1 2 1 1 1 2 2 1 2 1 1 1 1 1 2 1 1 1 2 1 2 1 1 1 1 2 1 1 1 1 1 root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root root 60 Jan 24 16:19 bus root 8 Jan 24 16:20 cdrom -> /dev/hdc root 3 Jan 24 16:19 cdrom1 -> hdc tty 5, 1 Jan 24 16:19 console root 100 Jan 24 16:19 disk root 60 Jan 24 16:19 fb root 4 Jan 24 16:19 fb0 -> fb/0 root 10, 63 Jan 24 16:19 fbsplash root 13 Jan 24 16:19 fd -> /proc/self/fd root 8 Jan 24 16:21 fd0 -> floppy/0 root 60 Jan 24 16:21 floppy root 1, 7 Jan 24 16:19 full root 0 Jan 24 16:21 gpmctl disk 3, 0 Jan 24 16:19 sda cdrom 22, 0 Jan 24 16:19 hdc root 0 Jan 24 16:20 initctl root 120 Jan 24 16:19 input root 1, 2 Jan 24 16:19 kmem root 1, 11 Jan 24 16:19 kmsg root 0 Jan 24 16:20 log root 200 Jan 24 16:19 loop root 60 Jan 24 16:19 mapper root 1, 1 Jan 24 16:19 mem root 80 Jan 24 16:19 misc root 15 Jan 24 16:20 mouse -> /dev/input/mice root 1, 3 Aug 31 18:22 null root 1, 4 Jan 24 16:19 port root 10 Jan 24 16:19 psaux -> misc/psaux tty 5, 2 Jan 24 16:28 ptmx root 0 Jan 24 16:19 pts root 4 Jan 24 16:19 ram0 -> rd/0 root 4 Jan 24 16:19 ram1 -> rd/1 root 1, 8 Jan 24 16:19 random root 360 Jan 24 16:19 rd root 8 Jan 24 16:19 rtc -> misc/rtc root 40 Jan 24 16:19 shm root 4 Jan 24 16:19 stderr -> fd/2 root 4 Jan 24 16:19 stdin -> fd/0 root 4 Jan 24 16:19 stdout -> fd/1 root 10, 25 Jan 24 16:19 synth root 120 Jan 24 16:19 tts tty 5, 0 Jan 24 16:19 tty tty 4, 0 Jan 24 16:19 tty0 root 4, 1 Jan 24 16:25 tty1 tty 4, 64 Jan 24 16:20 ttyS0 tty 4, 67 Jan 24 16:19 ttyS3 Installing Gentoo Linux v1.81 33/124 826 827 828 829 830 18.2 In the ls -l long listing, character devices have a 'c' in the left column and block devices have a 'b'. On the computer I generated this list on, the hard drive is attached to /dev/sda and the CDROM drive is attached to /dev/hdc. We will be using /dev/sda shortly to access the main hard drive so that we can prepare it for holding our Gentoo Linux installation. 831 832 833 18.3 Before we do that, however, I want you to experiment with the mouse device so that you can get a better feel for how devices work. Change into the /dev/input directory and execute the following commands: 834 livecd dev # cd /dev/input 835 836 livecd input # pwd /dev/input 837 838 livecd input # ls event0 event1 mice 839 840 841 842 843 livecd input 0000000 0008 0000010 ff00 0000020 28fe <snip> # hexdump 2802 ff00 0028 28ff fe00 0028 mouse0 mice fe38 28ff ff00 0028 28ff ff00 0028 28fd fe00 0028 28fe fe00 0028 28fe fe00 844 845 846 847 848 849 18.4 After you have entered the hexdump command, move your mouse around on the screen and notice what happens. The mouse is generating numbers as it is being moved and it is sending these numbers one at a time to the mouse driver (which is part of the kernel). The mouse driver, in turn, is attached to the file named /dev/input/mice so that it is easily accessible to other programs in the system. 850 851 852 853 854 855 856 857 858 18.5 The hexdump command is designed to open a character device (or a file) and then display each number that is sent by the device to the screen. By default, hexdump displays numbers in hexadecimal format although it can be told to display the numbers in other formats too. When you are finished sending numbers to the hexdump command with the mouse, hold down the <ctrl> key on your keyboard and then press the 'c' key. <ctrl> c sends a signal to a program that tells it to exit. If you ever run a program from the command line and you can not get it to stop running, entering <ctrl> c will usually force it to exit. 859 860 861 862 18.6 All devices that are attached to the computer are bound to a name somewhere in the /dev directory. Now that you have a better understanding of how devices are accessed in a UNIX-like system, we are going to prepare the main storage device so that Gentoo Linux can be loaded onto it. v1.81 863 Installing Gentoo Linux 34/124 19 Partitioning the main storage device 864 865 866 867 868 869 870 871 872 873 19.1 Most PCs use a hard drive as their main storage device so we are going to assume that you are going to install Gentoo Linux on a hard drive. Hard drives implement the block device interface which means they communicate with the computer using blocks of numbers instead of one number at a time like character devices do. Hard drive block devices have such large capacities, however, that they are often made to appear as a set of smaller block devices (called logical drives) in order to increase their manageability. The process of making a hard drive look like a group of smaller block devices is called partitioning. Before you partition your hard drive, lets look at where it is attached inside of the /dev directory. 874 875 876 19.2 Change into the /dev directory and issue a ls -l sda command. If you pass a name to the ls command, it will just list that one name instead of all the names in a directory. 877 livecd dev # cd /dev 878 879 livecd dev # ls -l sda brw-rw---- 1 root disk 3, 0 Jan 25 20:16 sda 880 881 882 883 884 19.3 If your main storage device is an IDE hard drive, then it will usually be attached to the name sda in the /dev directory Notice that this is a block device because a 'b' is listed in the left column. What we are going to do is use the fdisk command to partition the sda drive into 3 smaller block devices called sda1, sda2, and sda3. 885 886 887 19.4 First, lets have fdisk show us information about all of the storage devices that are currently attached to the computer by passing it the -l option, which stands for 'List partitions' ('l' is a lower case L): 888 19.5 livecd dev # fdisk -l 889 890 891 Disk /dev/sda: 22.5 GB, 22548578304 bytes 16 heads, 63 sectors/track, 43690 cylinders Units = cylinders of 1008 * 512 = 516096 bytes 892 Disk /dev/sda doesn't contain a valid partition table 893 894 895 896 897 The above information is what fdisk listed on the VMware virtual computer that I used to prepare the materials for this class. It indicates that the virtual computer has one IDE hard drive attached to it at /dev/sda and the size of this drive is 22.5 Gigabytes. The drive has not been partitioned yet so we receive a message that indicates that a valid partition table does not yet exist on the drive. Installing Gentoo Linux v1.81 898 899 900 901 35/124 When you issue the fdisk -l command on a machine that already has an operating system on it, partitions probably exist on the drive and these will be listed. As an example, here is the information that was listed when I ran fdisk -l on my portable computer: 902 the_count tkosan # fdisk -l 903 904 905 Disk /dev/sda: 80.0 GB, 80026361856 bytes 240 heads, 63 sectors/track, 10337 cylinders Units = cylinders of 15120 * 512 = 7741440 bytes 906 907 908 909 Device Boot /dev/sda1 /dev/sda2 /dev/sda3 Start 1 6 73 End 5 72 8469 Blocks 37768+ 506520 63481320 Id 83 82 83 System Linux Linux swap / Solaris Linux 910 911 912 913 19.6 This hard drive has an 80 Gigabyte capacity and it has been partitioned into 3 smaller block devices called sda1, sda2 and sda3. If your computer has already been partitioned, the first thing you will need to do when you execute the fdisk command is to delete any existing partitions on the drive. 914 915 916 917 19.7 If your machine has more than one IDE drive, the second drive will be named hdb, the third one hdc and so on. If your machine is using SCSI hard drives instead of IDE hard drives, the SCSI drives will be named sda, sdb, sdc, etc. 918 919 19.8 Let us now use fdisk to partition your main hard drive. Assuming your hard drive is named sda, execute the following command: 920 livecd dev # fdisk /dev/sda 921 922 923 924 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. 925 926 927 928 929 930 931 The number of cylinders for this disk is set to 43690. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) 932 Command (m for help): 933 19.9 The first thing you should do is to enter an 'm' command in order to Installing Gentoo Linux v1.81 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 obtain a list of all the operations that fdisk can perform. Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) 19.10 The first operation we are going to perform is to print the partition table using the 'p' command to see if the disk already has partitions on it: 955 Command (m for help): p 956 957 958 Disk /dev/sda: 22.5 GB, 22548578304 bytes 16 heads, 63 sectors/track, 43690 cylinders Units = cylinders of 1008 * 512 = 516096 bytes 959 960 36/124 Device Boot Start End Blocks Id System Command (m for help): 961 962 963 964 19.11 As indicated before, the virtual computer I am using does not have any partitions but your computer may. If it does, use the 'd' (delete partition) command to delete all current partitions and then execute the 'p' command again to make sure they have all been removed. 965 966 967 968 969 970 19.12 Now that we have a disk that does not have any partitions on it, we are going to create 3 new partitions to hold our Gentoo Linux operation system. The 'n' (add a partition) command is used to create a new partition and the first partition we will create is called the boot partition. The boot partition will be used to hold the programs and information that are needed to boot the computer. 971 972 973 Command (m for help): n Command action e extended v1.81 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 p Installing Gentoo Linux 37/124 primary partition (1-4) 19.13 The first question that the n command asks is if you want to create a primary partition or an extended partition. We will be creating only primary partitions during this installation so select 'p'. Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 19.14 The next question that the 'p' command asks is what the number is of the partition we want to create. There can only be 4 primary partitions on a hard drive and we will use partition 1 for our boot partition: Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-43690, default 1): 19.15 The 'p' command now wants to know which cylinder is going to be the first cylinder that is allocated to partition 1. In order to understand what a cylinder is, one must first know how a hard drive stores data on the metal disk or disks that it contains. Here is a picture of the inside of a hard drive: Installing Gentoo Linux v1.81 38/124 998 999 19.16 And here is a picture of the heads that read data from a disk's surfaces and write data onto them: 1000 1001 1002 1003 19.17 If a hard drive has only one metal disk in it, then both the top surface of the disk and the bottom surface are used to hold data and each surface will need its own head. If more than one disk is present in a hard drive, then two heads are needed for each of these disks. 1004 1005 1006 1007 19.18 Each disk surface is coated with a magnetic material and data is stored magnetically by the heads in concentric circles or tracks on this surface. If one could see the magnetic tracks on the surface of one of the metal disks, they would look similar to figure 4: Figure 4 Track 1008 1009 1010 1011 1012 19.19 The number of tracks and their placement on one surface of a disk exactly match the tracks that are on the opposite surface of the disk. Taking this one step further, the number of tracks and their placement on one metal disk exactly match the tracks on all of the other disks in the drive if it has more than one disk. Installing Gentoo Linux v1.81 39/124 1013 1014 1015 1016 1017 19.20 All of the tracks that are the same distance from the edge of the disk they are on form an imaginary cylinder that that passes through all of them and these are the cylinders that are referred when the fdisk command creates a new partition. Cylinder number 1 always starts at the outer edge of a disk. 1018 1019 1020 1021 19.21 Now that we have covered what a cylinder is, lets continue creating partition 1. The fdisk command is asking us which cylinder should be used as the first cylinder devoted to partition 1 and the default value is cylinder 1. Accept the default value by pressing <enter>: 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-43690, default 1): <enter> Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-43690, default 43690): 19.22 Fdisk then asks what the number of the last cylinder in partition 1 should be and it also gives us the option to specify the size of the partition in bytes. We want the boot partition to be 32 megabytes long so enter +32M at the prompt. Then enter the 'p' command again to make sure partition was created properly: 1036 1037 1038 1039 1040 1041 1042 1043 1044 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-43690, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-43690, default 43690): +32M 1045 Command (m for help): p 1046 1047 1048 Disk /dev/sda: 22.5 GB, 22548578304 bytes 16 heads, 63 sectors/track, 43690 cylinders Units = cylinders of 1008 * 512 = 516096 bytes 1049 1050 Device Boot /dev/sda1 1051 1052 1053 Start 1 End 63 Blocks 31720 Id 83 System Linux 19.23 The 'p' command indicates that partition 1 was successfully created and it was given the name sda1. The first cylinder in partition 1 is cylinder 1 and the last cylinder in this partition (on the computer that I am using, yours Installing Gentoo Linux v1.81 40/124 1054 1055 1056 1057 may be different) is cylinder 63. Each partition on a hard drive needs to be set to a partition type and fdisk sets new partitions to type 83 by default (which is a Linux partition). We want the boot partition to be a Linux partition so we do not need to change its type. 1058 1059 1060 1061 1062 1063 19.24 The next partition we are going to create is called the swap partition. A swap partition provides a way for a computer to create a virtual memory map that is larger than the computer's physical memory map. The way that virtual memory is made larger than physical memory is by having it include the machine's RAM plus the storage that is present in the swap partition. 1064 1065 1066 1067 1068 1069 1070 1071 19.25 This larger virtual memory map can hold more programs (or larger programs) than the physical memory map can because the contents of the virtual memory map that are not being used at any given moment are copied out of RAM (which is the only place programs can run) and into the swap partition. Information that is already in the swap partition that is currently needed is then copied back into RAM and this constant swapping of information between the physical RAM and the swap partition is how the swap partition received it name. 1072 1073 1074 1075 1076 1077 19.26 Begin creating the swap partition by executing the 'n' command again. Make the partition a primary partition and make it number 2. Accept the default value for the first cylinder in this partition and make it 512 megabytes long by entering +512M at the prompt for the last cylinder. Finally, execute the 'p' command to make sure partition 2 was created as desired: 1078 1079 1080 1081 1082 1083 1084 1085 1086 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (64-43690, default 64): <enter> Using default value 64 Last cylinder or +size or +sizeM or +sizeK (68-43690, default 43690): +512M 1087 Command (m for help): p 1088 1089 1090 Disk /dev/sda: 22.5 GB, 22548578304 bytes 16 heads, 63 sectors/track, 43690 cylinders Units = cylinders of 1008 * 512 = 516096 bytes 1091 1092 1093 Device Boot /dev/sda1 /dev/sda2 Start 1 64 End 63 1056 Blocks 31720+ 500472 Id 83 83 System Linux Linux Installing Gentoo Linux v1.81 19.27 Notice that partition 2 was given the name sda2 and it was also given the default partition type of 83 which is not what we want. The 't' (change a partition's system id) command is used to change a partition's type and you can execute it now. The command asks which partition number it should change and you should respond '2'. Finally, it asks what type to set the partition to and then gives the option for you to type a capital 'L' to see a list of all the types that fdisk supports. Enter a capital 'L' at the prompt to see the list: 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): L 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 0 1 2 3 4 5 6 7 8 9 a b c e f 10 11 12 14 16 17 18 1b 1c 1129 1130 1131 1132 1133 41/124 Empty FAT12 XENIX root XENIX usr FAT16 <32M Extended FAT16 HPFS/NTFS AIX AIX bootable OS/2 Boot Manag W95 FAT32 W95 FAT32 (LBA) W95 FAT16 (LBA) W95 Ext'd (LBA) OPUS Hidden FAT12 Compaq diagnost Hidden FAT16 <3 Hidden FAT16 Hidden HPFS/NTF AST SmartSleep Hidden W95 FAT3 Hidden W95 FAT3 1e 24 39 3c 40 41 42 4d 4e 4f 50 51 52 53 54 55 56 5c 61 63 64 65 70 75 Hidden W95 FAT1 NEC DOS Plan 9 PartitionMagic Venix 80286 PPC PReP Boot SFS QNX4.x QNX4.x 2nd part QNX4.x 3rd part OnTrack DM OnTrack DM6 Aux CP/M OnTrack DM6 Aux OnTrackDM6 EZ-Drive Golden Bow Priam Edisk SpeedStor GNU HURD or Sys Novell Netware Novell Netware DiskSecure Mult PC/IX 80 81 82 83 84 85 86 87 88 8e 93 94 9f a0 a5 a6 a7 a8 a9 ab b7 b8 bb Old Minix Minix / old Lin Linux swap / So Linux OS/2 hidden C: Linux extended NTFS volume set NTFS volume set Linux plaintext Linux LVM Amoeba Amoeba BBT BSD/OS IBM Thinkpad hi FreeBSD OpenBSD NeXTSTEP Darwin UFS NetBSD Darwin boot BSDI fs BSDI swap Boot Wizard hid be bf c1 c4 c6 c7 da db de df e1 e3 e4 eb ee ef f0 f1 f4 f2 fd fe ff Solaris boot Solaris DRDOS/sec (FATDRDOS/sec (FATDRDOS/sec (FATSyrinx Non-FS data CP/M / CTOS / . Dell Utility BootIt DOS access DOS R/O SpeedStor BeOS fs EFI GPT EFI (FAT-12/16/ Linux/PA-RISC b SpeedStor SpeedStor DOS secondary Linux raid auto LANstep BBT 19.28 There are quite a large number of partition types to choose from! The partition we are interested is type 82, which is the Linux Swap partition type, so enter the number 82 at the prompt and then execute the 'p' command again to verify that the partition type was set correctly for partition 2: 1134 1135 Hex code (type L to list codes): 82 Changed system type of partition 2 to 82 (Linux swap / Solaris) 1136 Command (m for help): p 1137 1138 Disk /dev/sda: 22.5 GB, 22548578304 bytes 16 heads, 63 sectors/track, 43690 cylinders Installing Gentoo Linux v1.81 1139 Units = cylinders of 1008 * 512 = 516096 bytes 1140 1141 1142 Device Boot /dev/sda1 /dev/sda2 Start 1 64 End 63 1056 Blocks 31720+ 500472 Id 83 82 42/124 System Linux Linux swap / Solaris 1143 1144 1145 1146 1147 1148 19.29 The final partition we need to create is called the root partition because it is going to contain the main directory hierarchy of our Gentoo Linux installation (which will include the top-level root directory and all of the subdirectories that are within the root directory). This is going to be the largest of the three partitions and it will use the remainder of the cylinders on the drive. 1149 1150 1151 1152 1153 19.30 If we wanted to, we could have also created a 4th partition and placed another operating system into it (like Windows) so that the machine could be booted into Linux or the alternate operating system as needed. This is know as configuring the machine for "dual booting" but we are not going to cover this technique at this time. 1154 1155 1156 1157 1158 1159 19.31 Create the root partition using the following steps. Accept the default for the first cylinder and when you are asked for the last cylinder number for partition 3, just take the default by pressing <enter>. The default is the highest cylinder number on the disk and this will allocate the remainder of the disk space to partition 3. As before, execute a 'p' command to verify that partition 3 was created correctly: 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (1127-43690, default 1127): <enter> Using default value 1057 Last cylinder or +size or +sizeM or +sizeK (1057-43690, default 43690): <enter> Using default value 43690 1170 Command (m for help): p 1171 1172 1173 Disk /dev/sda: 22.5 GB, 22548578304 bytes 16 heads, 63 sectors/track, 43690 cylinders Units = cylinders of 1008 * 512 = 516096 bytes 1174 1175 1176 1177 Device Boot /dev/sda1 /dev/sda2 /dev/sda3 1178 Start 1 64 1057 End 63 1056 43690 Blocks 31720+ 500472 21487536 Id 83 82 83 System Linux Linux swap / Solaris Linux 19.32 Partition 3 was given the name sda3 and it was also given the default Installing Gentoo Linux v1.81 1179 1180 1181 1182 1183 1184 1185 partition type of 83. We want the root partition to have a type of 83 so you do not need to change it. 19.33 We now need to make partition 1 bootable by turning on its boot flag. Do this by executing the 'a' (toggle a bootable flag) command and selecting partition 1 when asked which partition's flag to toggle. Execute the 'p' command again to verify that an asterisk was placed into the Boot column next to partition 1 to indicate it is now bootable: 1186 1187 Command (m for help): a Partition number (1-4): 1 1188 Command (m for help): p 1189 1190 1191 Disk /dev/sda: 22.5 GB, 22548578304 bytes 16 heads, 63 sectors/track, 43690 cylinders Units = cylinders of 1008 * 512 = 516096 bytes 1192 1193 1194 1195 Device Boot /dev/sda1 * /dev/sda2 /dev/sda3 1196 1197 1198 1199 43/124 Start 1 64 1057 End 63 1056 43690 Blocks 31720+ 500472 21487536 Id 83 82 83 System Linux Linux swap / Solaris Linux 19.34 Up to this point, the fdisk command has recorded all of the information we have given it, but it has not yet written this information to the drive. Before you exit the fdisk program, execute the 'w' (write table to disk and exit) command as follows: 1200 1201 Command (m for help): w The partition table has been altered! 1202 1203 1204 Calling ioctl() to re-read partition table. Syncing disks. livecd dev # 1205 1206 1207 1208 19.35 The 'w' command will indicate that the partition table on the drive has been altered. All of the information we entered should have been written to the drive and the 'w' command then exits the fdisk program and brings us back to a normal command prompt. 1209 1210 19.36 You should now execute a fdisk -l command to make sure that the drive was partitioned properly: 1211 livecd dev # fdisk -l 1212 1213 1214 Disk /dev/sda: 21.4 GB, 21474836480 bytes 15 heads, 63 sectors/track, 43690 cylinders Units = cylinders of 945 * 512 = 483840 bytes Installing Gentoo Linux v1.81 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 Device Boot /dev/sda1 * /dev/sda2 /dev/sda3 Start 1 64 1057 End 63 1056 43690 Blocks 31720+ 500472 21487536 Id 83 82 83 44/124 System Linux Linux swap / Solaris Linux 19.37 The last thing I want you to do before we move on to the next step is to look in the /dev directory to see that the new partitions/block devices (sda1, sda2 and sda3) have been added there so that they can be accessed by other parts of the system (the asterisk at the end of sda is called a wildcard charater and it will match any group of characters that start in the position it is put in.): 1225 livecd dev # cd /dev 1226 1227 1228 1229 1230 livecd dev brw-rw---brw-rw---brw-rw---brw-rw---- # 1 1 1 1 ls -l sda* root disk 3, root disk 3, root disk 3, root disk 3, 0 1 2 3 Sep Sep Sep Sep 4 4 4 4 18:01 18:02 18:02 18:02 sda sda1 sda2 sda3 1231 1232 1233 19.38 We will be using the names /dev/sda1, /dev/sda2 and /dev/sda3 throughout the rest of the installation process to access the partitions we have created. 1234 1235 19.39 THIS IS A GOOD BREAKING POINT IF YOU DO NOT HAVE TIME TO WORK THROUGH SECTION 20. 1236 19.40 You can close VirtualBox by selecting Machine -> Close. 1237 1238 19.41 When the "Close Virtual Machine" dialog is shown, select "Save the machine state" option then select "Ok". 1239 1240 19.42 You can close the VirtualBox application and when you open it again, you simply have to select the "Start" button to resume where you left off. 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 20 Placing filesystems on the partitions 20.1 When a new partition has been created, it is unable to have files and directories placed on it until it has been formatted with a specific filesystem type. The Linux kernel is able to work with a significant number of filesystems and here is a partial list of the ones it supports: Ext2 Ext3 Reiserfs JFS XFS Installing Gentoo Linux v1.81 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 45/124 OCFS2 Minix ISO 9660 MSDOS VFAT NTFS Amiga FFS Apple Macintosh BeOS SquashFS OS/2 HPFS 1262 1263 1264 20.2 Any of these filesystems could be placed on the partitions we have created, but we are only going to use the two most common ones used with GNU/Linux systems, which are Ext2 and Ext3. 1265 1266 1267 1268 1269 1270 1271 1272 20.3 The Ext2 filesystem, which stands for second extended filesystem, was one of the earliest filesystems that was supported by the Linux kernel. It is still very popular, but one of its drawbacks is that it does not support journaling. If the power is suddenly removed on a non-journaling filesystem like Ext2, much of the information that was about to written to the disk was still in RAM and it becomes lost. This sudden loss of disk information often results in damaged files that will need to be repaired during the next system boot. 1273 1274 1275 1276 1277 1278 1279 1280 1281 20.4 A journaling filesystem solves this problem by recording the additions and changes that are about to be made to the disk in a special log. The log is usually updated every few seconds and, if the computer loses power, the log can be used to automatically restore the filesystem during the next system boot. The Ext3 filesystem is an extension to the Ext2 filesystem that supports journaling along with some other advanced features. These extended capabilities, however, mean that an Ext3 filesystem requires more resources than an Ext2 filesystem does so one must decide which filesystem is appropriate for a given use. 1282 1283 1284 1285 1286 1287 20.5 We are going to apply the Ext2 filesystem to the /dev/sda1 boot partition and the Ext3 filesystem to the /dev/sda3 top-level root filesystem. The boot filesystem is only used during the boot process and it is mostly read from during this time. Therefore, it does not need the extended capabilities that the Ext3 filesystem offers. You can apply the Ext2 filesystem to partition 1 using the mke2fs command as follows: 1288 1289 1290 1291 1292 livecd / # mke2fs /dev/sda1 mke2fs 1.40.8 (13-Mar-2008) Filesystem label= OS type: Linux Block size=1024 (log=0) v1.81 Installing Gentoo Linux 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 Fragment size=1024 (log=0) 7936 inodes, 31720 blocks 1586 blocks (5.00%) reserved for the super user First data block=1 Maximum filesystem blocks=32505856 4 block groups 8192 blocks per group, 8192 fragments per group 1984 inodes per group Superblock backups stored on blocks: 8193, 24577 1303 1304 Writing inode tables: done Writing superblocks and filesystem accounting information: done 1305 1306 This filesystem will be automatically checked every 33 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. 1307 1308 1309 1310 1311 1312 46/124 20.6 Since the root partition is going to hold the main directory hierarchy for our Gentoo Linux installation, it is a good idea to use the Ext3 filesystem with this partition. The mke2fs command is also used to apply the Ext3 filesystem to a partition, but a -j (journaling) option needs to be passed to this command to tell it to create an Ext3 filesystem instead of an Ext2 filesystem: 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 livecd / # mke2fs -j /dev/sda3 mke2fs 1.40.8 (13-Mar-2008) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 1343488 inodes, 5371884 blocks 268594 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=0 164 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 1329 1330 1331 Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done 1332 1333 This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. 1334 1335 1336 20.7 The last partition that needs to be initialized is the /dev/sda2 swap partition. The swap partition does not use a normal filesystem and instead it has a special swap format applied to it. The mkswap command is used to v1.81 1337 1338 Installing Gentoo Linux prepare the swap partition for use and the swapon command is used to enable it: 1339 1340 1341 livecd / # mkswap /dev/sda2 Setting up swapspace version 1, size = 512479 kB no label, UUID=f6a429b6-8e34-485e-afb3-32a8edf85168 1342 livecd / # swapon /dev/sda2 1343 1344 1345 47/124 20.8 The boot and root filesystems are now ready to have files and directories added to them and we will do this in the next section. 21 Mounting the boot and root partitions 1346 1347 1348 1349 1350 1351 1352 1353 21.1 Now that the boot partition (/dev/sda1) and the root partition (/dev/sda3) have had filesystems applied to them, the next step is to make these partitions accessible to the rest of the system. In UNIX-like systems, the way that devices with filesystems on them are made accessible is by attaching them to a directory in the main directory hierarchy. The process of attaching a device to a directory is called mounting and it is done using the mount command. The place where a device is mounted to a directory hierarchy is called a mount point. 1354 1355 1356 1357 21.2 Figure 5 shows the upper levels of the CD's directory hierarchy. In a moment we are going to mount the root partition to the /mnt/gentoo directory but before we do, lets change into this directory and see what is there: 1358 livecd gentoo # cd /mnt/gentoo 1359 1360 livecd gentoo # pwd /mnt/gentoo 1361 1362 livecd gentoo # ls -l total 0 Installing Gentoo Linux v1.81 48/124 Figure 5 / bin dev etc conf.d home lib opt mnt sys proc boot root usr sbin tmp var init.d cdrom gentoo livecd Currently empty 1363 1364 1365 1366 1367 21.3 As you can see, the /mnt/gentoo directory is empty. This directory's only purpose for being on the CD is to provide a place to mount the /dev/sda3 root partition to so that it can be accessed. Lets do this now. First, you must change out of the /mnt/gentoo directory and a safe directory to change into is the top-level root directory: 1368 livecd gentoo # cd / 1369 1370 livecd / # pwd / 1371 1372 1373 21.4 Now, mount the /dev/sda3 partition to the /mnt/gentoo directory, change back into the /mnt/gentoo directory, and then execute an ls -l command in order to see if anything appeared there: 1374 livecd / # mount /dev/sda3 /mnt/gentoo 1375 livecd / # cd /mnt/gentoo 1376 1377 1378 livecd gentoo # ls -l total 16 drwx------ 2 root root 16384 Jan 27 03:02 lost+found 1379 1380 1381 1382 1383 1384 21.5 Notice that there is now a subdirectory inside of the /mnt/gentoo directory called lost+found. mke2fs always places a directory called lost+found in a partition after it is done preparing it. The fact that this directory is present inside the /mnt/gentoo directory means that we have successfully mounted the /dev/sda3 partition to /mnt/gentoo. (See Figure 6). Installing Gentoo Linux v1.81 Figure 6 Top-level root directory for the CD bin dev etc conf.d 49/124 / home lib opt mnt sys proc boot root usr sbin tmp var init.d cdrom Top-level root directory for the hard drive gentoo / livecd /dev/hda3 1385 1386 1387 1388 1389 1390 1391 1392 1393 21.6 Figure 6 shows that the /dev/sda3 partition has been mounted to the gentoo directory, and the gentoo directory is inside of the /mnt directory. The /mnt directory's name is short for mount and normally its purpose is to provide a place to mount removable storage devices, such as flash drives and CDROMs. In this case, however, we are using the /mnt/gentoo directory as a place to temporarily mount the partitions we have created so that we can place information on them. After we are done placing information on the /dev/sda1 and /dev/sda3 partitions, they will be capable of booting the PC without the help of the CD. 1394 1395 1396 1397 1398 1399 1400 21.7 As you study Figure 6, another thing you should notice is that a label has been added to the top of the figure which reads "Top-level root directory for the CD" and a label near the bottom of the figure has been added which reads "Top-level root directory for the hard drive". Both labels point to a '/' top-level root directory symbol, but the CD's top-level root directory is currently the active one. This means that if you type cd /, it will be the CD's root directory that you will be placed into. 1401 1402 1403 1404 1405 1406 21.8 What we are in the process of doing is creating a copy of the standard Gentoo Linux directory hierarchy on the /dev/sda3 partition. The next step is to create a directory called boot inside the /dev/sda3 '/' partition and then mount the /dev/sda1 boot partition to this directory. The command that creates directories is called mkdir and you must make sure you are in the /mnt/gentoo directory before using it: 1407 livecd gentoo # cd /mnt/gentoo 1408 1409 livecd gentoo # pwd /mnt/gentoo 1410 1411 livecd gentoo # ls lost+found Installing Gentoo Linux v1.81 1412 livecd gentoo # mkdir boot 1413 1414 livecd gentoo # ls boot lost+found 1415 livecd gentoo # mount /dev/sda1 /mnt/gentoo/boot 1416 1417 1418 1419 1420 21.9 The mkdir command creates a directory inside the current directory and, in this case, a directory called boot was created in the /mnt/gentoo directory. The /dev/sda1 boot partition was then mounted to this newlycreated boot directory so that it could be accessed. Lets change into the boot directory and see what it contains: 1421 livecd gentoo # cd boot 1422 1423 livecd boot # pwd /mnt/gentoo/boot 1424 1425 livecd boot # ls lost+found 1426 1427 1428 1429 21.10 Notice that the /mnt/gentoo/boot directory also contains a lost+found directory which means that the /dev/sda1 partition has been successfully mounted to it. The directory hierarchy now looks like the one shown in Figure 7. Figure 7 Top-level root directory / for the CD bin dev etc home lib opt mnt sys proc boot root usr sbin tmp var conf.d init.d cdrom Top-level root directory for the hard drive gentoo / livecd /dev/hda3 boot 1430 1431 1432 1433 1434 1435 50/124 /dev/hda1 22 Setting the system's date and time 22.1 Up until this point, we have not been concerned about whether or not the system's date and time were set correctly. Before we start adding files and directories to the /dev/sda3 root and /dev/sda2 boot partitions, the date and time need to be correct because each file and directory is given a timestamp of when it was created and incorrect timestamps will eventually v1.81 1436 1437 1438 1439 1440 1441 1442 1443 1444 Installing Gentoo Linux cause problems. 22.2 Check the system time using the date command: livecd boot # date Tue Sep 4 19:36:59 UTC 2007 22.3 The CD is configured to use Coordinated Universal Time (UTC) and if your system's date or time are incorrect, they can be set using the date command by passing it a new date in the format MMDDhhmmYYYY (Month, Day, hour, minute, Year). For example, to set the time to February 21st 17:32 2007, pass the parameter 022117322007 to the date command: 1445 livecd boot # date 022117322007 1446 Wed Feb 21 17:32:00 UTC 2007 1447 1448 1449 1450 1451 1452 1453 1454 51/124 22.4 The date command sets the operating system's copy of the date and time, but a separate copy of the date and time is kept on a clock chip on the motherboard. Each time the system boots, the time that is in the clock chip is used to initialize the operating system's date and time. If your system's time was incorrect and you used the date command to set it, you should also execute the following hwclock command to copy the operating system's time to the hardware clock: livecd boot # hwclock --systohc 1455 1456 1457 22.5 The hwclock command is used to communicate with the clock chip on the motherboard and the --systohc option tells the hwclock command to set the clock chip to the operating system's date and time. 1458 1459 23 Preparing to extract the standard Gentoo directory hierarchy into the /dev/sda3 top-level root partition 1460 1461 1462 1463 1464 1465 1466 23.1 As shown in Figure 7, we have reached the point where we have created a top-level '/' root directory in the /dev/sda3 root partition, created a directory called boot in this root directory, and mounted the /dev/sda1 boot partition to the boot directory. The boot directory is one of the standard directories that is in a Gentoo Linux system's top-level root directory and our next step is to place the rest of the standard Gentoo Linux directories into this root directory. Installing Gentoo Linux v1.81 1467 1468 1469 1470 52/124 23.2 Since Gentoo Linux systems use a standard directory hierarchy, the Gentoo installation process has users place a pre-created copy of this directory hierarchy onto their hard drives during the installation process. The steps involved in this process are as follows: 1471 1472 1473 1474 1) The Gentoo developers create a standard Gentoo Linux directory hierarchy from scratch on a Gentoo development machine. The programs, configuration information and documentation that are used on most Gentoo Linux systems is placed into this directory hierarchy. 1475 1476 2) The Gentoo developers place the complete directory hierarchy into a single compressed file and then generate one or more digest numbers (or digital fingerprints) for it. 1477 1478 3) The compressed file containing the directory hierarchy, along with the file containing the digest numbers, are placed on the Gentoo servers so that users can download them. 1479 1480 1481 1482 1483 23.3 The compressed file that contains the standard Gentoo Linux directory hierarchy we are going to use is called stage3-i686-xxx.tar.bz2 and its companion file that contains this file's digest numbers is called stage3stage3-i686-xxx.tar.bz2.DIGESTS. Both files can be obtained from http://206.21.94.61/gentoo using a program called wget (web get). 1484 1485 1486 23.4 We first make sure that we are inside of the /mnt/gentoo directory and then we can download both of these files into this directory using the wget program: 1487 livecd / # cd /mnt/gentoo 1488 1489 livecd gentoo # pwd /mnt/gentoo 1490 1491 livecd gentoo # ls boot lost+found 1492 1493 1494 1495 1496 1497 livecd gentoo # wget -c http://206.21.94.61/gentoo/stage3-i686-xxx.tar.bz2 --20:05:28-- http://206.21.94.61/stage3-i686-xxx.tar.bz2 => `stage3-i686-xxx.tar.bz2.1' Connecting to 206.21.94.61:80... connected. HTTP request sent, awaiting response... 200 OK Length: 107,915,722 (103M) [application/x-tar] 1498 12% [===> 1499 1500 1501 ] 13,561,630 89.27K/s ETA 17:59 23.5 After the stage3-i686-xxx.tar.bz2 file is finished downloading, make sure it is in the /mnt/gentoo directory: livecd gentoo # pwd v1.81 Installing Gentoo Linux 1502 /mnt/gentoo 1503 1504 1505 1506 1507 livecd gentoo # ls -l total 105513 drwxr-xr-x 3 root root 1024 Sep drwx------ 2 root root 16384 Sep -rw-r--r-- 1 root root 107915722 Sep 1508 1509 1510 1511 1512 1513 1514 1515 1516 53/124 4 18:08 boot 4 18:09 lost+found 6 2007 stage3-i686-xxx.tar.bz2 23.6 Now download the stage3-i686-xxx.tar.bz2.DIGESTS file that contains the digest numbers for the stage3-i686-xxx.tar.bz2 file. In order to avoid having to type the whole filename, try pressing the up arrow on your keyboard a few times. All the commands you have previously typed are held in the command line's history memory and they can be accessed by pressing the up arrow (pressing the down arrow moves forward through the history.) Keep going back through your command line history until you reach the wget command you typed earlier. Edit the filename by adding the word DIGESTS to the end of it and then execute the following command: 1517 1518 1519 1520 1521 1522 livecd gentoo # wget -c http://206.21.94.61/gentoo/stage3-i686-xxx.tar.bz2.DIGESTS --20:11:15-- http://206.21.94.61/stage3-i686-xxx.tar.bz2.DIGESTS => `stage3-i686-xxx.tar.bz2.DIGESTS' Connecting to 206.21.94.61:80... connected. HTTP request sent, awaiting response... 200 OK Length: 153 [application/x-tar] 1523 100%[==============================================>] 153 1524 20:11:15 (7.12 MB/s) - `stage3-i686-xxx.tar.bz2.DIGESTS' saved [153/153] 1525 1526 23.7 Execute the pwd and ls -l commands again to make sure that both files are in the /mnt/gentoo directory: 1527 1528 livecd gentoo # pwd /mnt/gentoo 1529 1530 1531 1532 1533 1534 livecd gentoo # ls -l total 105517 drwxr-xr-x 3 root root 1024 Sep drwx------ 2 root root 16384 Sep -rw-r--r-- 1 root root 107915722 Sep -rw-r--r-- 1 root root 153 Sep 1535 1536 1537 1538 1539 1540 1541 --.--K/s 4 18:08 boot 4 18:09 lost+found 6 2007 stage3-i686-xxx.tar.bz2 6 2007 stage3-i686-xxx.tar.bz2.DIGESTS 23.8 Now that both files have been successfully downloaded to the proper place, we need to calculate the digest number for the main file and check this number against the copy that is in the DIGESTS file. The GNU/Linux command that runs the MD5 digest algorithm on files is md5sum and a command that will copy the contents of a file to the screen is cat (concatenate): livecd gentoo # md5sum stage3-i686-xxx.tar.bz2 v1.81 Installing Gentoo Linux 1542 20768691de57b1f6575c826d3107d435 1543 1544 1545 livecd gentoo # cat stage3-i686-xxx.tar.bz2.DIGESTS -----BEGIN PGP SIGNED MESSAGE----Hash: SHA1 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 # MD5 HASH 20768691de57b1f6575c826d3107d435 ./stage3-i686-xxx.tar.bz2 # SHA1 HASH aa238bbe03f8e3726a47c4e5a56876ff182d8b64 ./stage3-i686-xxx.tar.bz2 # MD5 HASH 2d99869a6d44e0df66a8952575a3fb02 ./stage3-i686-xxx.tar.bz2.CONTENTS # SHA1 HASH 5c6f74b62fa6df43b524860727c6896f4b7ade5f ./stage3-i686-xxx.tar.bz2.CONTENTS -----BEGIN PGP SIGNATURE----Version: GnuPG v2.0.7 (GNU/Linux) 1556 1557 1558 1559 iD8DBQFIb5Z+nmQ4yBcHIFgRAnwYAJ4plKA2NRAYfEZWuUjM3JYcrc20cACgsr4S UvA+AdmNknpG/WaiIjZ9vDQ= =Ojv/ -----END PGP SIGNATURE----- 1560 1561 54/124 stage3-i686-xxx.tar.bz2 23.9 If both MD5 digest numbers match, then your stage3-i686-xxx.tar.bz2 file is not corrupted and we can move on to the next step. 1562 1563 24 Extracting the standard Gentoo directory hierarchy into the /dev/sda3 top-level root partition 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 24.1 As indicated earlier, the stage3-i686-xxx.tar.bz2 file contains the core of a standard Gentoo Linux directory hierarchy. The .tar part of the filename indicates that this directory hierarchy was placed into the Tape ARchive format. One of the earliest devices that computers used for storing information was the magnetic tape drive. Early UNIX machines had a utility program called tar that was used to copy files and directories to a single file (sometimes called a tarball) that could be saved on magnetic tape. The tar program could also take a tar file that was on a magnetic tape and convert it back to the original files and directories. UNIX-like operating systems, such as Gentoo Linux, still use the tar program but the archive files are used for more purposes than just storing on magnetic tape. One additional purpose is to send directory structures through the Internet. 1576 1577 1578 1579 1580 24.2 The .bz2 part of the stage3-i686-xxx.tar.bz2 file indicates that the tape archive information was compressed using the bzip2 compression algorithm. A compressed file is usually much smaller than the original and Gentoo Linux makes significant use of .tar.bz2 tarball files for copying directory structures, source code, and documentation to user's computers. Installing Gentoo Linux v1.81 1581 1582 1583 1584 55/124 24.3 Our next step is to unzip and untar the stage3-i686-xxx.tar.bz2 file that we placed into the /mnt/gentoo directory. This can be done in one step by changing to the /mnt/gentoo directory and executing the tar xvjpf command: 1585 livecd / # cd /mnt/gentoo 1586 1587 livecd gentoo # pwd /mnt/gentoo 1588 1589 livecd gentoo # ls boot lost+found stage3-i686-xxx.tar.bz2 1590 1591 livecd gentoo # tar xvjpf stage3-i686-xxx.tar.bz2 <snip> stage3-i686-xxx.tar.bz2.DIGESTS 1592 1593 1594 1595 1596 24.4 As soon as the command begins executing, a list of all of the files and directories that are being uncompressed and untared is shown on the screen. There are a significant number of files and directories in the archive so it will take a while for the process to complete. While you are waiting, lets look at the options that were passed to the tar command. 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 24.5 The x option indicates that we want to extract from an archive, not create one. The v option tells the tar command to be verbose with the information it prints to the screen during the extraction process. In verbose mode, the tar command will list the name of each file and directory to the screen as it is extracted. The j option tells the tar command that the archive has been compressed with the bzip2 algorithm and that it needs to be uncompressed before it can be untared. The p option indicates that the permissions for each directory and file should be preserved during the extraction process and the f option indicates that the archive is being extracted from a file. 1607 1608 24.6 After the extraction process is complete, execute the ls command to see the directories that have been created inside of your /mnt/gentoo directory: 1609 1610 livecd gentoo # pwd /mnt/gentoo 1611 1612 1613 1614 livecd gentoo # ls bin etc lost+found boot home mnt dev lib opt 1615 1616 1617 1618 proc root sbin stage3-i686-xxx.tar.bz2 stage3-i686-xxx.tar.bz2.DIGESTS sys tmp usr var 24.7 Your system's directory hierarchy should now look like the one shown in Figure 8 (keep in mind, however, that only the upper levels of both directory hierarchies are shown.) Having two almost identical directory hierarchies on a system makes it easy to become confused about which directory you Installing Gentoo Linux v1.81 1619 1620 are in, so be careful as you change directories and use the pwd command frequently to check where you are. Figure 8 Top-level root directory for the CD bin dev etc bin dev etc / home lib opt mnt sys proc boot root usr sbin tmp var conf.d init.d cdrom Top-level root directory for the hard drive 1621 56/124 gentoo / livecd /dev/hda3 /dev/hda1 home lib opt mnt sys proc boot root usr sbin tmp var 25 Downloading and extracting the portage tree 1622 1623 1624 1625 1626 1627 25.1 Before any more software can be installed on the hard drive, an archived copy of the Gentoo Linux portage tree needs to be downloaded and extracted. Portage is Gentoo's software package management system and a software package is what programs and data are usually placed into so that they can be easily sent over the Internet to a user's computer for installation. 1628 1629 1630 1631 1632 1633 1634 1635 25.2 Most GNU/Linux distributions use binary packages which means that the software has been precompiled and is ready for execution as soon as it is downloaded to the user's system and installed. Gentoo, however, does not use binary packages by default (although it is capable of using them). Instead, portage downloads the source code for applications that the user wants to install and compiles them right on the user's machine. It then installs the binary code that was generated during the compilation process into the proper directories inside the standard Gentoo directory structure. 1636 1637 1638 1639 25.3 The command that is used to download, compile, and install software packages on Gentoo system is called emerge and the instructions which tell emerge how to do this for each package are contained in the portage tree. The word tree as used here is another name for directory hierarchy. 1640 1641 1642 25.4 We will explore the contents of the portage tree in a moment but first you need to download a compressed archive of it onto your computer, check it to make sure it is not corrupted (using md5sum), and then extract v1.81 Installing Gentoo Linux 57/124 1643 1644 1645 1646 1647 it. Compressed archives of the portage tree are also called snapshots because the central copy of the portage tree on the Gentoo servers is constantly being updated by people all over the world. When a compressed archive of the tree is made at a given point in time, it is like taking a picture or snapshot of it, similar to the way that a camera takes a snapshot. 1648 1649 1650 1651 1652 1653 25.5 Make sure you are in the /mnt/gentoo directory and then obtain the portage snapshot that has been placed at http://206.21.94.61 (using wget). Next, obtain the companion digest file for the snapshot, generate a md5 digest number for the snapshot, and make sure the snapshot file is not corrupted. If the portage snapshot file is okay, then extract it using the tar xvjf command (note that the 'C' in the var command is a capital 'C'): 1654 1655 livecd gentoo # pwd /mnt/gentoo 1656 1657 1658 1659 1660 1661 livecd gentoo # wget -c http://206.21.94.61/gentoo/portage-xxx.tar.bz2 --20:37:48-- http://206.21.94.61/portage-xxx.tar.bz2 => `portage-xxx.tar.bz2' Connecting to 206.21.94.61:80... connected. HTTP request sent, awaiting response... 200 OK Length: 34,686,418 (33M) [application/x-tar] 1662 1663 100%[==============================================>] 34,686,418 00:00 1664 20:37:52 (8.58 MB/s) - `portage-xxx.tar.bz2' saved [34686418/34686418] 1665 1666 1667 1668 1669 1670 livecd gentoo # wget -c http://206.21.94.61/gentoo/portage-xxx.tar.bz2.md5sum --20:42:11-- http://206.21.94.61/portage-xxx.tar.bz2.md5sum => `portage-xxx.tar.bz2.md5sum' Connecting to 206.21.94.61:80... connected. HTTP request sent, awaiting response... 200 OK Length: 145 [application/x-tar] 1671 100%[==============================================>] 145 1672 20:42:11 (6.74 MB/s) - `portage-xxx.tar.bz2.md5sum' saved [145/145] 1673 1674 1675 1676 1677 1678 1679 1680 livecd gentoo # ls bin mnt boot opt dev portage-xxx.tar.bz2 etc portage-xxx.tar.bz2.md5sum home proc lib root lost+found sbin 1681 1682 livecd gentoo # md5sum portage-xxx.tar.bz2 92832322bfee5ee90cb37123c54cca47 portage-xxx.tar.bz2 1683 livecd gentoo # cat portage-xxx.tar.bz2.md5sum 8.76M/s --.--K/s stage3-i686-xxx.tar.bz2 stage3-i686-xxx.tar.bz2.DIGESTS sys tmp usr var ETA Installing Gentoo Linux v1.81 58/124 1684 1685 -----BEGIN PGP SIGNED MESSAGE----Hash: SHA1 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 # MD5 HASH 92832322bfee5ee90cb37123c54cca47 ./portage-xxx.tar.bz2 # SHA1 HASH 38e86b7cb48c9a36094160a24c4a81ff9fb2d6dc ./portage-xxx.tar.bz2 # MD5 HASH eeaa185966cb29795b2255c89215521e ./portage-xxx.tar.bz2.CONTENTS # SHA1 HASH 4e0197cbf9d5c7225b27fe2c9828fbb6fb3e5879 ./portage-xxx.tar.bz2.CONTENTS -----BEGIN PGP SIGNATURE----Version: GnuPG v2.0.7 (GNU/Linux) 1696 1697 1698 1699 iD8DBQFIb5bVnmQ4yBcHIFgRAvIiAKCyhn4jXlEJtkhp8rJVicWy8zikkACeMspP 7tKU5PpppSMC522CsNkI35E= =w82G -----END PGP SIGNATURE----- NOTE: The -C below is a capital C. 1700 livecd gentoo # tar xvjf portage-xxx.tar.bz2 -C /mnt/gentoo/usr 1701 1702 25.6 After the portage snapshot has finished being extracted, change into the usr directory and execute an ls command: 1703 livecd gentoo # cd usr 1704 1705 livecd gentoo # pwd /mnt/gentoo/usr 1706 1707 1708 livecd usr # ls bin i486-pc-linux-gnu 1709 1710 1711 i686-pc-linux-gnu include lib libexec local portage sbin share src tmp 25.7 When the portage snapshot was extracted, a directory called portage was created in the usr directory and it contains the portage tree. Now, change into the portage directory and execute another ls command: 1712 livecd usr # cd portage 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 livecd portage # ls app-accessibility dev-php5 app-admin dev-python app-antivirus dev-ruby app-arch dev-scheme app-backup dev-tcltk app-benchmarks dev-tex app-cdr dev-tinyos app-crypt dev-util app-dicts eclass app-doc games-action app-editors games-arcade app-emacs games-board app-emulation games-emulation media-gfx media-libs media-plugins media-radio media-sound media-tv media-video metadata net-analyzer net-dialup net-dns net-firewall net-fs sci-mathematics sci-misc sci-physics sci-visualization scripts sec-policy skel.ChangeLog skel.ebuild skel.metadata.xml sys-apps sys-auth sys-block sys-boot Installing Gentoo Linux v1.81 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 app-forensics app-i18n app-laptop app-misc app-mobilephone app-office app-pda app-portage app-shells app-text app-vim app-xemacs dev-ada dev-cpp dev-db dev-dotnet dev-embedded dev-games dev-haskell dev-java dev-lang dev-libs dev-lisp dev-ml dev-perl dev-php dev-php4 games-engines games-fps games-kids games-misc games-mud games-puzzle games-roguelike games-rpg games-server games-simulation games-sports games-strategy games-util gnome-base gnome-extra gnustep-apps gnustep-base gnustep-libs header.txt kde-base kde-misc licenses mail-client mail-filter mail-mta manifest1_obsolete media-fonts net-ftp net-im net-irc net-libs net-mail net-misc net-nds net-news net-nntp net-p2p net-print net-proxy net-voip net-wireless net-www net-zope perl-core profiles rox-base rox-extra sci-astronomy sci-biology sci-calculators sci-chemistry sci-electronics sci-geosciences sci-libs 59/124 sys-cluster sys-devel sys-freebsd sys-fs sys-kernel sys-libs sys-power sys-process virtual www-apache www-apps www-client www-misc www-servers x11-apps x11-base x11-drivers x11-libs x11-misc x11-plugins x11-proto x11-terms x11-themes x11-wm xfce-base xfce-extra 25.8 This is the portage tree and it contains a significant number of directories, each of which represents a package category. Each package category directory, in turn, contains subdirectories that hold the software packages that belong in a given category. Lets look inside one of the category directories, like games-puzzle, to see what packages it contains: 1759 1760 livecd portage # pwd /mnt/gentoo/usr/portage 1761 livecd portage # cd games-puzzle 1762 1763 livecd games-puzzle # pwd /mnt/gentoo/usr/portage/games-puzzle 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 livecd games-puzzle # ls 4stattack fish-fillets anagramarama flobopuyo angrydd galaxis arrows gemdropx atomix gemhun bastet glickomania braincurses glightoff codebreaker gnudoku concentration gnurobbo icebreaker jools kiki krystaldrop ksudoku lmarbles londonlaw lpairs ltris pathological pauker penguzzle picpuz pingus quadra quadros quintalign scramble tong toppler torrent trimines triptych-demo twindistress wakkabox xblockout xbomb Installing Gentoo Linux v1.81 1774 1775 1776 1777 1778 1779 1780 1781 construo cuyo drod-bin easysok einstein enigma ensemblist fbg greedy groundhog gtetrinet gtkballs gweled hangman hexamine hoh-bin magiccube4d metadata.xml mindless mirrormagic monsterz mures neverball ngstar sdlvexed seatris shaaft skoosh tetrinet textmaze tint tod 60/124 xlogical xpired xpuyopuyo xtris xwelltris xye 1782 1783 1784 1785 25.9 As you can see, the games-puzzle category directory contains quite a number of puzzle game software packages. Each game's directory holds information that tells the emerge command how to download the source code for the game, compile it, and install it. 1786 1787 1788 1789 1790 1791 25.10 Most of the category directories in the portage tree contain many software package directories and the whole portage tree currently contains more than 25000 software packages! After you have finished installing Gentoo Linux on your system, any of the 25000+ packages in the portage tree can be installed on your system simply by typing emerge <package name>. 1792 1793 25.11 Figure 9 shows that the portage tree exists within the usr directory that has been placed on the /dev/sda3 root partition. 1794 25.12 THIS IS A GOOD STOPPING POINT. Figure 9 Top-level root directory / for the CD bin dev etc home lib opt mnt sys proc boot root usr sbin tmp var conf.d init.d cdrom Top-level root directory for the hard drive bin dev etc gentoo / livecd /dev/hda3 home lib opt mnt sys proc boot root usr sbin tmp var Portage tree 1795 1796 /dev/hda1 portage 26 Changing the top-level root directory from the CD to the /dev/sda3 root partition v1.81 1797 1798 Installing Gentoo Linux 61/124 26.1 Before proceeding, lets list the steps of the installation process we have accomplished so far: 1799 1800 1) Downloaded the Gentoo minimal LiveCD .iso image and burned it onto a CDROM (or installed it into a virtual machine). 1801 2) Booted a PC using this LiveCD image. 1802 3) Partitioned the main hard drive. 1803 4) Mounted the /dev/sda3 root partition to the /mnt/gentoo directory. 1804 5) Mounted the /dev/sda1 boot partition to the /mnt/gentoo/boot directory. 1805 1806 6) Downloaded a compressed tar file (which contained the core of a standard Gentoo directory structure) and extracted it into the /mnt/gentoo directory. 1807 1808 7) Downloaded a compressed tar file which contained a snapshot of the portage tree and extracted it into the /mnt/gentoo/usr/portage directory. 1809 1810 1811 1812 1813 1814 1815 26.2 We have accomplished quite a bit up to this point and we now have most of the parts of a standard Gentoo directory structure sitting on the /dev/sda3 root partition (which is mounted to the /mnt/gentoo directory). In fact, enough of a standard Gentoo directory structure exists on /dev/sda3 root partition that we could change into the /mnt/gentoo directory, imagine that the CD's directory structure did not exist anymore, and pretend that the /dev/sda3 root partition was the new active top-level root directory. 1816 1817 1818 1819 1820 26.3 Actually, this is exactly what we are going to do using the chroot (Change Root) command! Figure 10 shows the complete directory hierarchy that we have been working with up to this point. The red arrow indicates that the active top-level root directory is about to be changed to the /dev/sda3 root partition: Installing Gentoo Linux v1.81 Figure 10 Top-level root directory for the CD bin dev etc etc Change the active root directory from the CD to the /dev/hda3 root partition home lib opt mnt sys proc boot root usr sbin tmp var conf.d init.d cdrom Top-level root directory for the hard drive bin dev / gentoo / livecd /dev/hda3 /dev/hda1 home lib opt mnt sys proc boot root usr sbin tmp var Portage tree 1821 1822 62/124 portage 26.4 After executing the chroot command, the directory hierarchy will look like the one shown in Figure 11: Figure 11 New active top-level root directory bin dev etc / /dev/hda3 /dev/hda1 home lib opt mnt sys proc boot root usr sbin tmp var Portage tree portage 1823 1824 1825 1826 26.5 The CD's directory hierarchy looks like it has disappeared and all that is left is the directory hierarchy we have been putting together on the /dev/sda3 root partition. The CD's directory will still exist after the chroot command is executed, it will just be hidden temporarily. 1827 1828 1829 26.6 Before executing the chroot command, however, we must make 3 items that are in the CD's directory hierarchy available within our new directory hierarchy. 1830 1831 1832 1833 26.7 The first item is a file called resolv.conf and the original copy exists in the /etc directory. The resolv.conf file contains the network information that was returned by the DHCP request that we talked about earlier when the machine was first booted. This network information will be needed in Installing Gentoo Linux v1.81 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 63/124 our new directory hierarchy and it can be copied there using the following cp command (the '-L' tells the cp command to copy the target of any symbolic links): livecd / # cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf Note for VirtualBox users, if your /etc folder contains resolv.conf-eth0.sv, then copy this file to /mnt/gentoo/etc also. 26.8 The second item that needs to be made available in the new directory hierarchy is the CD's whole /dev directory. Instead of copying everything in the CD's /dev directory to the new /mnt/gentoo/dev directory, however, we will use the mount command simply to bind our new /dev directory to the original one: livecd / # mount -o bind /dev /mnt/gentoo/dev 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 26.9 The third and final item that needs to be made available in the new directory hierarchy is the CD's /proc directory. The proc directory is a special directory because it does not exist as a filesystem on any storage device. What the proc directory does is to make information that exists in the currently running kernel available in the form of files. Using the terminology of interfaces we discussed earlier, certain information in the kernel is made to implement the file interface so that this information can be accessed using the same tools that are used to access all other files. In fact, most of the resources that are contained in a UNIX-like system are made to implement the file interface so that they can all be treated in a uniform way. This is one of the aspects of UNIX-like systems that give them their great power. 1858 1859 1860 26.10 Before we make the CD's /proc directory available in the new directory hierarchy, lets look inside of it to see what is there. Change into the /proc directory and execute the ls command: 1861 livecd / # cd /proc 1862 1863 livecd proc # pwd /proc 1864 1865 1866 1867 1868 1869 1870 1871 1872 livecd 1 1170 122 123 124 125 12935 13422 proc # 13764 13766 13773 1396 1397 2 2803 283 ls 3535 38 39 4 4803 5 6 6234 8877 8878 8879 8880 9020 9023 97 acpi cpuinfo crypto devices diskstats dma driver execdomains fb iomem ioports irq kmsg loadavg locks mdstat meminfo mtrr net partitions scsi self slabinfo speakup stat tty uptime version vmstat zoneinfo Installing Gentoo Linux v1.81 1873 1874 1875 1876 13644 13684 13687 13699 2907 2908 2909 3 6398 6657 785 788 buddyinfo bus cmdline config.gz filesystems fs ide interrupts misc modules mounts mpt 64/124 swaps sys sysrq-trigger sysvipc 1877 1878 1879 1880 26.11 There is a significant amount of information about the currently running kernel present in the /proc directory, but we are only going to look at a few items at this time. Lets start by looking inside of the cpuinfo file using the cat command: 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 livecd proc # cat cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 15 model : 36 model name : AMD Turion(tm) 64 Mobile ML-40 stepping : 2 cpu MHz : 2198.905 cache size : 1024 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow up pni lahf_lm ts fid vid ttp tm stc bogomips : 4403.07 1902 1903 1904 1905 26.12 The cpuinfo file on my computer indicates that the CPU it contains is an AMD Turion 64 Mobile running at a frequency of 2198.905 Megahertz. The other information in this file will become useful when you learn more about CPUs. 1906 26.13 Next, lets look inside the version and uptime files: 1907 1908 1909 1910 1911 livecd proc # cat version Linux version 2.6.19-gentoo-r5 (root@kagome) (gcc version 4.1.1 (Gentoo 4.1.1-r3)) #1 SMP Tue Apr 3 01:19:22 UTC 2007 livecd proc # cat uptime 4748.77 4715.05 1912 1913 1914 1915 1916 26.14 The version file contains information about the currently running kernel, including its version number, the version of the compiler that was used to build it, and the date it was built. The uptime file contains the number of seconds that the computer has been running along with how much of that time the CPU was idle. Installing Gentoo Linux v1.81 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 65/124 26.15 Finally, look inside the partitions file and the mounts file: livecd proc # cat partitions major minor #blocks name 7 3 3 3 3 0 0 1 2 3 44592 20971520 31626 500377 20439405 loop0 sda sda1 sda2 sda3 livecd proc # cat mounts rootfs / rootfs rw 0 0 tmpfs / tmpfs rw 0 0 /dev/hdc /mnt/cdrom iso9660 ro 0 0 /dev/loop0 /mnt/livecd squashfs ro 0 0 proc /proc proc rw,nosuid,nodev,noexec 0 0 sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0 udev /dev tmpfs rw,nosuid 0 0 devpts /dev/pts devpts rw,nosuid,noexec 0 0 tmpfs /mnt/livecd/lib/firmware tmpfs rw 0 0 tmpfs /mnt/livecd/usr/portage tmpfs rw 0 0 usbfs /proc/bus/usb usbfs rw,nosuid,noexec 0 0 /dev/sda3 /mnt/gentoo ext3 rw,data=ordered 0 0 /dev/sda1 /mnt/gentoo/boot ext2 rw 0 0 udev /mnt/gentoo/dev tmpfs rw,nosuid 0 0 1940 1941 1942 1943 1944 1945 1946 26.16 The partitions file contains a list of the partitions that the kernel is currently aware of. Notice that the sda1, sda2, sda3 partitions are listed there. The mounts file contains a list of all of the currently mounted filesystems along with where in the directory hierarchy they are mounted. The sda3 and sda1 partitions are listed as being mounted to the /mnt/gentoo and /mnt/gentoo/boot directories because this is where we mounted them. 1947 1948 1949 1950 1951 26.17 The /proc directory is also in the list and it is now time to make it available inside the new directory hierarchy. Since the /proc directory is really just information in the kernel that implements the file interface, we will simply mount this information a second time to the /mnt/gentoo/proc directory: 1952 1953 1954 1955 livecd proc # mount -t proc none /mnt/gentoo/proc 26.18 Now we are finally ready to change the active root from the CD's toplevel root directory (/) to the top-level root directory of the new directory hierarchy (/mnt/gentoo): 1956 livecd proc # chroot /mnt/gentoo /bin/bash 1957 livecd / # pwd v1.81 Installing Gentoo Linux 1958 / 1959 1960 1961 1962 1963 1964 1965 1966 livecd / # ls bin mnt boot opt dev portage-xxx.tar.bz2 etc portage-xxx.tar.bz2.md5sum home proc lib root lost+found sbin 1967 1968 1969 1970 1971 1972 66/124 stage3-i686-xxx.tar.bz2 stage3-i686-xxx.tar.bz2.DIGESTS sys tmp usr var 26.19 The change of the active top-level root directory has now been accomplished. Notice that the after the chroot command was finished, we were placed into the top-level directory of the new directory hierarchy. In order to make sure that the active root directory was successfully transfered, execute a cd / command and see if we are still in the root directory of the new directory hierarchy: 1973 livecd / # cd / 1974 1975 livecd / # pwd / 1976 1977 1978 1979 1980 1981 1982 1983 livecd / # ls bin mnt boot opt dev portage-xxx.tar.bz2 etc portage-xxx.tar.bz2.md5sum home proc lib root lost+found sbin stage3-i686-xxx.tar.bz2 stage3-i686-xxx.tar.bz2.DIGESTS sys tmp usr var 1984 1985 26.20 The cd / command did not change us to the CD's top-level root directory so the chroot command must have succeeded. 1986 1987 26.21 Before we can use the new directory hierarchy, however, both the envupdate and the source /etc/profile commands need to be executed: 1988 1989 livecd / # env-update >>> Regenerating /etc/ld.so.cache... 1990 livecd / # source /etc/profile 1991 1992 1993 1994 26.22 It does not seem that these two commands accomplish anything, but they do and the explanation for what was accomplished is related to what a shell is. 27 Terminals and shells: interfaces to the operating system v1.81 Installing Gentoo Linux 67/124 1995 1996 1997 1998 27.1 In the days before personal computers, the most common kinds of computers were mainframe computers and minicomputers. Many mainframe computers were so large that one or more rooms were required to hold them. The following picture shows a typical mainframe computer: 1999 2000 27.2 Minicomputers were smaller than mainframes but they were still larger than personal computers. Installing Gentoo Linux v1.81 2001 2002 2003 2004 2005 2006 2007 27.3 Both mainframes and minicomputers, however, often used devices called dumb terminals to allow humans to interact with them. The word dumb meant that the device did not have a computer inside of it and it relied on the mainframe (or the minicomputer) it was attached to for all processing chores. The word terminal meant that the devices were attached to the end of a cable which had its other end plugged into the computer (see Figure 12): Figure 12 Terminal 2008 2009 2010 2011 2012 68/124 Communications cable Mainframe or Minicomputer 27.4 The first kind of terminals were similar in design to typewriters and they were called teletypes. Whatever was typed on the keyboard was displayed on the typewriter paper and also sent electronically to the computer. Output from the computer was also typed on the typewriter paper so that the user could see it: v1.81 Installing Gentoo Linux 69/124 2013 2014 2015 2016 27.5 Later, terminals were built which used CRTs (Cathode Ray Tubes) instead of typewriter paper for displaying input from the user and output from the computer: 2017 2018 27.6 Inside the computer, a special program was needed that would primarily do the following things 2: 2019 2020 - Accept commands that were typed at the terminal and, if they were not commands meant for the program itself, pass them to the operating system. Installing Gentoo Linux v1.81 2021 2022 2023 2024 2025 2026 70/124 - Take output from the operating system and send it to the terminal. 27.7 The name which was given to this special type of program was "shell" because it can be thought to cover or hide the details of the operating system from the user. Shells are also known as command line interfaces and we have been using a shell to communicate with the operating system since we first booted the computer from the CD (see Figure 13): Figure 13 Terminal Communications cable Mainframe or Minicomputer Shell Operating system 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 27.8 If we have been communicating with a shell program during the installation process, what have we been using as a terminal? When personal computers started to become available in the late 1970s and early 1980s, people began interfacing them to mainframes and minicomputers just like dumb terminals had been. Since PCs were computers themselves, programs could be run on them that emulated all the functions of a dumb terminal and these program were called terminal emulators. The shell programs on the mainframes or minicomputers that the terminal emulators were communicating with had no idea whether they were talking to actual dumb terminals or terminal emulator programs running on PCs. 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 27.9 When UNIX-like operating systems began to be run on PCs during the late 1980s and early 1990s, an interesting thing happened. The terminal emulator programs that had previously been used to communicate with shell programs on external mainframes and minicomputers through cables were now used to communicate with shell programs that were running on the PC itself! By the way, emulated terminals are also called virtual terminals. This technique of using a terminal emulator to communicate with a UNIX-like operating system running on the same PC is still in use today and we have been using a terminal emulator to communicate with the Gentoo Linux operating system that was booted from the CD. 2047 2048 2049 2050 2051 2052 27.10 In fact, not just 1 terminal emulator program was run when you booted your system from the CD, but 6 of them were! The way that you can switch between the 6 terminal emulator programs is by holding down the <alt> key on your keyboard and pressing either the <F1>, <F2>, <F3>, <F4>, <F5> or <F6> keys. The default terminal emulator is accessed by pressing <alt><F1> and it is the one we have been using since the beginning of the v1.81 Installing Gentoo Linux 71/124 2053 2054 2055 2056 2057 2058 installation process. Try switching to the second terminal emulator by pressing <alt><F2> and then execute a pwd command to see where it is in the directory hierarchy. Move around the directory hierarchy using the cd command and use the ls command to see the contents of these directories. You can switch to terminal emulators 3 - 6 and experiment with them too if you would like. 2059 2060 2061 2062 2063 2064 27.11 Each terminal emulator is like a different window which can be used to view the same directory hierarchy. Terminal emulators 2 - 6 have not had the chroot command executed in them and therefore they each have the top-level root directory of the CD as their active root directory. When you are done experimenting, press the <alt><F1> keys in order to switch back to the chrooted environment in the default terminal emulator. 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 28 Customizing the shell that is being used by the default terminal emulator 28.1 Now that we have used the chroot command to change the active root of the default terminal to the /dev/sda3 root partition, it would be nice to have the command prompt indicate this. The way this is done is by changing a variable in the shell program that the terminal is communicating with. A variable is a name that has been associated with a memory location (or a set of memory locations) so that humans do not need to refer to it by its address. A shell program has a number of variables (called environment variables) that hold configuration data which tells the shell how to operate. The environment variables of the current shell can be viewed using the set command: livecd / # set BASH=/bin/bash BASH_ARGC=() BASH_ARGV=() BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="3" [1]="1" [2]="17" [3]="1" [4]="release" [5]="i686-pc-linuxgnu") BASH_VERSION='3.1.17(1)-release' COLUMNS=81 CONFIG_PROTECT_MASK=/etc/terminfo CVS_RSH=ssh DIRSTACK=() EDITOR=/bin/nano EUID=0 GCC_SPECS= GROUPS=() GUILE_LOAD_PATH=/usr/share/guile/1.6 G_BROKEN_FILENAMES=1 v1.81 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 Installing Gentoo Linux 72/124 G_FILENAME_ENCODING=UTF-8 HISTFILE=/root/.bash_history HISTFILESIZE=500 HISTSIZE=500 HOME=/root HOSTNAME=livecd HOSTTYPE=i686 IFS=$' \t\n' INFOPATH=/usr/share/info:/usr/share/binutils-data/i686-pc-linuxgnu/2.16.1/info:/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/info LESS='-R -M --shift 5' LESSOPEN='|lesspipe.sh %s' LINES=22 LOGNAME=root MACHTYPE=i686-pc-linux-gnu MAIL=/var/mail/root MAILCHECK=60 MANPATH=/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/i686-pc-linuxgnu/2.16.1/man:/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/man OLDPWD=/ OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PAGER=/usr/bin/less PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/i68 6-pc-linux-gnu/gcc-bin/4.1.1 PIPESTATUS=([0]="0") PPID=13687 PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' PS2='> ' PS4='+ ' PWD=/ PYTHONPATH=/usr/lib/portage/pym SHELL=/bin/bash SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor SHLVL=2 SSH_CLIENT='206.21.94.183 48535 22' SSH_CONNECTION='206.21.94.183 48535 206.21.94.238 22' SSH_TTY=/dev/pts/0 TERM=xterm UID=0 USER=root _=/etc/profile 28.2 As you can see, shells can contain a large number of environment variables! We are not going to discuss what all of these variables do at this time, but we will talk about some of them in a moment. First, however, notice that each environment variable is listed in the form of VARIABLE_NAME = <VALUE>. The name of the environment variable is on the left side of the '=' sign and the data that the variable is associated with is on the right side of the sign. Here is more information about the v1.81 2147 Installing Gentoo Linux 73/124 environment variables that have been highlighted in the above list: 2148 2149 SHELL - The name of the current shell program is called 'bash' (which stands for Bourne again shell) and it is located in the /bin directory. 2150 TERM - The terminal emulation program that is currently being used is called xterm. 2151 2152 2153 2154 2155 2156 PATH - When the name of a command is typed at the command line, the shell looks inside each of the directory paths listed in the PATH variable to locate the program that implements the command. The first path in the list is searched first, then the next path in the list is searched and so on (paths are separated by a colon ':'). If the program is found it is executed and if it is not found, then the shell outputs a "command not found" error message. 2157 2158 LINES - The number of lines or rows of information that the current terminal is configured to display. 2159 PWD - Holds the path of the current working directory. 2160 PS1 - Determines what is displayed in the command prompt. 2161 2162 2163 2164 2165 2166 2167 28.3 If we want to change our command prompt so that it indicates we are currently in a chroot environment, then the PS1 shell environment variable need to have new information added to it. An explanation of the strange pattern of symbols that the PS1 variable currently contains is beyond what I want to discuss at this point. Fortunately, you will not need to understand them in order to add the information needed to indicate we are now in a chroot environment. 2168 2169 2170 28.4 The export command is used to change the shell's environment variables. Execute the following export command and notice what happens to the command prompt (note the dollar sign '$' in front of the second PS1): 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 livecd / # export PS1="(chroot) $PS1" (chroot) livecd / # 28.5 We just told the export command to set the PS1 environment variable to the characters (chroot) followed by the current contents of the PS1 variable (whenever a $ is placed in front of an environment variable name, this means to use the information that the variable is holding, not the name of the variable). If you execute another set command, you will find that the PS1 variable now holds the following information: PS1='(chroot) \[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' 28.6 Notice that the characters (chroot) have indeed been placed before the characters that were originally in the variable and now (chroot) will be present on the command line's prompt until we either change the PS1 v1.81 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 Installing Gentoo Linux 74/124 variable again or exit the chroot environment. 28.7 Now that you know what shell environment variables are, we can explain what the env-update and source /etc/profile commands did that we executed earlier. Each time that a shell program is launched, it has its environment variables set by running the source /etc/profile program. The env-update program maintains the information database that the source /etc/profile command uses to set the environment variables. When we executed the chroot command, our environment changed. We updated the environment database with the env-update command and then updated the environment variables in our currently running shell by executing the source /etc/profile command. 29 The nano text editor 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 29.1 A significant part of installing and configuring GNU/Linux consists of editing configuration files. These files are usually in text format which means that they only hold plain typed characters without any additional formatting information. In contrast to this, a word processor file not only holds typed characters, it contains extra information about these typed characters (such as bold, indenting, font, font size, etc). The various GNU/Linux programs that read the information that is present in configuration files would not know what to do with any extra formatting information that may be present. This is why all configuration files need to be created and edited by a text editor and not a word processor. 2205 2206 2207 2208 29.2 The most commonly used text editor on Gentoo systems is called nano. Lets experiment with nano a bit before we begin editing configuration files with it. Change into the /tmp directory in the chrooted environment and execute nano with the following options: 2209 (chroot) livecd / # cd /tmp 2210 2211 (chroot) livecd tmp # pwd /tmp 2212 (chroot) livecd tmp # ls 2213 (chroot) livecd tmp # nano -wc test.txt 2214 2215 2216 2217 2218 29.3 Since no files or directories were listed when we executed the ls command, this means that the /tmp directory is currently empty. The 'w' option tells nano to allow lines that are over 80 characters wide and the 'c' option shows the line number and column of where the cursor is currently at. The 'test.txt' parameter tells nano to create a file called test.txt in the Installing Gentoo Linux v1.81 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 75/124 current directory when the file is saved. 29.4 Now that we are working inside the directory hierarchy which is on the hard drive, there are commands available to us that were not present on the CD. One of these commands is called man and it stands for manual. Most of the programs on a GNU/Linux system have manual pages written for them which give information about what the program does and what options can be passed to it. For example, if you want to read about what the cat command does, simply type man cat at the command prompt and use the up and down arrow keys to move through the document (press the 'q' key to quit): (chroot) livecd /tmp # man cat Formatting page, please wait... 2231 2232 2233 29.5 You can look at the man pages for any of the commands we have used up to this point (such as ls, cd and hexdump) and you can also read the man page for nano. 2234 2235 2236 2237 29.6 When nano is executed, it shows a screen which should look similar to the one shown below. Type the sentences "This is a test text file." and "The only thing that this file contains is plain text characters." (which are shown in blue) into the editor window: 2238 GNU nano 1.3.11 File: test.txt 2239 This is a test text file. 2240 The only thing that this file contains is plain text characters. 2241 2242 2243 ^G Get Help ^X Exit 2244 2245 2246 2247 Modified [ line 3/4 (75%), col 65/65 (100%), char 91/92 (98%) ] ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos ^J Justify ^W Where Is ^V Next Page ^U UnCut Txt ^T To Spell 29.7 The way that commands are given to nano while it is running is by pressing the <ctrl> key and a letter. Commands are shown at the bottom of nano's window and the <ctrl> key is indicated by the '^' character. After you have typed the 2 sentences, press the <ctrl> O keys to save the file. v1.81 2248 2249 2250 2251 2252 Installing Gentoo Linux 76/124 Nano will then have you confirm that you want to save the file with the name "test.txt" at the bottom of the screen: File Name to Write: test.txt ^G Get Help ^T To Files ^C Cancel M-D DOS Format M-M Mac Format M-A Append M-P Prepend M-B Backup File 2253 2254 29.8 Press the <enter> key to confirm the file name and then press <ctrl> X in order to exit nano and return to the shell's command line. 2255 2256 29.9 Execute an ls -l command to make sure that the file was indeed created by nano: 2257 2258 2259 2260 2261 2262 2263 (chroot) livecd tmp # ls -l total 4 -rw-r--r-- 1 root root 92 Feb 4 08:36 test.txt 29.10 The listing indicates that a file named test.txt is now present in the /tmp directory and that it is 92 bytes long. In order to verify that the sentences you typed in nano are now contained in the file, you can execute a cat test.txt command: 2264 2265 (chroot) livecd tmp # cat test.txt This is a test text file. 2266 The only thing that this file contains is plain text characters. 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 29.11 For a more detailed view of the characters in this file, execute a hexdump -C test.txt command (Note: the 'C' is capitalized): (chroot) livecd tmp # hexdump -C test.txt 00000000 54 68 69 73 20 69 73 20 61 20 74 00000010 65 78 74 20 66 69 6c 65 2e 0a 0a 00000020 6e 6c 79 20 74 68 69 6e 67 20 74 00000030 68 69 73 20 66 69 6c 65 20 63 6f 00000040 73 20 69 73 20 70 6c 61 69 6e 20 00000050 63 68 61 72 61 63 74 65 72 73 2e 0000005c 65 54 68 6e 74 0a 73 68 61 74 65 74 65 74 61 78 20 20 20 69 74 74 6f 74 6e 20 |This is a test t| |ext file...The o| |nly thing that t| |his file contain| |s is plain text | |characters..| 29.12 The -C option tells the hexdump command to print 16 characters per line. The hexadecimal number that is associated with each character shown in the middle column and the ASCII characters themselves are shown in the right column. ASCII stands for American Code for Information Interchange and it is a widely used standard which associates the numbers 0-127 decimal (or 0-7F hex) with the characters shown in Table 1. Installing Gentoo Linux v1.81 77/124 ASCII ( American Standard Code for Information Interchange ) Chart Dec 10 13 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 Hex Char 0a Linefeed/Newline 0d Carriage Return 20 Space 21 ! 22 " 23 # 24 $ 25 % 26 & 27 ' 28 ( 29 ) 2A * 2B + 2C , 2D 2E . 2F / 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 3A : 3B ; 3C < 3D = 3E > Dec 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 Hex Char 3F ? 40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4A J 4B K 4C L 4D M 4E N 4F O 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5A Z 5B [ 5C \ 5D ] 5E ^ 5F _ Dec 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 Hex Char 60 ` 61 a 62 b 63 c 64 d 65 e 66 f 67 g 68 h 69 i 6A j 6B k 6C l 6D m 6E n 6F o 70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w 78 x 79 y 7A z 7B { 7C | 7D } 7E ~ Table 1 2284 2285 2286 2287 2288 2289 29.13 In the above HexDump output, the first word of the first sentence that was typed into the test.txt file is "This". Notice that the hex number that is associated with the letter 'T' is 54. The letter 'h' is associated with 68, the letter 'i' is associated with 69 and the letter 's' is associated with 73. The spaces between the words are represented by the number 20, newlines are represented by 0a and periods are represented by 2e. 2290 2291 2292 29.14 Now that you know what a text file is and how to use the nano editor, we will use nano in the next section to edit the configuration file that holds the main compile options for a Gentoo Linux system. v1.81 2293 Installing Gentoo Linux 78/124 30 USE flags 2294 2295 2296 2297 2298 2299 2300 2301 30.1 Earlier I indicated that "a GNU/Linux distribution is usually put together by a group of experienced developers who copy the software needed to create a GNU/Linux distribution into one place, compile and configure it and then make the result available to others". Gentoo is unique, however, because instead of its experienced developers devoting their time to creating a distribution, they created a software system (called portage) which generates a customized GNU/Linux distribution automatically on the user's machine. 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 30.2 As we discussed previously, each package in the portage tree contains instructions which tell the emerge program how to obtain the package's source code, compile it, configure it, and install the files that are generated into the proper places in the directory hierarchy. The way that portage enables users to customize how packages are built and configured is through a mechanism called USE flags. A common definition for a flag is "a piece of cloth used as a signaling device." USE flags are also a kind of signaling device except they use keywords instead of pieces of cloth and they allow users to communicate their package building and configuration choices to portage. 2312 2313 2314 30.3 Portage uses 2 kinds of USE flags which are global USE flags and local USE flags. Global USE flags are flags that are used by multiple packages and local USE flags are only used by a single package. 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 30.4 Examples of USE flag keywords include gtk, gnome, dvd and cdr. A list of the global USE flags and their descriptions can be found in the /usr/portage/profiles/use.desc file and a list of the local USE flags can be found in the /usr/portage/profiles/use.local.desc file. Instead of using the more command to look at the contents of these files, however, you can use an improved version of more called less. One of the improvements that less has is the ability to scroll up and down through a file using the up and down arrow keys. Change into the /usr/portage/profiles directory and use the less command to look at the use.desc file (press the 'q' key to exit the less command): 2325 (chroot) livecd / # cd /usr/portage/profiles/ 2326 2327 (chroot) livecd profiles # pwd /usr/portage/profiles 2328 2329 2330 2331 (chroot) livecd profiles # ls ChangeLog default-darwin info_pkgs arch.list default-linux info_vars base desc obsolete repo_name selinux thirdpartymirrors use.desc use.local.desc Installing Gentoo Linux v1.81 2332 2333 categories default-bsd 2334 (chroot) livecd profiles # less use.desc 2335 2336 2337 2338 2339 2340 embedded hardened package.mask profiles.desc 79/124 uclibc updates 30.5 You can also look through the use.local.desc file if you would like. At this point you do not need to fully understand what all of these USE flags actually do, but you should at least understand that they are used to customize your Gentoo installation. (Note: type the 'q' key to exit the 'less' command.) 31 The /etc/make.conf file 2341 2342 2343 2344 2345 31.1 Now that you know what USE flags are, we next need to cover where they are placed so that portage can find them. Inside the /etc directory is a file called make.conf and it is the main place that portage looks for USE flags. Portage also looks in other places for USE flags, but we are not going to discuss these other places at this time. 2346 2347 2348 31.2 Lets look at what the make.conf file currently contains and then we will add a small number of USE flags to this file for portage to use. Change into the /etc directory and execute a cat make.conf command: 2349 (chroot) livecd etc # cd /etc 2350 2351 (chroot) livecd etc # pwd /etc 2352 2353 2354 2355 2356 2357 2358 2359 2360 (chroot) livecd etc # cat make.conf # These settings were set by the catalyst build script that automatically # built this stage. # Please consult /etc/make.conf.example for a more detailed example. CFLAGS="-O2 -march=i686 -pipe" CXXFLAGS="${CFLAGS}" # This should not be changed unless you know exactly what you are doing. You # should probably be using a different stage, instead. CHOST="i686-pc-linux-gnu" 2361 2362 2363 2364 2365 2366 2367 2368 31.3 CFLAGS, CHOST, AND CXXFLAGS are variables which contain configuration information that portage will use to build packages. The CFLAGS and CXXFLAGS variables allow portage to configure the compiler that will be used to compile the packages on your system. For example, the -march=i686 flag tells the compiler to only generate machine language instructions that can be understood by i686 and later processors. We are not going to discuss what the CHOST variable does but if you are interested you can look at the man page for the make.conf file to learn about it. v1.81 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 Installing Gentoo Linux 80/124 31.4 Our next step is to add a variable called USE to the make.conf file which contains the USE flag information we want to pass to portage. Edit the make.conf file with nano , add the line highlighted in red below to it and then save the file (make sure you remember to type the quotes at the beginning and end of the list): # These settings were set by the catalyst build script that automatically # built this stage. # Please consult /etc/make.conf.example for a more detailed example. CFLAGS="-O2 -march=i686 -pipe" CXXFLAGS="${CFLAGS}" # This should not be changed unless you know exactly what you are doing. You # should probably be using a different stage, instead. CHOST="i686-pc-linux-gnu" USE="gtk gnome -kde X dvd alsa cdr" 31.5 The gtk and gnome flags will be explained when we add GUI and desktop software to our system. Any flag with a negative sign in front of it means that support for the capabilities that flag indicates should not be added to packages. In this case, we do not want support for the kde desktop. Descriptions for the rest of the flags in this list can be found in the /usr/portage/profiles/use.desc file. 32 Emerging the kernel's source code 2390 2391 2392 2393 2394 32.1 We are now about 2/3 of the way through the base installation process and quickly approaching its climax (which is the configuration, compilation, and installation of the kernel). Before we proceed, however, I would like to take a few moments to reflect on the material we have covered up to this point. 2395 2396 2397 2398 2399 2400 2401 32.2 If you have made it this far, then you have seen for yourself that there is a significant amount of detailed information that is associated with manually installing a UNIX-like operating system. You are not going to fully understand all of this information by just going through the installation process one time. I was not truly comfortable with this material myself until after I had installed Gentoo at least 5 times and I bet it will take you this many times to be comfortable with it too. 2402 2403 2404 2405 2406 2407 32.3 Therefore, if you are concerned that you are not completely understanding all of the information we have covered so far, my advice to you is to not worry too much about this. Continue to work hard, understand as much as you can, and then rest easy knowing that much of this material will sink in only after you have gone through the installation process a number of times. v1.81 Installing Gentoo Linux 81/124 2408 2409 2410 2411 2412 32.4 Now that you have had a small pep talk, lets proceed with configuring and installing the Linux kernel. Properly configuring and installing the Linux kernel is not easy, but it is not that difficult either. The good news is that after the kernel has been installed, we will be nearing the end of the installation process. 2413 2414 2415 32.5 Before the kernel can be installed, however, the computer system needs to be told which timezone it is in. Change into the /usr/share/zoneinfo directory, list its contents, and locate your timezone: 2416 (chroot) livecd / # cd /usr/share/zoneinfo 2417 2418 (chroot) livecd zoneinfo # pwd /usr/share/zoneinfo 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 (chroot) livecd zoneinfo # ls Africa Canada Factory America Chile GB Antarctica Cuba GB-Eire Arctic EET GMT Asia EST GMT+0 Atlantic EST5EDT GMT-0 Australia Egypt GMT0 Brazil Eire Greenwich CET Etc HST CST6CDT Europe Hongkong 2430 2431 2432 2433 2434 2435 Iceland Indian Iran Israel Jamaica Japan Kwajalein Libya MET MST MST7MDT Mexico Mideast NZ NZ-CHAT Navajo PRC PST8PDT Pacific Poland Portugal ROC ROK Singapore Turkey UCT US UTC Universal W-SU WET Zulu iso3166.tab localtime posix posixrules right zone.tab 32.6 I am located in the eastern united states so my timezone is EST (Eastern Standard Time). In order to set the timezone for your machine, all you need to do is to copy the correct timezone file from the /usr/share/zoneinfo directory into the /etc directory and then give it the name "localzone". This can be done in one step with the cp (copy) command: (chroot) livecd zoneinfo # cp EST /etc/localtime 2436 2437 2438 32.7 The first parameter that is passed to the cp command is the name and location of the source file and the second parameter is the name and location of the destination file. 2439 2440 32.8 We can now use the emerge command to download the package that contains the kernel's source code to our machines: 2441 (chroot) livecd zoneinfo # cd / 2442 2443 (chroot) livecd / # pwd / 2444 (chroot) livecd / # USE="-doc" emerge gentoo-sources v1.81 Installing Gentoo Linux 82/124 2445 2446 2447 2448 2449 2450 2451 2452 32.9 As soon as you execute this emerge command, the gentoo-sources information in the portage tree (which exists in the /usr/portage/syskernel/gentoo-sources directory) will be found and the instructions it contains for downloading the files required to configure and build the kernel will be followed. I had indicated earlier that there was more than one way to specify USE flags and the above command uses one of them. In this case, we do not want the emerge command to download any extra documentation files when it downloads the source code for the kernel. 2453 2454 2455 32.10 By default, emerge uses the wget command (which we used earlier) to download files from the Internet to the local machine and this is what is happening when you see wget's progress bar: 2456 100%[====================================>] 153 32.11 The emerge command displays information about what it is doing stepby-step. The full listing of the emerge command we just executed is too long to include here but I will show the last part of it: 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 ... >>> >>> >>> >>> >>> >>> /usr/src/linux-2.6.19-gentoo-r5/include/asm-v850/timex.h /usr/src/linux-2.6.19-gentoo-r5/include/asm-v850/me2.h /usr/src/linux-2.6.19-gentoo-r5/include/asm-v850/local.h /usr/src/linux-2.6.19-gentoo-r5/include/asm-v850/teg.h /usr/src/linux-2.6.19-gentoo-r5/include/keys/ /usr/src/linux-2.6.19-gentoo-r5/include/keys/user-type.h 2467 2468 2469 2470 2471 2472 2473 2474 * If you are upgrading from a previous kernel, you may be interested * in the following documents: * - General upgrade guide: http://www.gentoo.org/doc/en/kernel-upgrade.xml * - 2.4 to 2.6 migration guide: http://www.gentoo.org/doc/en/migration-to2.6.xml * As of 2.6.13 the support for devfs has been removed. * You will be required to either manage a static /dev * or to ensure that udev is starting on boot. 2475 2476 2477 2478 * For more info on this patchset, and how to report problems, see: * http://dev.gentoo.org/~dsd/genpatches >>> sys-kernel/gentoo-sources-2.6.19-r5 merged. >>> Recording sys-kernel/gentoo-sources in "world" favorites file... 2479 2480 >>> No packages selected for removal by clean >>> Auto-cleaning packages... 2481 2482 >>> No outdated packages were found on your system. * GNU info directory index is up-to-date. 2483 * GNU info directory index is up-to-date. v1.81 2484 2485 2486 Installing Gentoo Linux 83/124 32.12 Lines that look like the following indicate that files are being copied into the specified places in the directory hierarchy: >>> /usr/src/linux-2.6.19-gentoo-r5/include/keys/user-type.h 2487 2488 2489 2490 2491 2492 32.13 If you watched the emerge listing as it scrolled by the screen, you will have noticed that most of the files that were being copied into the directory hierarchy were being placed in the /usr/src directory. In the next section we will change into this directory in order to configure the kernel. Before we do, however, lets finish talking about what happened during the emerge process. 2493 2494 2495 2496 32.14 The bottom part of the emerge listing usually contains messages from the Gentoo developers who are responsible for maintaining that specific package. You should always read these messages in case they contain important information. 2497 2498 2499 32.15 The final thing we will do before configuring the kernel is to see where the wget command downloaded the files to that contain the kernel's source code. Change into the /usr/portage/distfiles directory and list its contents: 2500 (chroot) livecd / # cd /usr/portage/distfiles 2501 2502 (chroot) livecd distfiles # pwd /usr/portage/distfiles 2503 2504 2505 (chroot) livecd distfiles # ls genpatches-2.6.24-8.base.tar.bz2 genpatches-2.6.24-8.extras.tar.bz2 linux-2.6.24.tar.bz2 2506 2507 2508 2509 2510 2511 2512 2513 2514 32.16 Emerge downloaded 3 compressed tar files which contain the information needed to configure and build version 2.6.24 of the Linux kernel. The main file is called linux-2.6.24.tar.bz2 and the 2 genpatches files contain what are called patches. A patch contains information that is used to modify existing files. In this case, the Gentoo developers are taking the official 2.6.24 version of the Linux kernel's source code and using patches to make adjustments to it. Sometimes this is done to fix bugs in the original source code while other times it is done to make improvements to it. 2515 2516 2517 2518 32.17 By default, emerge downloads the compressed tar files for all packages into the /usr/portage/distfiles directory. If a given tar file already exists in this directory, then emerge does not bother download it again. v1.81 2519 Installing Gentoo Linux 84/124 33 Configuring the kernel 2520 2521 2522 2523 2524 2525 2526 33.1 It is now time for us to configure the Linux kernel. As we discussed earlier, a kernel accesses a computer's hardware through special programs called devices drivers (see Figures 1 and 2). A significant amount of the work required to configure a Linux kernel involves determining the types, manufacturers and model numbers of the electronic chips on the motherboard (and expansion cards) and matching these with the kernel modules needed to access them. 2527 2528 2529 2530 2531 2532 33.2 CPUs communicate with the chips that are on the motherboard and expansion cards using a communications bus. A communications bus usually consists of a set of wires which are run from one point to another (or to multiple points) in a circuit. The most common bus which is used today in most PCs and servers is called the PCI (Peripheral Component Interconnect) bus. 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 33.3 The first step which needs to be done when configuring a kernel is to obtain a list of all the electronic chips which are connected to the PCI bus of the computer you are installing Gentoo on. There is a program called lspci (list PCI) which is capable of doing this and it is included on the CD. The lspci program, however, has not yet been installed into the chrooted environment on the hard drive. This means that if you switch to any of the virtual terminals other than the default one (using <alt><F2-F6>) you can run lspci, but if you want to run lspci in the chrooted environment, you must first emerge it. The lspci program is contained within the sysapps/pciutils package and it can be emerged by executing an emerge pciutils command: 2544 2545 2546 (chroot) livecd / # emerge pciutils 33.4 After the pciutils package is done emerging, execute the lspci command and see which electronic chips are listed for your computer. : 2547 (chroot) livecd / # lspci 2548 2549 2550 2551 2552 2553 2554 2555 2556 00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] 00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter 00:03.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 40) 00:04.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service 00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08) 2557 33.5 The above chips are the ones that are listed for the VirtualBox virtual PC Installing Gentoo Linux v1.81 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 85/124 that I am installing Gentoo on in order to provide the examples for this document. All of the chips in this list are the chips that are present on the PC that the virtual PC is running on, except the VGA display adapter. The display adapter in this list is a virtual display adapter that has been created in software by the VirtualBox developers. In this list, I have highlighted the function of each chip in blue, its manufacturer in green, and its model number in red. Only the chips that are needed to successfully boot the machine have been highlighted at this time. 33.6 As we discussed earlier, when we emerged the gentoo-sources package, most of the source code for the Linux kernel was placed into the /usr/src directory. Change into the /usr/src directory now and lets see what it contains by executing a ls -l command: 2570 (chroot) livecd / # cd /usr/src 2571 2572 (chroot) livecd src # pwd /usr/src 2573 2574 2575 2576 (chroot) livecd src # ls -l total 4 lrwxrwxrwx 1 root root 22 Oct drwxr-xr-x 19 root root 4096 Sep 4 17:41 linux -> linux-2.6.24-gentoo-r7 4 17:41 linux-2.6.24-gentoo-r7 2577 2578 2579 2580 2581 2582 2583 2584 33.7 The /usr/src directory contains one directory called linux-2.6.24gentoo-r7 and a symbolic link to this directory called linux. The source code for the Gentoo revision 7 patch of the version 2.6.24 Linux kernel is in the linux-2.6.24-gentoo-r7 directory. The purpose of the symbolic link is to allow multiple versions of the Linux kernel to exist in this directory and the active kernel will be pointed to by the symbolic link. Since we currently only have one version of the kernel's source code installed on the machine, it is the active kernel by default and the symbolic link points to it. 2585 2586 33.8 Use the symbolic link to change into the directory where the Linux source code is held: 2587 (chroot) livecd src # cd linux 2588 2589 (chroot) livecd linux # pwd /usr/src/linux 2590 2591 2592 2593 2594 2595 2596 2597 (chroot) livecd linux # total 352 -rw-r--r-- 1 root root -rw-r--r-- 1 root root drwxr-xr-x 60 root root -rw-r--r-- 1 root root -rw-r--r-- 1 root root -rw-r--r-- 1 root root ls -l 18693 90307 4096 1262 76067 50194 Sep Sep Sep Sep Sep Sep 4 4 4 4 4 4 17:39 17:39 17:40 17:39 17:39 17:39 COPYING CREDITS Documentation Kbuild MAINTAINERS Makefile Installing Gentoo Linux v1.81 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 -rw-r--r--rw-r--r-drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x -rw-r--r-drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x 1 1 27 2 2 62 64 42 2 2 5 5 2 37 1 9 4 17 2 root root root root root root root root root root root root root root root root root root root root 16538 Sep root 3065 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 52 Sep root 4096 Sep root 4096 Sep root 4096 Sep root 4096 Sep 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 17:39 17:39 17:40 17:40 17:40 17:40 17:40 17:41 17:40 17:40 17:39 17:40 17:40 17:39 17:39 17:40 17:40 17:41 17:40 86/124 README REPORTING-BUGS arch block crypto drivers fs include init ipc kernel lib mm net patches.txt scripts security sound usr 2617 2618 2619 2620 2621 2622 2623 33.9 The Linux kernel's source code exists within an organized directory structure. Fortunately, we will not need to study the contents of this directory structure in order to configure the kernel because a kernel configuration utility program (called menuconfig) is included with the source code. We will need to enter the arch directory, however, after the kernel has been built because this is where the compiled binary file for the kernel will be placed after the build process is finished. 2624 2625 33.10 We will now verify that we are in the /usr/src/linux directory and then execute the menuconfig program using the command make menuconfig: 2626 2627 (chroot) livecd linux # pwd /usr/src/linux 2628 (chroot) livecd linux # make menuconfig 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 33.11 As soon as the menuconfig program is executed, it shows the following text graphics display: .config - Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── ┌────────────────────── Linux Kernel Configuration ───────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ General setup ---> │ │ │ │ [*] Enable loadable module support ---> │ │ │ │ -*- Enable the block layer ---> │ │ v1.81 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 Installing Gentoo Linux 87/124 │ │ Processor type and features ---> │ │ │ │ Power management options ---> │ │ │ │ Bus options (PCI etc.) ---> │ │ │ │ Executable file formats / Emulations ---> │ │ │ │ Networking ---> │ │ │ │ Device Drivers ---> │ │ │ │ Firmware Drivers ---> │ │ │ │ File systems ---> │ │ │ │ [*] Instrumentation Support ---> │ │ │ │ Kernel hacking ---> │ │ │ │ Security options ---> │ │ │ │ [ ] Cryptographic API ---> │ │ │ │ Library routines ---> │ │ │ │ --│ │ │ │ Load an Alternate Configuration File │ │ │ │ Save an Alternate Configuration File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ 2666 2667 2668 33.12 As the instructions say at the top of the display, the arrow keys on the keyboard move the blue selection bar around the display. Press the up and down arrow keys in order to see how they move the selection bar. 2669 2670 2671 2672 2673 33.13 The arrows (--->) next to various menu items indicate that these menus have submenus. The way that you enter a menu's submenu is by placing the selection bar over the menu and pressing the <enter> key. Lets experiment with this by entering the submenu of the Processor type and features ---> menu: 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 .config - Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── ┌────────────────────── Linux Kernel Configuration ───────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ General setup ---> │ │ │ │ [*] Enable loadable module support ---> │ │ │ │ -*- Enable the block layer ---> │ │ │ │ Processor type and features ---> │ │ │ │ Power management options ---> │ │ │ │ Bus options (PCI etc.) ---> │ │ │ │ Executable file formats / Emulations ---> │ │ │ │ Networking ---> │ │ │ │ Device Drivers ---> │ │ v1.81 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 Installing Gentoo Linux 88/124 │ │ Firmware Drivers ---> │ │ │ │ File systems ---> │ │ │ │ [*] Instrumentation Support ---> │ │ │ │ Kernel hacking ---> │ │ │ │ Security options ---> │ │ │ │ [ ] Cryptographic API ---> │ │ │ │ Library routines ---> │ │ │ │ --│ │ │ │ Load an Alternate Configuration File │ │ │ │ Save an Alternate Configuration File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ .config - Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── ┌────────────────────── Processor type and features ──────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ [*] Tickless System (Dynamic Ticks) │ │ │ │ [*] High Resolution Timer Support │ │ │ │ [*] Symmetric multi-processing support │ │ │ │ Subarchitecture Type (Generic architecture (Summit, bigsmp, E│ │ │ │ [*] Single-depth WCHAN output │ │ │ │ [ ] Paravirtualized guest support ---> │ │ │ │ Processor family (Pentium-III/Celeron(Coppermine)/Pentium-III│ │ │ │ [*] Generic x86 support │ │ │ │ [*] HPET Timer Support │ │ │ │ (32) Maximum number of CPUs (2-255) │ │ │ │ [*] SMT (Hyperthreading) scheduler support │ │ │ │ [*] Multi-core scheduler support │ │ │ │ Preemption Model (Voluntary Kernel Preemption (Desktop)) ---│ │ │ │ [*] Preempt The Big Kernel Lock │ │ │ │ [*] Machine Check Exception │ │ │ │ <*> Check for non-fatal errors on AMD Athlon/Duron / Intel Pent│ │ │ │ [*] check for P4 thermal throttling interrupt. │ │ │ │ < > Toshiba Laptop support │ │ │ │ < > Dell laptop support │ │ │ │ [ ] Enable X86 board specific fixups for reboot │ │ │ │ <*> /dev/cpu/microcode - Intel IA32 CPU microcode support │ │ │ │ <*> /dev/cpu/*/msr - Model-specific register support │ │ │ │ <*> /dev/cpu/*/cpuid - CPU information support │ │ │ │ High Memory Support (4GB) ---> │ │ │ └────v(+)─────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ v1.81 2744 Installing Gentoo Linux 89/124 └─────────────────────────────────────────────────────────────────────────┘ 2745 2746 2747 2748 2749 2750 2751 33.14 The first thing you will notice when you enter the Processor type and features submenu is that there are a significant number of options available. Most menus are going to contain many options, but fortunately we will only need to deal with a small number of these options in order to configure the kernel to the point where it will boot the system. Later, after your system is successfully booting from the hard drive, you can return to the menuconfig program and study the options it contains in more depth. 2752 2753 2754 2755 2756 2757 2758 2759 33.15 For now, though, I want to show you how to exit a submenu. As the instructions indicate at the top of the display, pressing the escape key twice (<Esc><Esc>) will exit the current submenu. What the instructions do not say, however, is that if you press the escape key once and then wait for a second or two, this will also exit the current submenu. Therefore, you have 2 ways you can exit a submenu. You can either 1) quickly press the escape key twice or 2) only press the escape key once and then wait a second or two. 2760 2761 2762 2763 2764 2765 33.16 Press the escape key twice now in order to exit the Processor type and features submenu. When you exit this menu you are placed back in the initial top-level menu. If you exit from the top-level menu by pressing the escape key, the menuconfig program will exit and a dialog box will appear which asks if you want to save your new kernel configuration information: 2766 2767 Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── 2768 2769 2770 2771 2772 ┌──────────────────────────────────────────────────────────┐ │ Do you wish to save your new kernel configuration? │ ├──────────────────────────────────────────────────────────┤ │ < Yes > < No > │ └──────────────────────────────────────────────────────────┘ 2773 2774 2775 2776 2777 2778 2779 2780 2781 33.17 You will usually want to save your new kernel configuration data and, since the <Yes> option is already highlighted, just press the <enter> key in order to select it. I know you are going to press the escape key one too many times at some point in the future and accidentally exit the menuconfig program. Therefore, you may as well try it now on purpose so that you can experience what happens. Press the escape key twice from within the toplevel menu, select the <Yes> option in the dialog box and you will be placed back at the command prompt. In order to get back into the menuconfig program, just execute the make menuconfig command again. v1.81 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 Installing Gentoo Linux 90/124 34 How to select kernel options 34.1.1 Now that you have relaunched the menuconfig program, enter the Processor type and features submenu again and lets take a closer look at it: .config - Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── ┌────────────────────── Processor type and features ──────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ [*] Tickless System (Dynamic Ticks) │ │ │ │ [*] High Resolution Timer Support │ │ │ │ [*] Symmetric multi-processing support │ │ │ │ Subarchitecture Type (Generic architecture (Summit, bigsmp, E│ │ │ │ [*] Single-depth WCHAN output │ │ │ │ [ ] Paravirtualized guest support ---> │ │ │ │ Processor family (Pentium-III/Celeron(Coppermine)/Pentium-III│ │ │ │ [*] Generic x86 support │ │ │ │ [*] HPET Timer Support │ │ │ │ (32) Maximum number of CPUs (2-255) │ │ │ │ [*] SMT (Hyperthreading) scheduler support │ │ │ │ [*] Multi-core scheduler support │ │ │ │ Preemption Model (Voluntary Kernel Preemption (Desktop)) ---│ │ │ │ [*] Preempt The Big Kernel Lock │ │ │ │ [*] Machine Check Exception │ │ │ │ <*> Check for non-fatal errors on AMD Athlon/Duron / Intel Pent│ │ │ │ [*] check for P4 thermal throttling interrupt. │ │ │ │ < > Toshiba Laptop support │ │ │ │ < > Dell laptop support │ │ │ │ [ ] Enable X86 board specific fixups for reboot │ │ │ │ <*> /dev/cpu/microcode - Intel IA32 CPU microcode support │ │ │ │ <*> /dev/cpu/*/msr - Model-specific register support │ │ │ │ <*> /dev/cpu/*/cpuid - CPU information support │ │ │ │ High Memory Support (4GB) ---> │ │ │ └────v(+)─────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ 2823 2824 2825 34.1.2 In order to understand how to select kernel options with the menuconfig program, you must first understand that a kernel can be built in the following 2 ways: 2826 2827 1) As one monolithic binary file which contains the core kernel code along with all of the device drivers. 2828 2) As a smaller binary file (which may include some device drivers) along with external v1.81 2829 2830 2831 2832 2833 Installing Gentoo Linux 91/124 device drivers called "kernel modules". A kernel module is a device driver that has been built separately from the kernel and is not placed within the kernel's binary file. Instead, it is stored somewhere in the filesystem and it can be loaded into memory and plugged into a running kernel as needed. Kernel modules can also be detached from the kernel and removed from memory if they are not needed any longer. 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 34.1.3 Of these 2 ways to build the kernel, we are going to use technique #1 (and build one big monolithic kernel) because I think it is the easier of the 2 ways for beginners to understand. Technique#2, however, is more flexible than technique #1 and you may explore building a kernel that uses kernel modules at a later date. An example of a system that uses technique #2 is the CD that we booted the machine with. The CD contains a large number of kernel modules and, as the system boots, it scans the system's hardware and determines which kernel modules are needed to access this hardware. Only the modules that are needed are then loaded into memory and attached to the kernel. This uses the system's memory resources more efficiently than one huge monolithic kernel would. 2846 2847 2848 2849 2850 2851 2852 2853 2854 34.1.4 Now that you know about the 2 ways to build a Linux kernel, we can discuss how the menuconfig program allows you to select kernel options. The square braces [] and arrowed braces <> that are next to each kernel option allow you to either select that option or to deselect it. Options are selected by moving the selection bar over the option and pressing the 'Y' key. Pressing the 'N' key will deselect the option and pressing the space bar will toggle the selection. A selected option will have an asterisk '*' placed within the braces and a deselected option will have empty braces. 2855 2856 2857 2858 2859 2860 2861 2862 34.1.5 Experiment with this now by moving the selection bar to the HPET timer support option and pressing 'Y', 'N', and the space bar. If you want more information about what an option does, press the 'H' key and a help window will appear. Do this now with the HPET timer support option to read about what this option does and then exit the window either by pressing the escape key twice or by pressing the <enter> key. When you are done experimenting, set the HPET timer support option to selected so that we can have this capability built into our kernel. 2863 2864 2865 2866 2867 2868 34.1.6 The difference between options that have square braces [] and options that have arrowed braces <> is that options that have arrowed braces <> can also be built as kernel modules. A safe module-capable option to experiment with is the /dev/cpu/*/cpuid - CPU information support option. Highlight this option with the selection bar and, in addition to pressing the 'Y' key, 'N' key, and the space bar, try pressing v1.81 2869 2870 2871 2872 2873 Installing Gentoo Linux 92/124 the 'M' key to select this option as a module. When you are done experimenting, leave this option selected as a module so we can later see where modules are stored in the directory hierarchy after they are built. 35 Selecting your CPU's processor family 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 35.1.1 The last option we will set in the Processor type and features submenu is the Processor Family option. Move the selection bar over this option and then enter its submenu by pressing the <enter> key. A Processor family window will be shown and you now need to decide which processor family the CPU in your system belongs to. Earlier, you looked inside of the /proc/cpuinfo file to determine what CPU your system had and you can do this again by temporarily switching to another virtual terminal by pressing the <alt><Fx> keys. After you have determined the type of your CPU, switch back to the default terminal, find its family in the Processor Family window and select it by pressing the space bar. You will then be automatically sent back to the Processor type and features menu. 2886 2887 2888 35.1.2 We are done selecting options in the Processor type and features menu so press the escape key twice to exit this menu and go back to the top-level menu. 2889 36 Selecting the IDE device driver 2890 2891 2892 2893 2894 2895 2896 2897 36.1.1 The first piece of hardware that we are going to select a device driver for is the IDE interface. IDE stands for Integrated Drive Electronics and it is a standard which CPUs use to communicate with external storage devices. As shown in the output from the lspci command, the IDE chip on my system's motherboard is an Intel model PIIX4 and the device driver for this chip can be found inside of the Device Drivers menu (most of the options we are going to select are inside of the Device Drives menu): 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 .config - Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── ┌────────────────────── Linux Kernel Configuration ───────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ General setup ---> │ │ │ │ [*] Enable loadable module support ---> │ │ v1.81 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 Installing Gentoo Linux 93/124 │ │ -*- Enable the block layer ---> │ │ │ │ Processor type and features ---> │ │ │ │ Power management options ---> │ │ │ │ Bus options (PCI etc.) ---> │ │ │ │ Executable file formats / Emulations ---> │ │ │ │ Networking ---> │ │ │ │ Device Drivers ---> │ │ │ │ Firmware Drivers ---> │ │ │ │ File systems ---> │ │ │ │ [*] Instrumentation Support ---> │ │ │ │ Kernel hacking ---> │ │ │ │ Security options ---> │ │ │ │ [ ] Cryptographic API ---> │ │ │ │ Library routines ---> │ │ │ │ --│ │ │ │ Load an Alternate Configuration File │ │ │ │ Save an Alternate Configuration File │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ 36.1.2 The Device Drivers submenu is shown in the following screen. The submenu you want to select within this menu is called ATA/ATAPI/MFM/RLL support --->: .config - Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── ┌──────────────────────────── Device Drivers ─────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ Generic Driver Options ---> │ │ │ │ < > Connector - unified userspace <-> kernelspace linker ---> │ │ │ │ < > Memory Technology Device (MTD) support ---> │ │ │ │ < > Parallel port support ---> │ │ │ │ -*- Plug and Play support ---> │ │ │ │ [*] Block devices ---> │ │ │ │ [*] Misc devices ---> │ │ │ │ <*> ATA/ATAPI/MFM/RLL support ---> │ │ │ │ SCSI device support ---> │ │ │ │ <*> Serial ATA (prod) and Parallel ATA (experimental) drivers --│ │ │ │ [*] Multiple devices driver support (RAID and LVM) ---> │ │ │ │ [*] Fusion MPT device support ---> │ │ │ │ IEEE 1394 (FireWire) support ---> │ │ │ │ < > I2O device support ---> │ │ v1.81 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 Installing Gentoo Linux 94/124 │ │ [*] Macintosh device drivers ---> │ │ │ │ [*] Network device support ---> │ │ │ │ < > ISDN support ---> │ │ │ │ < > Telephony support ---> │ │ │ │ Input device support ---> │ │ │ │ Character devices ---> │ │ │ │ < > I2C support ---> │ │ │ │ SPI support ---> │ │ │ │ < > Dallas's 1-wire support ---> │ │ │ │ -*- Power supply class support ---> │ │ │ └────v(+)─────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ 36.1.3 Inside the ATA/ATAPI/MFM/RLL submenu, select the 2 Generic IDE chipset support options along with the option that matches the make and model of your specific IDE chip. Again, the IDE chip in my system is an Intel PIIXn, but your IDE chip may be different: Linux Kernel v2.6.18-gentoo-r6 Configuration ────────────────────────────────────────────────────────────────────────────── ┌─────────────────────── ATA/ATAPI/MFM/RLL support ───────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │<*> ATA/ATAPI/MFM/RLL support │ │ │ │<*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support │ │ │ │--Please see Documentation/ide.txt for help/info on IDE drives │ │ │ │[ ] Support for SATA (deprecated; conflicts with libata SATA driv│ │ │ │[ ] Use old disk-only driver on primary interface │ │ │ │<*> Include IDE/ATA-2 DISK support │ │ │ │[ ] Use multi-mode by default │ │ │ │<*> Include IDE/ATAPI CDROM support │ │ │ │< > Include IDE/ATAPI TAPE support (EXPERIMENTAL) │ │ │ │< > Include IDE/ATAPI FLOPPY support │ │ │ │< > SCSI emulation support │ │ │ │[ ] IDE Taskfile Access │ │ │ │--IDE chipset support/bugfixes │ │ │ │<*> generic/default IDE chipset support │ │ │ │[ ] CMD640 chipset bugfix/support │ │ │ │[*] PCI IDE chipset support │ │ │ │[*] Sharing PCI IDE interrupts support │ │ │ │[ ] Boot off-board chipsets first support │ │ │ │<*> Generic PCI IDE Chipset Support │ │ │ │< > OPTi 82C621 chipset enhanced support (EXPERIMENTAL) │ │ │ │< > RZ1000 chipset bugfix/support │ │ │ │[*] Generic PCI bus-master DMA support │ │ │ │[ ] Force enable legacy 2.0.X HOSTS to use DMA │ │ v1.81 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 Installing Gentoo Linux 95/124 │ │[*] Use PCI DMA by default when available │ │ │ │[ ] Enable DMA only for disks │ │ │ │< > AEC62XX chipset support │ │ │ │< > ALI M15x3 chipset support │ │ │ │< > AMD and nVidia IDE support │ │ │ │< > ATI IXP chipset IDE support │ │ │ │< > CMD64{3|6|8|9} chipset support │ │ │ │< > Compaq Triflex IDE support │ │ │ │< > CY82C693 chipset support │ │ │ │< > Cyrix CS5510/20 MediaGX chipset support (VERY EXPERIMENTA│ │ │ │< > Cyrix/National Semiconductor CS5530 MediaGX chipset suppo│ │ │ │< > AMD CS5535 chipset support │ │ │ │< > HPT34X chipset support │ │ │ │< > HPT36X/37X chipset support │ │ │ │< > National SCx200 chipset support │ │ │ │<*> Intel PIIXn chipsets support Note: Select your own chip. │ │ │ │< > IT821X IDE support │ │ │ │< > NS87415 chipset support │ │ │ │< > PROMISE PDC202{46|62|65|67} support │ │ │ │< > PROMISE PDC202{68|69|70|71|75|76|77} support │ │ │ │< > ServerWorks OSB4/CSB5/CSB6 chipsets support │ │ │ │< > Silicon Image chipset support │ │ │ │< > SiS5513 chipset support │ │ │ │< > SLC90E66 chipset support │ │ │ │< > Tekram TRM290 chipset support │ │ │ │<*> VIA82CXXX chipset support │ │ │ │[ ] IGNORE word93 Validation BITS │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────────── ┌────────────────────────── ATA/ATAPI/MFM/RLL support──────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. Highlighted │ │ letters are hotkeys. Pressing <Y> includes, <N> excludes, <M> modularizes │ │ features. Press <Esc><Esc> to exit, <?> for Help, </> for Search. Legend: │ │ [*] built-in [ ] excluded <M> module < > module capable │ │ ┌───────────────────────────────────────────────────────────────────────────┐│ │ │ <*> ATA/ATAPI/MFM/RLL support ││ │ │ <*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support ││ │ │ --Please see Documentation/ide.txt for help/info on IDE drives ││ │ │ [ ] Support for SATA (deprecated; conflicts with libata SATA driver││ │ │ [ ] Use old disk-only driver on primary interface ││ │ │ <*> Include IDE/ATA-2 DISK support ││ │ │ [*] Use multi-mode by default ││ │ │ <*> Include IDE/ATAPI CDROM support ││ │ │ < > Include IDE/ATAPI TAPE support (EXPERIMENTAL) ││ │ │ < > Include IDE/ATAPI FLOPPY support ││ │ │ < > SCSI emulation support ││ │ │ [ ] IDE Taskfile Access ││ │ │ --IDE chipset support/bugfixes ││ │ │ <*> generic/default IDE chipset support ││ │ │ [ ] CMD640 chipset bugfix/support ││ v1.81 Installing Gentoo Linux 96/124 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 │ │ [*] PCI IDE chipset support ││ │ │ [ ] Sharing PCI IDE interrupts support ││ │ │ [ ] Boot off-board chipsets first support ││ │ │ <*> Generic PCI IDE Chipset Support ││ │ │ < > OPTi 82C621 chipset enhanced support (EXPERIMENTAL) ││ │ │ < > RZ1000 chipset bugfix/support ││ │ │ [*] Generic PCI bus-master DMA support ││ │ │ [ ] Force enable legacy 2.0.X HOSTS to use DMA ││ │ │ [*] Use PCI DMA by default when available ││ │ │ [ ] Enable DMA only for disks ││ │ │ < > AEC62XX chipset support ││ │ │ < > ALI M15x3 chipset support ││ │ │ <*> AMD and nVidia IDE support ││ │ │ < > ATI IXP chipset IDE support ││ │ │ < > CMD64{3|6|8|9} chipset support ││ │ │ < > Compaq Triflex IDE support ││ │ │ < > CY82C693 chipset support ││ │ │ < > Cyrix CS5510/20 MediaGX chipset support (VERY EXPERIMENTAL)││ │ │ < > Cyrix/National Semiconductor CS5530 MediaGX chipset support││ │ │ < > AMD CS5535 chipset support ││ │ │ < > HPT34X chipset support ││ │ │ < > HPT36X/37X chipset support ││ │ │ < > JMicron JMB36x support ││ │ │ < > National SCx200 chipset support ││ │ │ <*> Intel PIIXn chipsets support Note: Select your own chip ││ │ │ < > IT821X IDE support ││ │ │ < > NS87415 chipset support ││ │ │ < > PROMISE PDC202{46|62|65|67} support ││ │ │ < > PROMISE PDC202{68|69|70|71|75|76|77} support ││ │ │ < > ServerWorks OSB4/CSB5/CSB6 chipsets support ││ │ │ < > Silicon Image chipset support ││ │ │ < > SiS5513 chipset support ││ │ │ < > SLC90E66 chipset support ││ │ │ < > Tekram TRM290 chipset support ││ │ │ < > VIA82CXXX chipset support ││ │ │ [ ] IGNORE word93 Validation BITS ││ │ │ ││ │ └───────────────────────────────────────────────────────────────────────────┘│ ├──────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └──────────────────────────────────────────────────────────────────────────────┘ 3105 3106 36.2 After you finish selecting the above options, escape back to the Device Drivers menu. 3107 3108 37 Selecting the SCSI device drivers (VirtialBox users should skip this section) 3109 3110 37.1 If your machine has a SCSI interface, enter the SCSI device support menu: v1.81 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 Installing Gentoo Linux 97/124 Linux Kernel v2.6.24-gentoo-r7 Configuration ───────────────────────────────────────────────────────────────────────────────── ┌─────────────────────────────── Device Drivers────────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. Highlighted │ │ letters are hotkeys. Pressing <Y> includes, <N> excludes, <M> modularizes │ │ features. Press <Esc><Esc> to exit, <?> for Help, </> for Search. Legend: │ │ [*] built-in [ ] excluded <M> module < > module capable │ │ ┌───────────────────────────────────────────────────────────────────────────┐│ │ │ Generic Driver Options ---> ││ │ │ Connector - unified userspace <-> kernelspace linker ---> ││ │ │ Memory Technology Devices (MTD) ---> ││ │ │ Parallel port support ---> ││ │ │ Plug and Play support ---> ││ │ │ Block devices ---> ││ │ │ Misc devices ---> ││ │ │ ATA/ATAPI/MFM/RLL support ---> ││ │ │ SCSI device support ---> ││ │ │ Serial ATA (prod) and Parallel ATA (experimental) drivers ---> ││ │ │ Multi-device support (RAID and LVM) ---> ││ │ │ Fusion MPT device support ---> ││ │ │ IEEE 1394 (FireWire) support ---> ││ │ │ I2O device support ---> ││ │ │ Network device support ---> ││ │ │ ISDN subsystem ---> ││ │ │ Telephony Support ---> ││ │ │ Input device support ---> ││ │ │ Character devices ---> ││ │ │ I2C support ---> ││ │ │ SPI support ---> ││ │ │ Dallas's 1-wire bus ---> ││ │ │ Hardware Monitoring support ---> ││ │ │ Multimedia devices ---> ││ │ │ Graphics support ---> ││ │ │ Speakup console speech ---> ││ │ │ Sound ---> ││ │ │ USB support ---> ││ │ │ MMC/SD Card support ---> ││ │ │ LED devices ---> ││ │ │ InfiniBand support ---> ││ │ │ EDAC - error detection and reporting (RAS) (EXPERIMENTAL) ---> ││ │ │ Real Time Clock ---> ││ │ │ DMA Engine support ---> ││ │ │ ││ │ └───────────────────────────────────────────────────────────────────────────┘│ ├──────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └──────────────────────────────────────────────────────────────────────────────┘ 37.1.1 SCSI stands for Small Computer System Interconnect and it is another standard that CPUs uses to communicate with external storage devices. Your computer may or may not have a SCSI chip in it, but if it doesn't, you can still read through the following SCSI chip section. Here is the SCSI device support submenu: v1.81 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 Installing Gentoo Linux 98/124 Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── ┌────────────────────────── SCSI device support ──────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │< > RAID Transport Class │ │ │ │--- SCSI device support │ │ │ │[ ] legacy /proc/scsi/ support │ │ │ │--SCSI support type (disk, tape, CD-ROM) │ │ │ │<*> SCSI disk support │ │ │ │< > SCSI tape support │ │ │ │< > SCSI OnStream SC-x0 tape support │ │ │ │< > SCSI CDROM support │ │ │ │<*> SCSI generic support │ │ │ │< > SCSI media changer support │ │ │ │--Some SCSI devices (e.g. CD jukebox) support multiple LUNs │ │ │ │[ ] Probe all LUNs on each SCSI device │ │ │ │[ ] Verbose SCSI error reporting (kernel size +=12K) │ │ │ │[ ] SCSI logging facility │ │ │ │ SCSI Transport Attributes ---> │ │ │ │ SCSI low-level drivers ---> │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ 37.1.2 Inside this menu, select the SCSI generic support option and then enter the SCSI low-level drivers ---> submenu: Linux Kernel v2.6.24-gentoo-r7 Configuration ─────────────────────────────────────────────────────────────────────────────── ┌───────────────────────── SCSI low-level drivers ─────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > module │ │ ┌──────────────────────────────────────────────────────────────────────┐ │ │ │ < > iSCSI Initiator over TCP/IP │ │ │ │ <*> 3ware 5/6/7/8xxx ATA-RAID support │ │ │ │ < > 3ware 9xxx SATA-RAID support │ │ │ │ < > ACARD SCSI support │ │ │ │ < > Adaptec AACRAID support │ │ │ │ <*> Adaptec AIC7xxx Fast -> U160 support (New Driver) │ │ │ │ (32) Maximum number of TCQ commands per device │ │ │ │ (5000) Initial bus reset delay in milli-seconds │ │ │ │ [*] Compile in Debugging Code │ │ │ │ (0) Debug code enable mask (2047 for all debugging) │ │ │ │ [*] Decode registers during diagnostics │ │ │ │ < > Adaptec AIC7xxx support (old driver) │ │ │ │ <*> Adaptec AIC79xx U320 support │ │ v1.81 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 Installing Gentoo Linux 99/124 │ │ (32) Maximum number of TCQ commands per device │ │ │ │ (4000) Initial bus reset delay in milli-seconds │ │ │ │ [ ] Enable Read Streaming for All Targets │ │ │ │ [ ] Compile in Debugging Code │ │ │ │ (0) Debug code enable mask (16383 for all debugging) │ │ │ │ [ ] Decode registers during diagnostics │ │ │ │ < > Adaptec AIC94xx SAS/SATA support │ │ │ │ < > Adaptec I2O RAID support │ │ │ │ < > AdvanSys SCSI support │ │ │ │ < > ARECA ARC11X0[PCI-X]/ARC12X0[PCI-EXPRESS] SATA-RAID support │ │ │ │ [ ] LSI Logic New Generation RAID Device Drivers │ │ │ │ < > LSI Logic Legacy MegaRAID Driver │ │ │ │ < > LSI Logic MegaRAID SAS RAID Module │ │ │ │ < > HighPoint RocketRAID 3xxx Controller support │ │ │ │ < > BusLogic SCSI support │ │ │ │ < > DMX3191D SCSI support │ │ │ │ < > EATA ISA/EISA/PCI (DPT and generic EATA/DMA-compliant boards) │ │ │ │ < > Future Domain 16xx SCSI/AHA-2920A support │ │ │ │ < > Intel/ICP (former GDT SCSI Disk Array) RAID Controller support│ │ │ │ < > IBM ServeRAID support │ │ │ │ < > Initio 9100U(W) support │ │ │ │ < > Initio INI-A100U2W support │ │ │ │ < > Promise SuperTrak EX Series support │ │ │ │ <*> SYM53C8XX Version 2 SCSI support Note:Select your own chip. │ │ │ │ < > IBM Power Linux RAID adapter support │ │ │ │ < > Qlogic QLA 1240/1x80/1x160 SCSI support │ │ │ │ < > QLogic QLA2XXX Fibre Channel Support │ │ │ │ < > QLogic ISP4XXX host adapter family support │ │ │ │ < > Emulex LightPulse Fibre Channel Support │ │ │ │ < > Tekram DC395(U/UW/F) and DC315(U) SCSI support (EXPERIMENTAL) │ │ │ │ < > Tekram DC390(T) and Am53/79C974 SCSI support │ │ │ │ < > Workbit NinjaSCSI-32Bi/UDE support │ │ │ │ < > SCSI debugging host simulator │ │ │ │ │ │ │ └──────────────────────────────────────────────────────────────────────┘ │ ├──────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └──────────────────────────────────────────────────────────────────────────┘ 3252 3253 3254 3255 3256 37.1.3 If your system has a SCSI chip, then it should be in this submenu. The make and model of my system's SCSI chip is a Symbios 53c1030 and therefore this is the option I have selected. Remember that you can obtain help on most options by pressing the 'H' key after the option has been highlighted. 3257 3258 37.1.4 After you are done in the SCSI low-level drivers submenu, carefully escape back two menu levels to the Device Drivers menu. 3259 3260 38 Selecting the Ethernet network chip driver 38.1.1 The next option we are going to select is a device driver for our v1.81 3261 3262 Installing Gentoo Linux 100/124 system's Ethernet network interface chip and it exists within the Network device support ---> submenu: 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 Linux Kernel v2.6.24-gentoo-r7 Configuration ─────────────────────────────────────────────────────────────────────────────── ┌───────────────────────────── Device Drivers ─────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > module │ │ ┌──────────────────────────────────────────────────────────────────────┐ │ │ │ Generic Driver Options ---> │ │ │ │ Connector - unified userspace <-> kernelspace linker ---> │ │ │ │ Memory Technology Devices (MTD) ---> │ │ │ │ Parallel port support ---> │ │ │ │ Plug and Play support ---> │ │ │ │ Block devices ---> │ │ │ │ Misc devices ---> │ │ │ │ ATA/ATAPI/MFM/RLL support ---> │ │ │ │ SCSI device support ---> │ │ │ │ Serial ATA (prod) and Parallel ATA (experimental) drivers ---│ │ │ │ Multi-device support (RAID and LVM) ---> │ │ │ │ Fusion MPT device support ---> │ │ │ │ IEEE 1394 (FireWire) support ---> │ │ │ │ I2O device support ---> │ │ │ │ Network device support ---> │ │ │ │ ISDN subsystem ---> │ │ │ │ Telephony Support ---> │ │ │ │ Input device support ---> │ │ │ │ Character devices ---> │ │ │ │ I2C support ---> │ │ │ │ SPI support ---> │ │ │ │ Dallas's 1-wire bus ---> │ │ │ │ Hardware Monitoring support ---> │ │ │ │ Multimedia devices ---> │ │ │ │ Graphics support ---> │ │ │ │ Speakup console speech ---> │ │ │ │ Sound ---> │ │ │ │ USB support ---> │ │ │ │ MMC/SD Card support ---> │ │ │ │ LED devices ---> │ │ │ │ InfiniBand support ---> │ │ │ │ EDAC - error detection and reporting (RAS) (EXPERIMENTAL) ---│ │ │ │ Real Time Clock ---> │ │ │ │ DMA Engine support ---> │ │ │ └──────────────────────────────────────────────────────────────────────┘ │ ├──────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └──────────────────────────────────────────────────────────────────────────┘ 3309 3310 38.1.2 Inside the Network device support submenu there is a submenu named Ethernet driver support. Select it. v1.81 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 Installing Gentoo Linux 101/124 38.1.3 The Ethernet driver support submenu looks like this: Linux Kernel v2.6.24-gentoo-r7 Configuration ───────────────────────────────────────────────────────────────────────────────── ┌───────────────────────── Ethernet (10 or 100Mbit) ─────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > module │ │ ┌────────────────────────────────────────────────────────────────────────┐ │ │ │ [*] Ethernet driver support │ │ │ │ --Generic Media Independent Interface device support │ │ │ │ < > Sun Happy Meal 10/100baseT support │ │ │ │ < > Sun GEM support │ │ │ │ < > Sun Cassini support │ │ │ │ [ ] 3COM cards │ │ │ │ Tulip family network device support ---> │ │ │ │ < > HP 10/100VG PCLAN (ISA, EISA, PCI) support │ │ │ │ [*] EISA, VLB, PCI and on board controllers │ │ │ │ <*> AMD PCnet32 PCI support │ │ │ │ < > AMD 8111 (new PCI lance) support │ │ │ │ < > Adaptec Starfire/DuraLAN support │ │ │ │ <*> Broadcom 4400 ethernet support │ │ │ │ <*> nForce Ethernet support │ │ │ │ [ ] Use Rx and Tx Polling (NAPI) (EXPERIMENTAL) │ │ │ │ < > Digi Intl. RightSwitch SE-X support │ │ │ │ < > EtherExpressPro/100 support (eepro100, original Becker driver)│ │ │ │ <*> Intel(R) PRO/100+ support │ │ │ │ < > Myson MTD-8xx PCI Ethernet support │ │ │ │ < > National Semiconductor DP8381x series PCI Ethernet support │ │ │ │ < > PCI NE2000 and clones support (see help) │ │ │ │ <*> RealTek RTL-8139 C+ PCI Fast Ethernet Adapter support (EXPERIM│ │ │ │ <*> RealTek RTL-8129/8130/8139 PCI Fast Ethernet Adapter support │ │ │ │ [ ] Use PIO instead of MMIO │ │ │ │ [ ] Support for uncommon RTL-8139 rev. K (automatic channel equa│ │ │ │ [ ] Support for older RTL-8129/8130 boards │ │ │ │ [ ] Use older RX-reset method │ │ │ │ < > SiS 900/7016 PCI Fast Ethernet Adapter support │ │ │ │ < > SMC EtherPower II │ │ │ │ < > Sundance Alta support │ │ │ │ < > TI ThunderLAN support │ │ │ │ < > VIA Rhine support │ │ │ └────────────────────────────────────────────────────────────────────────┘ │ ├────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └────────────────────────────────────────────────────────────────────────────┘ 38.1.4 My system has an Advanced Micro Devices PCnet32 Ethernet chip in it and therefore this is the option I selected. After you have selected your Ethernet chip, escape back to the Device Drivers menu and then enter the Character Devices submenu: Linux Kernel v2.6.24-gentoo-r7 Configuration v1.81 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 Installing Gentoo Linux 102/124 ────────────────────────────────────────────────────────────────────────────── ┌──────────────────────────── Device Drivers ─────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ Generic Driver Options ---> │ │ │ │ Connector - unified userspace <-> kernelspace linker ---> │ │ │ │ Memory Technology Devices (MTD) ---> │ │ │ │ Parallel port support ---> │ │ │ │ Plug and Play support ---> │ │ │ │ Block devices ---> │ │ │ │ ATA/ATAPI/MFM/RLL support ---> │ │ │ │ SCSI device support ---> │ │ │ │ Multi-device support (RAID and LVM) ---> │ │ │ │ Fusion MPT device support ---> │ │ │ │ IEEE 1394 (FireWire) support ---> │ │ │ │ I2O device support ---> │ │ │ │ Network device support ---> │ │ │ │ ISDN subsystem ---> │ │ │ │ Telephony Support ---> │ │ │ │ Input device support ---> │ │ │ │ Character devices ---> │ │ │ │ I2C support ---> │ │ │ │ SPI support ---> │ │ │ │ Dallas's 1-wire bus ---> │ │ │ │ Hardware Monitoring support ---> │ │ │ │ Misc devices ---> │ │ │ │ Multimedia devices ---> │ │ │ │ Graphics support ---> │ │ │ │ Speakup console speech ---> │ │ │ │ Sound ---> │ │ │ │ USB support ---> │ │ │ │ MMC/SD Card support ---> │ │ │ │ LED devices ---> │ │ │ │ InfiniBand support ---> │ │ │ │ EDAC - error detection and reporting (RAS) (EXPERIMENTAL) ---> │ │ │ │ Real Time Clock ---> │ │ │ │ DMA Engine support ---> │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ 39 Selecting the device driver for the video card 39.1.1 Earlier we discussed that the 2 kinds of interfaces that all devices are placed under in Linux are Block Devices and Character Devices. Video Cards use the Character Device interface and if you see your v1.81 3412 3413 3414 3415 3416 Installing Gentoo Linux 103/124 video card in the Character devices submenu, select it. The VirtualBox virtual machine that I am installing Gentoo Linux on uses a virtual video card so it is not present in this list. This virtual video card will be configured when we install the graphic desktop software. 40 Selecting the device driver for the sound card 3417 3418 40.1.1 Note: VirtualBox does not have a sound device enabled by default so VirtualBox users can skip this section. 3419 3420 3421 40.1.2 The next kernel option we need to select is support for the system's sound card. Escape back to the Device Drivers menu and then select the Sound ---> submenu; 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 Linux Kernel v2.6.24-gentoo-r7 Configuration ───────────────────────────────────────────────────────────────────────────────── ┌────────────────────────────── Device Drivers ──────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > module │ │ ┌────────────────────────────────────────────────────────────────────────┐ │ │ │ Generic Driver Options ---> │ │ │ │ Connector - unified userspace <-> kernelspace linker ---> │ │ │ │ Memory Technology Devices (MTD) ---> │ │ │ │ Parallel port support ---> │ │ │ │ Plug and Play support ---> │ │ │ │ Block devices ---> │ │ │ │ Misc devices ---> │ │ │ │ ATA/ATAPI/MFM/RLL support ---> │ │ │ │ SCSI device support ---> │ │ │ │ Serial ATA (prod) and Parallel ATA (experimental) drivers ---> │ │ │ │ Multi-device support (RAID and LVM) ---> │ │ │ │ Fusion MPT device support ---> │ │ │ │ IEEE 1394 (FireWire) support ---> │ │ │ │ I2O device support ---> │ │ │ │ Network device support ---> │ │ │ │ ISDN subsystem ---> │ │ │ │ Telephony Support ---> │ │ │ │ Input device support ---> │ │ │ │ Character devices ---> │ │ │ │ I2C support ---> │ │ │ │ SPI support ---> │ │ │ │ Dallas's 1-wire bus ---> │ │ │ │ Hardware Monitoring support ---> │ │ │ │ Multimedia devices ---> │ │ │ │ Graphics support ---> │ │ │ │ Speakup console speech ---> │ │ │ │ Sound ---> │ │ │ │ USB support ---> │ │ │ │ MMC/SD Card support ---> │ │ v1.81 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 Installing Gentoo Linux 104/124 │ │ LED devices ---> │ │ │ │ InfiniBand support ---> │ │ │ │ EDAC - error detection and reporting (RAS) (EXPERIMENTAL) ---> │ │ │ │ Real Time Clock ---> │ │ │ │ DMA Engine support ---> │ │ │ └────────────────────────────────────────────────────────────────────────┘ │ ├────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └────────────────────────────────────────────────────────────────────────────┘ 40.1.3 After entering the Sound submenu, select the Advanced Linux Sound Architecture ---> submenu: Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── ┌───────────────────────────────── Sound ─────────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │<*> Sound card support │ │ │ │ Advanced Linux Sound Architecture ---> │ │ │ │ Open Sound System ---> │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ 40.1.4 Then enter the PCI Devices ---> submenu: Linux Kernel v2.6.24-gentoo-r7 Configuration ───────────────────────────────────────────────────────────────────────────────── ┌──────────────────── Advanced Linux Sound Architecture ─────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > module │ │ ┌────────────────────────────────────────────────────────────────────────┐ │ │ │ <*> Advanced Linux Sound Architecture │ │ │ │ < > Sequencer support (NEW) │ │ │ │ < > OSS Mixer API (NEW) │ │ │ │ < > OSS PCM (digital audio) API (NEW) │ │ │ │ < > RTC Timer support (NEW) │ │ │ │ [ ] Dynamic device file minor numbers (NEW) │ │ │ │ [*] Support old ALSA API (NEW) │ │ │ │ [*] Verbose procfs contents (NEW) │ │ │ │ [ ] Verbose printk (NEW) │ │ │ │ [ ] Debug (NEW) │ │ │ │ Generic devices ---> │ │ │ │ PCI devices ---> │ │ │ │ USB devices ---> │ │ │ └────────────────────────────────────────────────────────────────────────┘ │ v1.81 3508 3509 3510 Installing Gentoo Linux 105/124 ├────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └────────────────────────────────────────────────────────────────────────────┘ 3511 3512 3513 40.1.5 The lspci command indicated that my system has an Ensoniq ES1371 AudioPCI sound chip therefore, this is the option I selected. You should select the sound chip that your system has: 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 Linux Kernel v2.6.24-gentoo-r7 Configuration ───────────────────────────────────────────────────────────────────────────────── ┌─────────────────────────────── PCI devices ────────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > module │ │ ┌────────────────────────────────────────────────────────────────────────┐ │ │ │ < > Analog Devices AD1889 (NEW) │ │ │ │ < > Avance Logic ALS300/ALS300+ (NEW) │ │ │ │ < > Avance Logic ALS4000 (NEW) │ │ │ │ < > ALi M5451 PCI Audio Controller (NEW) │ │ │ │ < > ATI IXP AC97 Controller (NEW) │ │ │ │ < > ATI IXP Modem (NEW) │ │ │ │ < > Aureal Advantage (NEW) │ │ │ │ < > Aureal Vortex (NEW) │ │ │ │ < > Aureal Vortex 2 (NEW) │ │ │ │ < > Aztech AZF3328 / PCI168 (EXPERIMENTAL) (NEW) │ │ │ │ < > Bt87x Audio Capture (NEW) │ │ │ │ < > SB Audigy LS / Live 24bit (NEW) │ │ │ │ < > C-Media 8738, 8338 (NEW) │ │ │ │ < > Cirrus Logic (Sound Fusion) CS4281 (NEW) │ │ │ │ < > Cirrus Logic (Sound Fusion) CS4280/CS461x/CS462x/CS463x (NEW) │ │ │ │ < > CS5535/CS5536 Audio (NEW) │ │ │ │ < > (Echoaudio) Darla20 (NEW) │ │ │ │ < > (Echoaudio) Gina20 (NEW) │ │ │ │ < > (Echoaudio) Layla20 (NEW) │ │ │ │ < > (Echoaudio) Darla24 (NEW) │ │ │ │ < > (Echoaudio) Gina24 (NEW) │ │ │ │ < > (Echoaudio) Layla24 (NEW) │ │ │ │ < > (Echoaudio) Mona (NEW) │ │ │ │ < > (Echoaudio) Mia (NEW) │ │ │ │ < > (Echoaudio) 3G cards (NEW) │ │ │ │ < > (Echoaudio) Indigo (NEW) │ │ │ │ < > (Echoaudio) Indigo IO (NEW) │ │ │ │ < > (Echoaudio) Indigo DJ (NEW) │ │ │ │ < > Emu10k1 (SB Live!, Audigy, E-mu APS) (NEW) │ │ │ │ < > Emu10k1X (Dell OEM Version) (NEW) │ │ │ │ < > (Creative) Ensoniq AudioPCI 1370 (NEW) │ │ │ │ <*> (Creative) Ensoniq AudioPCI 1371/1373 │ │ │ │ < > ESS ES1938/1946/1969 (Solo-1) (NEW) │ │ │ │ < > ESS ES1968/1978 (Maestro-1/2/2E) (NEW) │ │ │ │ < > ForteMedia FM801 (NEW) │ │ │ │ < > Intel HD Audio (NEW) │ │ │ │ < > RME Hammerfall DSP Audio (NEW) │ │ │ │ < > RME Hammerfall DSP MADI (NEW) │ │ v1.81 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 Installing Gentoo Linux 106/124 │ │ < > ICEnsemble ICE1712 (Envy24) (NEW) │ │ │ │ < > ICE/VT1724/1720 (Envy24HT/PT) (NEW) │ │ │ │ < > Intel/SiS/nVidia/AMD/ALi AC97 Controller (NEW) │ │ │ │ < > Intel/SiS/nVidia/AMD MC97 Modem (NEW) │ │ │ │ < > Korg 1212 IO (NEW) │ │ │ │ < > ESS Allegro/Maestro3 (NEW) │ │ │ │ < > Digigram miXart (NEW) │ │ │ │ < > NeoMagic NM256AV/ZX (NEW) │ │ │ │ < > Digigram PCXHR (NEW) │ │ │ │ < > Conexant Riptide (NEW) │ │ │ │ < > RME Digi32, 32/8, 32 PRO (NEW) │ │ │ │ < > RME Digi96, 96/8, 96/8 PRO (NEW) │ │ │ │ < > RME Digi9652 (Hammerfall) (NEW) │ │ │ │ < > S3 SonicVibes (NEW) │ │ │ │ < > Trident 4D-Wave DX/NX; SiS 7018 (NEW) │ │ │ │ < > VIA 82C686A/B, 8233/8235 AC97 Controller (NEW) │ │ │ │ < > VIA 82C686A/B, 8233 based Modems (NEW) │ │ │ │ < > Digigram VX222 (NEW) │ │ │ │ < > Yamaha YMF724/740/744/754 (NEW) │ │ │ │ [ ] AC97 Power-Saving Mode (NEW) │ │ │ └────────────────────────────────────────────────────────────────────────┘ │ ├────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └────────────────────────────────────────────────────────────────────────────┘ 41 Selecting the ext3 filesystem option 41.1.1 We only have one more option to select and then we are done with configuring the kernel. Carefully escape back to the top-level menu and then enter the File systems ---> submenu: Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── ┌────────────────────── Linux Kernel Configuration ───────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ Code maturity level options ---> │ │ │ │ General setup ---> │ │ │ │ Loadable module support ---> │ │ │ │ Block layer ---> │ │ │ │ Processor type and features ---> │ │ │ │ Power management options (ACPI, APM) ---> │ │ │ │ Bus options (PCI, PCMCIA, EISA, MCA, ISA) ---> │ │ │ │ Executable file formats ---> │ │ │ │ Networking ---> │ │ │ │ Device Drivers ---> │ │ │ │ File systems ---> │ │ │ │ Instrumentation Support ---> │ │ │ │ Kernel hacking ---> │ │ v1.81 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 Installing Gentoo Linux 107/124 │ │ Security options ---> │ │ │ │ Cryptographic options ---> │ │ │ │ Library routines ---> │ │ │ │--│ │ │ │ Load an Alternate Configuration File │ │ │ │ Save Configuration to an Alternate File │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ │ ├─────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └─────────────────────────────────────────────────────────────────────────┘ 41.1.2 Inside the File systems submenu, the only option that needs to be selected is the Ext3 journalling file system support option. We need this capability built into our kernel so that it can work with the the ext3 filesystem that we placed on the /dev/sda3 partition so make sure it is selected: Linux Kernel v2.6.24-gentoo-r7 Configuration ───────────────────────────────────────────────────────────────────────────────── ┌─────────────────────────────── File systems ───────────────────────────────┐ │ Arrow keys navigate the menu. <Enter> selects submenus --->. │ │ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, │ │ <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> │ │ for Search. Legend: [*] built-in [ ] excluded <M> module < > module │ │ ┌────────────────────────────────────────────────────────────────────────┐ │ │ │ <*> Second extended fs support │ │ │ │ [*] Ext2 extended attributes │ │ │ │ [*] Ext2 POSIX Access Control Lists │ │ │ │ [ ] Ext2 Security Labels │ │ │ │ [ ] Ext2 execute in place support │ │ │ │ <*> Ext3 journalling file system support │ │ │ │ [*] Ext3 extended attributes │ │ │ │ [*] Ext3 POSIX Access Control Lists │ │ │ │ [ ] Ext3 Security Labels │ │ │ │ < > Ext4dev/ext4 extended fs support development (EXPERIMENTAL) │ │ │ │ [ ] JBD (ext3) debugging support │ │ │ │ <*> Reiserfs support │ │ │ │ [ ] Enable reiserfs debug mode │ │ │ │ [ ] Stats in /proc/fs/reiserfs │ │ │ │ [*] ReiserFS extended attributes │ │ │ │ [*] ReiserFS POSIX Access Control Lists │ │ │ │ [ ] ReiserFS Security Labels │ │ │ │ < > JFS filesystem support │ │ │ │ < > XFS filesystem support │ │ │ │ < > GFS2 file system support │ │ │ │ < > OCFS2 file system support │ │ │ │ < > Minix fs support │ │ │ │ < > ROM file system support │ │ │ │ [*] Inotify file change notification support │ │ │ │ [*] Inotify support for userspace │ │ │ │ [ ] Quota support │ │ │ │ < > Kernel automounter support │ │ v1.81 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 Installing Gentoo Linux 108/124 │ │ <*> Kernel automounter version 4 support (also supports v3) │ │ │ │ < > Filesystem in Userspace support │ │ │ │ CD-ROM/DVD Filesystems ---> │ │ │ │ DOS/FAT/NT Filesystems ---> │ │ │ │ Pseudo filesystems ---> │ │ │ │ Miscellaneous filesystems ---> │ │ │ │ Network File Systems ---> │ │ │ │ Partition Types ---> │ │ │ │ Native Language Support ---> │ │ │ │ │ │ │ └────────────────────────────────────────────────────────────────────────┘ │ ├────────────────────────────────────────────────────────────────────────────┤ │ <Select> < Exit > < Help > │ └────────────────────────────────────────────────────────────────────────────┘ 42 Saving the kernel configuration file and viewing it 42.1.1 We are done configuring the kernel for now and the last thing we need to do is to carefully escape back to the top-level menu and then escape out of the menuconfig application itself. Before exiting to the command prompt, the menuconfig application will ask if we want to save our new kernel configuration. Select the <Yes> option by pressing the <enter> key: 3681 3682 Linux Kernel v2.6.24-gentoo-r7 Configuration ────────────────────────────────────────────────────────────────────────────── 3683 3684 3685 3686 3687 ┌──────────────────────────────────────────────────────────┐ │ Do you wish to save your new kernel configuration? │ ├──────────────────────────────────────────────────────────┤ │ < Yes > < No > │ └──────────────────────────────────────────────────────────┘ 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 42.1.2 Now that the kernel configuration file has been saved, lets look at it. At the command prompt, execute an ls command: (chroot) livecd linux # ls COPYING MAINTAINERS CREDITS Makefile Documentation README Kbuild REPORTING-BUGS arch block crypto drivers fs include init ipc kernel lib mm net patches.txt scripts security sound usr 42.1.3 The file is in this directory but we cannot see it because it was saved as a hidden file! In order to have the ls command show all of the hidden files in a directory, pass a -a option to it (which means list all): (chroot) livecd linux # ls -a . CREDITS README drivers kernel scripts Installing Gentoo Linux v1.81 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 .. .config .gitignore COPYING Documentation Kbuild MAINTAINERS Makefile REPORTING-BUGS arch block crypto fs include init ipc lib mm net patches.txt (chroot) livecd linux # cat .config # # Automatically generated make config: don't edit # Linux kernel version: 2.6.19-gentoo-r5 # Wed Sep 5 00:15:05 2007 # CONFIG_X86_32=y CONFIG_GENERIC_TIME=y CONFIG_LOCKDEP_SUPPORT=y CONFIG_STACKTRACE_SUPPORT=y CONFIG_SEMAPHORE_SLEEPERS=y CONFIG_X86=y CONFIG_MMU=y CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_IOMAP=y CONFIG_GENERIC_HWEIGHT=y CONFIG_ARCH_MAY_HAVE_PC_FDC=y CONFIG_DMI=y CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 3729 3730 3731 3732 3733 3734 3735 # # Code maturity level options # CONFIG_EXPERIMENTAL=y CONFIG_LOCK_KERNEL=y CONFIG_INIT_ENV_ARG_LIMIT=32 <snip> 3736 43 Compiling the kernel 3741 3742 3743 3744 security sound usr 42.1.4 In GNU/Linux, the way to make a file hidden is to place a period '.' before the file name. The name of the Linux kernel's configuration file is .config and it is shown above highlighted in blue. It is a text file, so you can use the cat command to view its contents or you can page through it using the less command (the file is quite long so I am only going to show the beginning part of it): 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3737 3738 3739 3740 109/124 43.1.1 It is now time to compile the kernel! In order to compile the kernel, simply execute the make && make modules_install command at the command line (the output from the compile process is also long so I will only show a small part of it): (chroot) livecd linux # make && make modules_install HOSTLD scripts/kconfig/conf scripts/kconfig/conf -s arch/i386/Kconfig CHK include/linux/version.h v1.81 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 UPD CHK UPD SYMLINK CC GEN CC HOSTCC MKELF HOSTCC HOSTCC HOSTCC HOSTLD HOSTCC <snip> 110/124 include/linux/version.h include/linux/utsrelease.h include/linux/utsrelease.h include/asm -> include/asm-i386 arch/i386/kernel/asm-offsets.s include/asm-i386/asm-offsets.h scripts/mod/empty.o scripts/mod/mk_elfconfig scripts/mod/elfconfig.h scripts/mod/file2alias.o scripts/mod/modpost.o scripts/mod/sumversion.o scripts/mod/modpost scripts/kallsyms 43.1.2 The double ampersand symbol '&&' is called a "logical and" symbol and it allows more than one command to be executed on a single command line. For example, if we wanted to execute a date command and then a ls command on the same command line, we could enter date && ls. The date command would be executed first and then the ls command would be executed. While the kernel is compiling you can switch to another virtual terminal and type date && ls to see what happens: 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 Installing Gentoo Linux (chroot) livecd / # date && ls Wed Sep 5 06:53:23 UTC 2007 bin mnt boot opt dev portage-xxx.tar.bz2 etc portage-xxx.tar.bz2.md5sum home proc lib root lost+found sbin stage3-i686-xxx.tar.bz2 stage3-i686-xxx.tar.bz2.DIGESTS sys tmp usr var 3777 3778 43.1.3 Notice that the date command was executed (its output is highlighted in blue) followed by the ls command. 3779 3780 3781 3782 3783 3784 43.1.4 Going back to the command line we used to compile the kernel, make is a program that is used to build software that consists of many source files. We used the logical and symbol '&&' to run the make program twice, once to compile the main kernel and a second time to compile any options that were configured as kernel modules and install them somewhere in the directory hierarchy. 3785 3786 43.1.5 The kernel will take a while to build and here is the last part of the output that is generated after it is finished: 3787 <...> v1.81 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 Installing Gentoo Linux 111/124 LD arch/i386/boot/compressed/piggy.o LD arch/i386/boot/compressed/vmlinux OBJCOPY arch/i386/boot/vmlinux.bin HOSTCC arch/i386/boot/tools/build BUILD arch/i386/boot/bzImage Root device is (3, 3) Boot sector 512 bytes. Setup is 6614 bytes. System is 2666 kB Kernel: arch/i386/boot/bzImage is ready (#1) Building modules, stage 2. MODPOST 1 modules CC arch/i386/kernel/cpuid.mod.o LD [M] arch/i386/kernel/cpuid.ko INSTALL arch/i386/kernel/cpuid.ko if [ -r System.map -a -x /sbin/depmod ]; then /sbin/depmod -ae -F System.map 2.6.19-gentoo-r5; fi 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 43.1.6 The first line of this output that is highlighted in blue indicates that the kernel has been compiled into one large file called bzImage and it has been placed into the /usr/src/linux/arch/i386/boot directory. In the next section we will copy the kernel into the /boot directory (which is the directory that the sda1 boot partition is attached to) so that it can be located during boot time. The second line that is highlighted in blue indicates that the kernel option that we selected as a kernel module has been installed into our directory hierarchy. The directory it was installed into is /lib/modules/2.6.8.19-gentoo-r5/kernel/arch/i386/kernel, but this is not shown. 3815 3816 3817 43.1.7 Assuming that you are still in the /usr/src/linux directory, change into the arch/i386/boot directory by executing a cd arch/i386/boot command and then execute an ls -l command to see the bzImage file: 3818 (chroot) livecd linux # cd arch/i386/boot 3819 3820 (chroot) livecd boot # pwd /usr/src/linux/arch/i386/boot 3821 3822 (chroot) livecd boot # ls -l -rw-r--r-- 1 root root 2737455 Sep 3823 3824 3825 3826 3827 3828 3829 5 02:05 bzImage 43.1.8 The listing indicates that the bzImage file that contains the compiled kernel is 2737455 bytes long. Before we copy it into the /boot directory, we should make sure that the /dev/sda1 boot partition is still mounted to it. This can be done by executing a mount command: (chroot) livecd boot # mount rootfs on / type rootfs (rw) tmpfs on / type tmpfs (rw) v1.81 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 Installing Gentoo Linux /dev/hdc on /mnt/cdrom type iso9660 (ro) /dev/loop0 on /mnt/livecd type squashfs (ro) proc on /proc type proc (rw,nosuid,nodev,noexec) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec) udev on /dev type tmpfs (rw,nosuid) devpts on /dev/pts type devpts (rw,nosuid,noexec) tmpfs on /mnt/livecd/lib/firmware type tmpfs (rw) tmpfs on /mnt/livecd/usr/portage type tmpfs (rw) usbfs on /proc/bus/usb type usbfs (rw,nosuid,noexec) /dev/sda3 on / type ext3 (rw,data=ordered) /dev/sda1 on /boot type ext2 (rw) udev on /dev type tmpfs (rw,nosuid) none on /proc type proc (rw) 43.1.9 The parts of this listing that are highlighted in blue indicate that the /dev/sda1 partition is indeed mounted to the /boot directory. We can now copy the bzImage file into the /boot directory by issuing a cp bzImage /boot command: (chroot) livecd boot # cp bzImage /boot 43.1.10 Finally, lets make sure that the bzImage file was correctly copied to the /boot directory by changing to this directory and then executing an ls command: 3851 (chroot) livecd boot # cd /boot 3852 3853 (chroot) livecd boot # ls boot bzImage lost+found 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 112/124 44 Configuring the system 44.1 We are almost done with the base installation process and our next step is to configure the system. 45 Configuring the /etc/fstab file 45.1.1 During the Gentoo Linux installation process, we manually mounted filesystems to various directories in the directory hierarchy. When the system is ready to use, however, we do not want to be required to manually mount filesystems each time the system is booted. Luckily, the process of mounting filesystems at boot time can be automated by defining which filesystems should be mounted where in the /etc/fstab file. The name fstab stands for file system table and here are the contents of this file before it has been configured: Installing Gentoo Linux v1.81 113/124 3866 (chroot) livecd / # cd /etc 3867 3868 (chroot) livecd etc # pwd /etc 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 (chroot) livecd etc # cat fstab # /etc/fstab: static file system information. # # noatime turns off atimes for increased performance (atimes normally aren't # needed; notail increases performance of ReiserFS (at the expense of storage # efficiency). It's safe to drop the noatime options if you want and to # switch between notail / tail freely. # # The root filesystem should have a pass number of either 0 or 1. # All other filesystems should have a pass number of 0 or greater than 1. # # See the manpage fstab(5) for more information. # 3882 # <fs> 3883 3884 3885 3886 3887 3888 # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts. /dev/BOOT /boot ext2 noauto,noatime 1 2 /dev/ROOT / ext3 noatime 0 1 /dev/SWAP none swap sw 0 0 /dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0 #/dev/fd0 /mnt/floppy auto noauto 0 0 3889 3890 # NOTE: The next line is critical for boot! proc /proc proc 3891 3892 3893 3894 3895 # glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for # POSIX shared memory (shm_open, shm_unlink). # (tmpfs is a dynamically expandable/shrinkable ramdisk, and will # use almost no memory if not populated with files) shm /dev/shm tmpfs nodev,nosuid,noexec <mountpoint> <type> <opts> defaults <dump/pass> 0 0 0 0 3896 3897 3898 3899 3900 3901 45.1.2 The fstab file is organized into columns with the filesystem device listed in the first column <fs>, the point in the directory hierarchy where it should be mounted listed in the second column <mountpoint> and the type of the filesystem listed in the third column <type>. If you would like to know what the <opts> and <dump/pass> columns do, you can look at the man page for the fstab file. 3902 3903 3904 3905 3906 3907 45.1.3 The only parts of the fstab file that need to be edited are the 3 parts highlighted in blue. In place of the word BOOT you should type sda1, in place of the word ROOT you should type sda3 and in place of the word SWAP you should type sda2. Execute a nano -wc fstab command to make these changes now. When you are done editing the fstab file, the three lines where the changes were made should look like this: Installing Gentoo Linux v1.81 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 ... /dev/sda1 /dev/sda3 /dev/sda2 ... /boot / none 3920 3921 (chroot) livecd conf.d # pwd /etc/conf.d 3922 (chroot) livecd conf.d # cat hostname 3923 # /etc/conf.d/hostname 3924 3925 # Set to the hostname of this machine HOSTNAME="localhost" 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 1 2 0 1 0 0 46.1.1 The systems network software now needs to be configured and the first step in this process is to give your machine a name. The machine's name is held in a variable called HOSTNAME which is in the /etc/conf.d/hostname file. The default name that the machine is currently set to is localhost and this can be seen in the following listing: (chroot) livecd / # cd /etc/conf.d 3928 noauto,noatime noatime sw 46 Configuring the network 3919 3926 3927 ext2 ext3 swap 114/124 46.1.2 The name I am giving my machine for now is "kosan1" but I will probably change it later: HOSTNAME="kosan1" 46.1.3 The next step in configuring the network is to set the name of the Internet domain it is inside of. We will discuss what an Internet domain name is later so for now edit the /etc/conf.d/net file and add the following line to it: dns_domain_lo="homenetwork" 46.1.4 The last network-oriented file that needs to be edited is the /etc/hosts file. The hosts file allows the system administrator to manually describe the local network the machine is attached to by associating machine names with IP addresses. We are assuming that our systems will use DHCP to automatically be configured by the network so we will not be adding much information to the hosts file. The one line in this file that we will edit, however, currently looks like this: Installing Gentoo Linux v1.81 3941 3942 3943 3944 3945 3946 3947 3948 3949 127.0.0.1 115/124 localhost 46.1.5 Earlier we discussed that the 127.0.0.1 IP address is a special address which is associated with the loopback interface. This address refers to the local machine and we need to add the following (colored) information to the line that contains this address in the /etc/hosts file: 127.0.0.1 kosan1.homenetwork kosan1 localhost 46.1.6 Keep in mind that instead of using the name 'kosan1' here you should use the name that you gave your own machine. 47 Services and the network service 3950 3951 3952 3953 3954 47.1.1.1 GNU/Linux operating systems have special programs called system services that can be started either manually or automatically. Another name for a system service is a "daemon" and this name is used because in Greek mythology, daemons were entities that performed various tasks for the Greek gods. 3955 3956 3957 47.1.1.2 Many of these services will run continuously until they are stopped or the machine is shut down. The following is a list of services that are often run on GNU/Linux machines: 3958 Network service - Maintains the machine's connection to the network. 3959 3960 Logging service - Accepts messages from all of the pieces of software that are running on the system and saves them into a log file. 3961 Cron service - Runs commands at times that are set by the system administrator. 3962 3963 Secure shell service - Allows users to remotely log into the system using a secure connection. 3964 3965 3966 3967 3968 3969 3970 3971 3972 47.1.1.3 A network service has already been installed on our machines, but it is not currently configured to start automatically at boot time. In order to have this service start automatically at boot time, execute a rcupdate add net.eth0 default command: (chroot) livecd conf.d # rc-update add net.eth0 default * net.eth0 added to runlevel default 47.1.1.4 If this command did not work, do the following and then try it again (note, l is a lower case L): cd /etc/init.d Installing Gentoo Linux v1.81 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 ln -s net.lo net.eth0 47.1.1.5 The name of the network service is net.eth0 and we have configured it to start when the machine enters what is called the default runlevel. GNU/Linux machines usually have a number of runlevels and a runlevel is a way to define a set of system services that should be running at the same time. The default runlevel is the normal runlevel a Gentoo system operates at after it has booted. 48 Emerging the DHCP client 48.1.1.1 Since we are going to use DHCP to have the network automatically configure our machines, we need to install the DHCP client program (a client is software that uses a service that is provided by a server). This is done by executing an emerge dhcp command: (chroot) livecd conf.d # emerge dhcp 49 Installing additional services 49.1 Earlier we talked about system services and we will now install a logging service and a cron service. To install a logging service called syslog-ng, execute an emerge syslog-ng command. After it is done emerging, add it to the default runlevel by executing an rc-update add syslog-ng default command: 3992 (chroot) livecd / # emerge syslog-ng 3993 (chroot) livecd / # rc-update add syslog-ng default 3994 3995 3996 49.2 To install a cron service called vixie-cron, execute an emerge vixiecron command and after it is done emerging, add it to the default runlevel by executing an rc-update add vixie-cron default command: 3997 (chroot) livecd / # emerge vixie-cron 3998 (chroot) livecd / # rc-update add vixie-cron default 3999 50 Installing and configuring the bootloader 4000 4001 116/124 50.1 Before the /dev/sda1 boot partition can be used to boot the system, boot loader software needs to be installed on it and configured. The boot loader v1.81 4002 4003 4004 4005 4006 4007 Installing Gentoo Linux we are going to use is called grub and it needs to be emerged by executing an emerge grub command: (chroot) livecd / # emerge grub 50.2 After grub has been emerged, a directory called grub will now be present in the /boot directory. Change to the boot directory and list its contents to make sure the grub directory is present: 4008 (chroot) livecd boot # cd /boot 4009 4010 (chroot) livecd boot # pwd /boot 4011 4012 (chroot) livecd boot # ls boot bzImage grub lost+found 4013 4014 50.3 In order to configure grub, a file needs to be placed into the /boot/grub called grub.conf: 4015 (chroot) livecd boot # cd grub 4016 (chroot) livecd grub # nano -wc grub.conf 4017 4018 117/124 50.4 The grub.conf file should contain the following information (make sure the 'I' in bzImage is capitalized): 4019 4020 default 0 timeout 10 4021 4022 4023 4024 #Option 0 title=Gentoo Linux root (hd0,0) kernel /boot/bzImage root=/dev/sda3 4025 4026 4027 4028 4029 50.5 The default keyword selects which boot option to accept by default. In our case, we only have one boot option (called Option 0) so this will be the default. The timeout keyword selects how long the boot menu will wait for input from the keyboard before moving forward with the boot process using the default boot option. 4030 4031 4032 4033 4034 50.6 Inside of option 0, the title keyword determines what is displayed in the boot menu for option 0. The root keyword tells grub what device contains the boot partition and which partition it is. Finally, the kernel keyword indicates where the kernel image has been placed on the boot partition and which partition is the root partition. Installing Gentoo Linux v1.81 4035 4036 4037 4038 50.7 The final steps that need to be done to install the boot loader are 1) copying the current mount information to the /etc/mtab (mount table) file using the grep command and 2) executing the grub-install /dev/sda command: 4039 (chroot) livecd grub # grep -v rootfs /proc/mounts > /etc/mtab 4040 4041 4042 4043 4044 4045 (chroot) livecd grub # grub-install /dev/sda Probing devices to guess BIOS drives. This may take a long time. Installation finished. No error reported. This is the contents of the device map /boot/grub/device.map. Check if this is correct or not. If any of the lines is incorrect, fix it and re-run the script `grub-install'. 4046 4047 (fd0) (hd0) 4048 4049 4050 118/124 /dev/fd0 /dev/sda 50.8 If the grub-install command listed a No error Reported message, then the boot loader was installed correctly. 51 Setting the root password and adding a user account 4051 4052 4053 4054 4055 4056 51.1 UNIX-like systems are known as multiuser systems because they can have more than one person logged into the system and using it at the same time. Each user is given what is called an account on the system and each account has a username and a password associated with it. Most users are also given their own directory to use which is called their home directory. All user home directories are placed within the /home directory. 4057 4058 4059 4060 4061 4062 4063 51.2 Each user account has various permissions associated with it which determine which resources on the machine the user has access to. There is always at least one account on all UNIX-like systems which is called the root account and the user that has access to this account is called the root user or the super user. The root account has permission to access all of the resources in the system and the home directory for this account is the /root directory. 4064 4065 4066 4067 51.3 It is just a coincidence that the top-level directory is called a root directory, the super user of a system is also called the root user and the root user's home directory is called /root. This can be confusing at first but one becomes use to it over time. 4068 4069 4070 4071 51.4 During the whole time we have been working from the CD, we have been using the super user's account. In the bash shell, a person can tell if they are currently using the super user's account if a pound sign '#' is displayed at the end of the command prompt. v1.81 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 Installing Gentoo Linux 119/124 51.5 Before we reboot the system, we need to set the password for the root user. If you do not set the root user's password now, when you reboot the machine you will not be able to long into your system! What you will then be forced to do is to reboot from the CD, mount all of the partitions, chroot into the /dev/sda3 partition, and then set the password. Lets set the password now in order to avoid this extra work. You can set the root user's password for your machine by executing a passwd root command: (chroot) livecd grub # passwd root New UNIX password: BAD PASSWORD: it is too short Retype new UNIX password: passwd: password updated successfully 4084 4085 4086 4087 4088 4089 4090 4091 51.6 The passwd command does not show the password you typed so that someone cannot look at your screen and steal your password. It also asks you to type the password twice in case you made a spelling mistake while typing. The passwd command will also inform you if it thinks you have chosen an unwise password (which it calls a BAD password). In my case, it thinks the password I typed is too short. If, however, the command also indicates that the password was updated successfully, then you can still use this password if you would like. 4092 4093 4094 4095 4096 4097 4098 4099 51.7 Now that you have set the root user's password, it is time to create a normal user account for yourself on the machine. It is considered to be a bad idea to use the root user's account for doing normal work on a system for a number of reasons. One reason is that if you make a mistake (like accidentally deleting the /etc directory) you can lose data or crash the machine. It is safer to do normal work in your own user account and just switch into the root user's account only when you need that account's extra permissions to do something. 4100 4101 4102 51.8 You can create a user account for yourself using the useradd command. The following example shows the creation of a user account which will have the username tkosan associated with it: 4103 4104 4105 4106 4107 4108 4109 (chroot) livecd / # useradd -m -G users,wheel -s /bin/bash tkosan 51.9 The -m option tells useradd to create a home directory for the user, the -G option indicates what groups the user should belong to (we will cover groups later) and the -s option determines which shell the user will use when they log in. After the account has been created, a password needs to be set for it using the passwd command: (chroot) livecd / # passwd tkosan Installing Gentoo Linux v1.81 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 120/124 New UNIX password: Retype new UNIX password: passwd: password updated successfully 51.10 You will now be able to log into your new account when you reboot the machine. 52 Rebooting the machine 52.1 The base Gentoo Linux installation process is now complete! Before rebooting the machine, however, we need to exit from the chroot environment, change into the top-level root directory, and unmount all of the filesystems that we mounted earlier. The chroot environment is exited using the exit command and filesystems are unmounted using the umount command: 4122 4123 (chroot) livecd / # exit exit 4124 4125 4126 4127 4128 livecd livecd livecd livecd livecd / / / / / # # # # # cd / umount umount umount umount /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo 4129 4130 52.2 You should also exit from each virtual terminal you logged into using the exit command. 4131 52.3 Finally, execute the halt command to halt the system 4132 livecd / # halt 4133 4134 4135 4136 4137 4138 4139 52.4 Before rebooting, either remove the CD or make sure that the motherboard is configured to have the hard drive as the first boot device and not the CDROM drive using the motherboard setup utility. After the system reboots, you will be presented with a login prompt. Type the username for the root account (which is "root") and press the <enter> key. Type the root account's password, press the <enter> key again and you will be given a standard command prompt. 4140 4141 4142 4143 52.5 You can now start exploring your new system. The first thing you may want to do is to remove the stage3 and portage files from the top-level root directory using the rm (remove) command since you will not be needing them anymore. 4144 52.6 When you are ready to shut your system down, you can use the halt v1.81 4145 4146 Installing Gentoo Linux 121/124 command. You must be using the super user's account in order to halt the machine. Installing Gentoo Linux v1.81 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 122/124 Shutting Down VirtualBox Before Installation Is Complete 1 Shutting Down Before chroot Is Executed 1.1 If you need to shutdown the virtual machine before the chroot command was executed, here is what you need to type: cd / umount /mnt/gentoo/boot umount /mnt/gentoo halt 1.2 When you reboot the VM, you must remount /dev/sda3 to /mnt/gentoo and /dev/sda1 to /mnt/gentoo/boot before continuing. 2 Shutting Down After chroot Is Executed 2.1 If you need to shutdown the virtual machine after the chroot command was executed, here is what you need to type: exit cd / umount umount umount umount halt /mnt/gentoo/proc /mnt/gentoo/dev /mnt/gentoo/boot /mnt/gentoo 2.2 When you reboot the VM, you must remount sda3, sda1, proc, and dev and chroot again before continuing. 4169 ==== 4170 Howto Access via ssh a Virtualbox Guest machine. 4171 August 12, 2007 | 0:03 4172 4173 4174 4175 4176 By default, the network connection in VirtualBox is set to NAT (Network Address Translation), that is every packet coming from the Guest machine is modified so that it seems as it has come from the Host machine. In this way it’s easy for the Guest machine to connect to all the rest of the network (the internet included) but nobody can start a connection with the Guest Machine since it’s hidden behind the Host one. 4177 So, if you are going to test a server service in your Guest machine (i.e. Apache or ssh) you have two http://mydebian.blogdns.org/?p=148 v1.81 4178 4179 4180 Installing Gentoo Linux 123/124 choices: 1. pass to Virtualbox Host network connection; 2. make virtualbox forward all the packets arriving to a certain port of the Host machine. 4181 4182 4183 This article will describe how to do the latter, in particular in the case of the ssh server. This is an interesting case because it allows you to simulate very well a quite common condition: connecting to a remote Linux headless machine. 4184 4185 4186 4187 We have a Guest Machine with a running ssh server which accepts connections on the TCP port 22. Our goal is to make any packet arriving at a given TCP port (i.e. 2222) of the Host machine, to be forwarded to the TCP port 22 of the Guest Machine. Fortunately, there is Virtualbox command which permits to do it almost instantly: VBoxManage. 4188 4189 Let the Guest machine name (quote it if it contains spaces), here are the commands that you have to type in the Host machine console: 4190 4191 4192 4193 4194 4195 $ VBoxManage setextradata <guestname> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222 $ VBoxManage setextradata <guestname> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22 $ VBoxManage setextradata <guestname> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP 4196 4197 HostPort,GuestPort,Protocol are just string examples and can be changed without any consequence. Just remember your choices if you want to remove them later. 4198 4199 Once you have typed the above commands, you need to close the Guest Machine (a reboot won’t be sufficient), restart it and then connect via ssh with: 4200 $ ssh -l <user> -p 2222 localhost 4201 Replace localhost with the Host Machine ip address if you are connecting from another computer. 4202 4203 Now what? Well, you could do some Ssh Tunneling to run X application on the Guest Machine and see the display on your Host/Desktop. How? I wrote a little guide before. 4204 4205 By the way, you can check which customisations have been already set for your Guest Machine with VBoxManage (again) by typing: 4206 4207 4208 $ VBoxManage getextradata <guestname> enumerate or remove one, for example “VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort”, by setting it without any value: 4209 4210 $ VBoxManage setextradata <guestname> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 4211 ==== 4212 gconf-edito v1.81 Installing Gentoo Linux 4213 ==== Procedure for reentering the chroot enviornment. 4214 livecd / # cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf 4215 livecd / # mount -o bind /dev /mnt/gentoo/dev 4216 livecd proc # mount -t proc none /mnt/gentoo/proc 4217 livecd proc # chroot /mnt/gentoo /bin/bash 4218 livecd / # env-update 4219 livecd / # source /etc/profile 4220 ==== Procedure for when grub> comes up when booting from the hard drive. 4221 4222 When grub> come up when trying to boot from the hard drive, this usually means that the grub.conf file has a typo in it. Do the following to fix it: 4223 4224 4225 4226 4227 4228 4229 1) Boot off of the .iso CD image. 2) Mount /dev/hda1 to /mnt/gentoo. 3) Use the cd command to change into /mnt/gentoo/boot/grub. 4) Edit the grub.conf file to fix it. 5) Change back into the root directory with cd /. 6) Unmount /mnt/gentoo. 7) Try rebooting using the hard drive again. 124/124