The Linux Bootdisk HOWTO Chinese translation

xiaoxiao2021-03-06  21

The Linux Bootdisk HOWTO HTTP: //www.linux.org.tw/cldp/ (2001-04-30 12:59:15)

Author: Tom Fawcett (fawcett BH@croftj.net) Translator: Zhu Hannong v4.0, April 2000, date of the translation: 27 July 2000 -------------------- -------------------------------------------------- ---------- This article describes how to design and build your own Linux boot / root magnet. These magnetic sheets can be used as a rescue disks or can be used to test new system components (COMPONENTS). Before trying to build your own bootdisk, you should be quite familiar with system management. If you just want an emergency rescue magnet, please refer to Pre-Made bootdisks.

-------------------------------------------------- ------------------------------ 1. Preface - Preface 1.1 Version Precaution - Version Notes 1.2 has not completed things 1.3 Responding to Thanks - Feedback and Credits 1.4 Distribution Policy - Distribution Policy 2. Introduction - Introduction 3. Bootdisks and Power Travel Process - Bootdisks and The Boot Process 3.1 Power Train Process - The Boot Process 3.2 Disk Type - Disk Types 4. create a root filesystem - Building a filesystem 4.1 Overview root - Overview 4.2 production filesystem - Creating the filesystem 4.3 migration file system - Populating the filesystem 4.4 to provide PAM and the NSS - providing for PAM and NSS 4.5 modulus Group - Modules 4.6 Some Last details - Some Final Details 4.7 Wrapping IT UP 5. Select a kernel - Choosing a Kernel 6. Put them together:

Making a magnetic (group) - Putting the diskette (s) 6.1 Download KERNEL with LILO - Transferring The Kernel With Lilo 6.2 Do not use Lilo to transfer KERNEL - TRANSFERRING THE KERNEL WITHOUT LILO 6.3 Setting RamDisk - Setting the ramdisk word 6.4 conveying root filesystem - Transferring the root filesystem 7. problem solving - Troubleshooting, or the Agony of Defeat 8. various other topics - Miscellaneous topics 8.1 root filesystem reduction of size - reducing root filesystem size 8.2 Non-ramdisk root filesystems 8.3 Construction Tools - Building a Utility Disk 9. How The Pros Do IT 10. Frequently Asked Questions (FAQ) List - FREQUENTLY Asked Questions (FAQ) List appendix 11. Resources and instructions - Resources and Pointers 11.1 Pre-Made Bootdisks 11.2 Rescue Kit - Rescue Packages 11.3 Lilo - The Linux Loader 11.4 Linux FAQ with HOWTOS 11.5 Ramdisk How to use - Ramdisk Usage 11.6 Linux boot process - The Linux Boot Process 12. Lilo Boot Error Codes 13. Root FileSystem List Sample - Sample Root Filesystem Listings 14. Tools Pack (Utility Disk Directory List - Sample Utility Disk Directory Listing - -------------------------------------------------- ------------------------------------------------- -------------------------------------------------- --------- 1. Foreword - preface may have expired. If the date on the title page has been more than 6 months, please check if the bootdisk-howto homepage has a newer version. Although this article is also read in a TEXT format, but because of the relationship of the print symbol, it is best to read in postscript (.ps), PDF or HTML format. 1.1 Version Note - Version Notes Graham Chapman is the author of Bootdisk-HOWTO, and he has been supporting to Version 3.1. Tom Fawcett is approximately a cooperation author when you ask Municipality in Kernel V2. He is the current maintainer in this article. The information in the text is Linux that is operated on the Intel platform. Many of these information may be able to apply Linux in other platforms, but we have not tried to make bootdisk on other platforms, nor related information. If you have experience in making bootdisk on other platforms, please contact us.

1.2 Is there any volunteers that have not been completed? Please describe how to make other bootable tab items, such as CDROMS, Zip Disks and LS110 Disks. Please describe how to handle huge libc.so sharing a library. Basically, you can choose to get older, smaller libraries, or delete existing libraries. Re-Analyze Distribution Bootdisks and Update "How The Pros DO IT" section. Delete the narrative about how to upgrade the existing Distribution Bootdisks chapter. THIS USUALLY More Trouble Than It's Worth. Rewriting / Runner Troubleshooting This section. 1.3 Response and Thanks - Feedback and Credits I accept any response to this article, whether it is bad. I / We have strived that the instructions in this document are correct and reliable. If you find any errors or omissions, please let me know. When writing, please indicate the version number of the file you refer. We thank many people who assist in fixing and giving suggestions. Their contribution makes this article more better when we have completed it independently. Please use the above Email address to give the author your criticism, correct and questions. I don't mind trying to answer any questions, but if you have a specific problem is about your bootdisk can't work, please read Troubleshooting first. 1.4 Distribution Policy - Distribution Policy Copyright? 1995, 1996, 1997, 1998, 1999, 2000 by Tom Fawcett and Graham Chapman. This article is circulated under the conditions of Linux Documentation Project License. If you fail to get this license, please contact the author. This article is a free file. We have released it hopes that it can help you, but you can't give you any guarantee; this article also does not have business capabilities or suitable for specific purposes. -------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- ---------- 2. Introduction - Introduction Linux boot disk (Boot Disks) is very useful in many cases, such as testing a new core (kernel). Recovery from disk errors (such errors is possible from the loss of the landing magnetic area to disk read writing writing). Fixed a system file (Critical) system file (such as libc.so), securely upgraded a parabled. There are several ways to get Boot Disks: Use the distribution kit (distribution) as Slackware. It can at least let you boot. Use a rescue kit (package) to build a magnetic sheet for rescue magnetic sheets. Learn everything you need when your Disk is operating system, then produce it. Some people choose the last way, so they can do it by doing themselves. This way, if a problem occurs, you can find a solution to solve the problem. In addition, many knowledge about how Linux work is also learned. This article assumes that the reader is familiar with the basic Linux system management concept. For example, you should know the topic of the directory, FileSystems and the flop. You should also know how to use Mount and DF. You should also know the use of / etc / passwd and fstab and what they look like.

Finally, you should know most of the command in the Howto file, you should do it as root. It is very complicated to start making your own bootdisk. If you have not read Linux FAQ with related files, such as Linux Installation HOWTO and Linux Installation Guide, then you should not try to build boot magnetic sheets. If you only need BootDisk used in an urgent time, downloading a bootdisk that others completed in advance will be easier. Please refer to Pre-Made bootdisks below to know where to find these things. -------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- ---------- 3. Bootdisks and the boot process - Bootdisks and the boot process bootdisk is basically a small and self-sufficient Linux system in the flood disc. It must perform the same functions as many Linux systems that completely and ful-size. Before building bootdisk, you should learn about the basic Linux boot process. We only do basic introductions here, but it is enough to let you know the content after this article. Many details and alternative options have been omitted. 3.1 Launch Process - The Boot Process All PC systems start the power-on process through the execution of ROM (clearly said, it is BIOS), from the 0th magnetic region of the boot disk, the 0th magnetic column is loaded The boot magnetic area. The boot disk machine is usually the first soft disc (such as the a groove of DOS and the Linux / DEV / FD0). The BIOS will then try to perform this magnetic area. On most bootable Disks, the 0th magnetic area, the 0th magnetic column contains one of the following: boot loader, such as LILO, it will find the location of Kernel, then load And execute it to start the boot program. The beginning of a working system Kernel, such as Linux. If a Linux Kernel has been placed in a magnetic sheet by using Raw-Copied, then the first magnetic area of ​​this magnet is the first magnetic area of ​​Linux Kernel itself. This magnetic area will load from the boot device into the remainder of Kernel to continue the power-on process. Once Kernel is loaded, some basic equipment is also initialization. The system will then try to load from a device and hung (Mount) root filesystem. The so-called root filesystem is just a flySystem that is hung as a `` / '' directory. KERNEL must be told where to find this root filesystem; if kernel can't find a loadable video file (Image), the system will stop operating (HALT). In some boot sites - often starting from the floppy disk - root filesystem will be loaded into the RAMDisk, which is the RAM accessed by the system, like a system access disk. Why is the reason why the system will be loaded into ramdisk is two. First, RAM is a few ordered magnetic bodies faster than the soft disc, so the system is running faster; the second, Kernel can load a compressed FileSystem from the floppy disc and put it in Ramdisk after decompression On, more files are stored on the flop.

Once root filesystem is loaded and hang, you will see a line image: vfs: mounted root (ext2 filesystem) readonly. The system will find the init program on root filesystem (in / bin or / sbin) and execute it . INIT reads its configuration file / etc / inittab, find the row labeled in the file, and execute the named script. This sysinit script usually similar / etc / rc or /etc/init.d/boot two files. This script is a set of shell instructions for establishing basic system services, such as: performing FSCK for all disks, loads Swapping, starts SWApping, performs network initialization, specify disks in FSTAB Hang. This Script is often initialized by other various Scripts execution modules. For example, in a general sysvinit architecture, /etc/rc.d/ This directory contains a complex subthematical architecture, which indicates how to start with most system services to close. However, in a bootdisk, such Sysinit Script is often very simple. When the Sysinit Script is over, the control returns to INIT, then enter the preset Runlevel, this preset Runlevel is specified in the initTab in the initTab in the initTab. This Runlevel Line typically specifies a program like getty, which is responsible for processing communication between console and TTYS. In fact, the Getty program is printed on the screen, a familiar `` login: '' prompt. The Getty program is switched to the login program to handle whether Login is valid, and then establishes User Sessions. 3.2 Disk Type - Disk Types If you have learned the basic boot process, we can now define a variety of different types of disks involved. We classify the magnets into four kinds. This article is called the `` disk (Disk) 'called here, unless there is a special statement, otherwise it is a soft disc, although most of the discussions are also applicable to the hard disk. Boot is a magnetic piece containing Kernel that can be started. This magnet is used to start KERNEL, then this Kernel will load root file system on another magnetic sheet. Kernel on bootdisk usually must be told where to find its root filesystem. BootDisk often loads a root filesystem from another magnetic, but via, bootdisk may also be set to Root FileSystem in the hard disk. Usually do this when testing new kernel (in fact, `` make zdisk '"will automatically create such a BootDisk from the original code of Kernel. Root contains a must-have file for the function of Linux system on its FileSystem Magnetic. This magnetic sheet does not have kernel or boot loader. Once Kernel is started, Root Disk can operate independently of other magnetic sheets. Usually the content of root disk will be automatically copy to RAM and become RAMDISK. This makes the access of root disk become more fast, and can release a soft disc to the tool program magnetic (Utility Disk).

Boot / root contains a magnetic sheet with kernel with root filesystem. In other words, this magnetic sheet contains unused hard drives to start and operate the WINUX system. The advantage of this magnetic sheet is that it is simple and light-every necessary thing is placed on the same magnetic sheet. However, with the gradual increase in the archive size, all things are more difficult to exist on the same magnetic sheet, and even the same use of compression. Utility is a magnetic piece containing FileSystem, but it is not to be used as a root file system. This magnet can be considered an additional data sheet (DATA DISK). You can use this magnetic to put the tools whose original and cannot be placed on the root disk. In general, when we refer to `` build a bootdisk '', it refers to the two parts of Boot (Kernel) and root (files). These two parts are not placed together (a single boot / root disk) is two separate magnetic pieces (Boot root disks). The most elastic practice of rescue magnetic sheets may be two separate boot and root magnetic sheets, plus one or more Utility Diskettes to handle more. -------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- ---------- 4. Create a root filesystem - building a root filesystem to create root filesystem involves the option to make the system necessary to function properly. In this section, we will describe how to build a compressed root filesystem. Built on a magnetic sheet is a more uncommon concept of uncommon FileSystem; this alternative is described in Non-Ramdisk Root FileSystem. 4.1 Overview - OverView root filesystem must include each item required to support the full Linux system operation. In order to achieve this, this magnetic sheet must include the minimum requirements that allow Linux systems to operate at least: Basic archive system architecture, minimum directory: / dev, / proc, / bin, / etc, / lib , / Usr, / tmp, basic tool program: SH, LS, CP, MV, ETC., minimum configuration setting gear: RC, INITTAB, FSTAB, ETC., Equipment file: / dev / hd *, / DEV / TTY *, / DEV / FD0, ETC., Runtime Funct Library to provide the basic functionality used by the tool program. Of course, any system will only look useful when you can perform some things, and a root magnet is usually only useful when you can do the following: Check another disk machine File System, for example, check the root file system on your hard drive, you must be able to start Linux from another disk, for example, you can do this with a root magnet. Then you can perform FSCK when you have not hung up in your original root disk.

Use files (Archive) and compression tools, such as CPIO, TAR, GZIP, and FTAPE, recovery from backup (Backup), store all or part of your original root disk machine. We will describe how to build a compressed FileSystem, which is usually compressed on the magnetic sheet, which is only to deprecate when it is pressed when it is turned on. With compressed FileSystem, you can put a lot of files (about 6 megabytes) on a standard 1440K magnet. Because FileSystem is much larger than the magnetic sheet, we can't build it directly on the magnetic sheet. We must build it elsewhere, compress it, and then copy it to the magnetic sheet. 4.2 Making FileSystem - Creating The FileSystem In order to build such a FileSystem, you need more than enough equipment that allows you to store all the files before compression. You will need a device that can store approximately 4 megabytes files. There are several options: Use ramdisk (device = / dev / ram0). In this case, the memory is simulated into a disk machine. RamDisk must be large to FileSystem that is capable of storing an appropriate size. If you use Lilo, check your configuration setting file (/etc/lilo.conf), find a line like ramdisk = nnn decision to be assigned to RAMDisk's RAM's extreme value. The preset value is 4096K, which should be enough. You should not try to use such ramdisk on a computer that is less than 8MB RAM. Check to confirm that you have a device file like / dev / ram0, / dev / ram or / dev / ramdisk. If not, you should create / dev / ram0 in mkNod (Major Number 1, Minor 0). If you have a hard disk for unused and big enough, you can use it. Using a loopback device, this can use a disk file as a device. When using Loopback Device, you can create a 3 megabyte file on your hard drive and build FileSystem on it. Type the Man Losetup to find instructions to use Loopback Devices. If you don't have Losetup, you can be from ftp://ftp.win.tue.nl/pub/linux/utils/UTIL-LINUX / Directory, the mount of the UTIL-Linux Suite (Package) Mount and Unmount Find it in the attachment. If there is no Loop Device file (/ dev / loop0, / dev / loop1, etc.) On your system, then you must use `` mknod / dev / loop0 b 7 0 '' to create one. Once these special mount is installed, the Temporary File (EG, / TMP / FSFILE) is made on a large-scale hard drive. You can use instructions like this: DD if = / dev / zero of = / tmp / fsfile bs = 1k count = nnn to create an NNN-block file. Please use your own file to replace the following Device. When you get a mount directive, you should add the `` -o loop 'option to tell the mount is to use LoopBack Device.

For example: mount -o loop -t ext2 / tmp / fsfile / mnt is hung in the way to loopback device, hung up / MNT this Mount Point on the / tmp / fsfile. Use the DF instruction to let you see the above results. After you choose one of the methods, please prepare Device to: DD if = / dev / zero of = device bs = 1k count = 4096 This line of instructions sent a bunch of 0 to fill the Device. Filling Device is a key step because FileSystem will then be compressed, so all unused portions should be filled with 0 to achieve the maximum compression ratio. Whenever you delete a file from your root filesystem, remember this fact. In fact, FileSystem just releases these Blocks, but does not fill them into 0. If you have implemented a lot of deletions with your Copy, your compression FileSystem will last a lot more than necessary. The next step is to make FileSystem. Linux Kernel admits that two File System enable root disks automatically by Copy to RamDisk. They are Minix and EXT2, where EXT2 is more popular. If you use ext2, you will find that the use -i option specifies more inodes that is more than the preset value is helpful; we recommend using -i 2000, so you will not be used inodes. If you don't use the above option, you can remove many unnecessary / dev archives to save inodes. MKE2FS presets will result in 360 inodes on a 1.44MB magnetic sheet. I found it on my current rescue root magnet, 120 inodes is quite enough, but if you put all the device files in the / dev directory, you can easily exceed 360 inodes. Using compressed root filesystem allows you to have large FileSystem, while presets will have more inodes, but you still have to reduce the number of files, or add the number of inodes. Therefore, the instructions you use look like this: mke2fs -m 0 -i 2000 device (if you use a loopback device, then use the disk file you currently replace the above Device.) MKE2FS instruction It will automatically detect the available space and then configure itself according to the detection. `` -M 0 '' parameter Avoid retention space to root, so more available disks can be provided. Next, hang this Device: mount -t ext2 device / mnt (if Mount Point does not exist, you must create a mount point / mnt / mnt.) In the remaining chapters, all the purpose (Destination) directory It is assumed to be relative to / mnt. 4.3 Transplanting Archives - Populating The FileSystem The following is your root filesystem. Minute directory The directory schema rendered is only for root diskette. The real Linux system has a more complex and well-designed architectural approach, called FileSystem Hierarchy Standard, which determines how the file should be placed.

: / DEV - DEVICES (Devices), to achieve I / O work required / proc - Directory Stub Required by The Proc FileSystem / etc - Insi storage system configuration setting file / sbin - Important (critical) system binary execution file (binaries) / bin - is considered to be a basic binary execution file / lib - providing Run-Time support sharing library / mnt - Maintaining other disks Mount Point / USR - Additional Tool Program and the application above the above directory will be empty on root filesystem, so they only need to make MKDIR. The / Proc directory is basically a STUB placed under its under which proc filesystem is placed. / MNT and / USR These two directorys are just Mount Points used in the boot / root system. So re-over, these directories can only be created. The remaining four directorys are described in the following sections. The / dev / dev directory contains a group of special files, which are used by all devices on the system, so that each Linux system will be available in this / dev directory. This catalog itself is a normal directory that can be made with MKDIR in general methods. However, these special files must be made with MKNOD instructions in a particular method. But there is still a shortcut - directly copy you existing / dev directory content, then clear the device file you don't want. The only requirement is to use the -R option when Copy is a special device file. This option will copy the files in the entire directory, but will not copy the contents of these files. Please sure to use uppercase letters R. This instruction is: cp -dpr / dev / mnt here we assume that the magnetic sheet is hung down / mNT. DP Options (Switches) Make sure Symbolic Links is a TARGET file pointed to by Links instead of the Target file points to the COPY link. At the same time, the original file properties are also retained, thus retaining all rights information of the file. If you want to complete this task with high difficult techniques, use ls -l to list Major with Minor Device Numbers you want, and then use MKNOD to create them on the magnetic sheet. No matter how Copy these device files, or check if you have the device file you need, whether it is placed in this rescue magnetic sheet. For example, FTAPE uses a tape device if you want to access a soft tape drive from bootdisk, you will need a copy-related device file. Note that each device file requires an inode, but inodes has always been a rare resource, especially on the magnetic flatsystems. Therefore, it makes sense to remove any device files you don't need from the / dev catalog on the magnetic sheet. For example, if you don't have a SCSI disk, you can remove all Equipment files starting with SD. Similarly, if you don't want to use your sequence (SERIAL port), you can also remove all equipment files starting with CUA. Please make sure the following files are placed from this directory: console, kmem, mem, null, ram0 and tty1. / Etc This directory contains important configuration settings. In most systems, these files are divided into three groups: all the necessary, E.G. RC, FSTAB, Passwd. It may be necessary, but no one can be determined. Bilingual lender running in.

It is usually possible to identify which is the following instructions: ls -ltru is listed in the order in which the file is late, so if any file will not be Access, then they can be deleted from the root magnetic sheet. On my root magnetic sheet, my configuration file has been reduced to 15. This reduces the work of the following three files: I have to configure the file for the boot / root system: rc.d / * - System starts with the change of Run Level Scripts fstab - to be hung File Systems List INITTAB - The first processs that started when it is turned on. We should sort out the files for the Boot / root system: Passwd - the list of important users, HOME directory and other items. Group - User group. Shadow - the user's password. You may not have this file. Termcap - The Terminal Capability Database. If system security is important to you, the Passwd and Shadow should be deleted to avoid the user password Copy, so when you start from the magnetic sheet, don't want it Logins will be rejected. Make sure Passwd contains at least ROOT. If you want other users login, make sure that their home directory is exist with shells. Termcap, Terminal Database, in general, there are hundreds of kilobytes. The version of your boot / root magnet should be deleted to only the terminal you use, which is usually Linux or Linux-Console project (entry). The rest. The Moment, So I Leave Therm alone. Out of this, I actually only set two files, and the items they should include are amazing. The RC should include: #! / Bin / sh / bin / mount -av / bin / hostname kangaroo Please make sure the directory above is correct. You don't need to really perform hostname - if you do just let the system look better (the translation: so the system will have a name). FSTAB should include: / dev / ram0 / ext2 defaults / dev / fd0 / ext2 defaults / proc / proc defaults You can use the project you want from your existing fstab copy, but you shouldn't automatically hang you Hard dish any partitions; please use the NOAUTO keyword for these items (translation: instead of default with noauto). When using bootdisk, your hard drive may be damaged or hanging. Your initTab should be changed so that the Sysinit This can perform RC or the basic boot Script that will be performed. At the same time, if you want to make sure you don't want to login from the sequence, please add the "#" symbol (Comment Out) before all of the TTYS or TTYS. Please keep TTY to allow you to log in front of console.

A minimum initTAB file looks like this: ID: 2: InitDefault: Si :: sysinit: / etc / rc 1: 2345: Respawn: / sbin / getty 9600 TTY1 2: 23: Respawn: / sbin / getty 9600 TTY2 The initTab file defines what projects will be performed in a variety of different situations, including Startup, switching to multi-user mode, and more. Please check the file name (filenames) mentioned in InitTab; if init cannot find the program mentioned, bootdisk will stop working, and you will not even get an error message. Note that some programs cannot be moved to it elsewhere, because other programs have been written when writing (hardcode). For example, on my system, / etc / shutdown has written the / etc / reboot location. If I move reboot to / bin / reboot, then a shutdown command will have an error because of the reoccotial file. Left, it is COPY all text files in your / etc directory, plus in your / etc directory, you can't determine all of you need unwanted files. For the guide, please refer to the sample list in Sample Roodisk Directory Listings. Perhaps as long as the copy of these files is sufficient, the system difference will have a big impact, so you can't determine the same file combination on your system, you must be equal to the file in the list. The only way to determine is from inittab and find out what it is. Most of the system uses the /etc/rc.d/ directory, which contains the shell scripts of different Run Levels. At the very least there will be a single RC Script, but only two directories of your existing system copy inittab with /etc/rc.d, then delete the shell scripts in the RC.D directory to remove and magnetic system environments. Unrelated processing will be relatively simple. The / bin and / sbin / bin directory is a convenient place to place the additional tools required to perform the basic job (Operations), such as LS, MV, CAT and DD. Sample Rootdisk Directory LISTINGS in BIN / SBIN. However, there is no such thing as a tool that needs to be restored from backup, such as CPIO, TAR and GZIP. This is because I put these things on another Separate tool programmable magnetic sheet to save space for boot / root magnetic sheets. Once the boot / root magnetic is started, it will be copy to ramdisk and release the soft disc server, so that the snack machine can hang another magnetic piece, which is the tool program. I usually hang it on doing / usr. Production of Tool Program Magnets (Utility Diskette) is described in this section of the building a utility disk. Keep a copy of the tool program, which is better, this backup tool program is used to make a backup, so you don't have to waste time, you can't read the version of your backup tape. Please make sure you include the following procedures: init, getty, or equivalent program, login, mount, some of the shell you can perform your RC Scripts, and a LINK pointing from the SHELL.

/ lib is in / lib, you have to put into the necessary shared Function Library (Libraries) and loaders. If you cannot find the necessary libraries in your / lib directory, the system will not boot. If you are lucky, you may see the error message telling you why this happens. Recently, each program requires at least the libc library, libc.so.n, where n is the current version number. Please check your / lib directory. Libc.so.n is usually a SymLink, which pointing to a full version number:% ls -l / lib / libc * -rwxr-xr-x 1 root root 4016683 APR 16 18:48 LIBC-2.1.1 .so * lrwxrwxrwx 1 root root 13 APR 10 12:25 libc.so.6 -> libc-2.1.1.so * In this case, you will want libc-2.1.1.so. In order to find other libraries, you should have to read the binary files you plan to include, and check their dependence with LDD instructions. For example:% ldd / sbin / mke2fs libext2fs.so.2 => /Lib/Libext2fs.SO.2 (0x40014000) libcom_rr.so.2 => /Lib/Libcom_ERR.SO.2 (0x40026000) libuuiD.so. 1 => /Lib/libuuiD.so.1 (0x40028000) libc.so.6 => /Lib/Libc.SO.6 (0x4002C000) /Lib/ld-Linux.so.2 => / lib / ld-linux .sso.2 (0x400000000) Every file on the right hand is certain. Some files may be a Symbolic Link. Please note that some of the library is quite large, and it does not easily cooperate with your root filesystem. For example, the above LIBC.SO is approximately 4 megabytes. So, while you COPY, you may need to remove some of the libraries. Please see the Reducing Root FileSystem Size this section to learn about INSTRUCTIONS. In / lib, you must also include a Loader for use in these libraries. This Loader is not ld.so (uses it to the A.outphone library), which is ld-linux.so (uses to the ELF library). The newer version of LDD will tell you what Loader you need to do, but the old version will not. If you are not sure which loader you need, perform the File instruction to the File Library.

For example:% file /lib/libc.SO.4.7.2 /Lib/Libc.SO.5.4.33 /Lib/Libc-2.1.1.so /lib/libc.so.4.7.2: Linux / i386 Demand-Paged Executable (QMAGIC), Stripped /Lib/Libc.SO.5.4.33: ELF 32-BIT LSB Shared Object, Intel 80386, Version 1, Stripped /Lib/Libc-2.1.1.so: ELF 32-bit LSB Shared Object, Intel 80386, Version 1, NOT STRIPPED QMAGIC pointed out that the version 4.7.2 is used to the A.out library, and ELF points out 5.4.33 and version 1.1.1 is used to ELF. Please copy you need to specify loader (s) to the root filesystem you established. For the binary files included, the library and loaders should be carefully checked. If kernel can't load the desired library, then Kernel will stop operating without an error message. 4.4 Provide PAM and NSS - Providing for Pam and NSS Your system may need to dynamically load the library that is not seen by the LDD. If you don't provide a library to these items, you will encounter difficulties when logging in or using your bootdisk. PAM (Pluggable Authentication Modules) If your system uses PAM (Pluggable Authentication Modules), then you must do some preparators for PAM on your bootdisk. In short, PAM is a complex and precise modification method that controls user authentication and controls the user's access to the service. A simple way to determine if your system uses PAM, is to perform LDD for your login executable; if the output includes libpam.so, you will need PAM. Fortunately, security is usually not bootdisk's topic, because anyone who has actual access to the machine can usually do anything they want to do anyway. Therefore, you can effectively turn off the PAM, as long as you make a simple /et FileSystem to create a simple /etc/pam.conf file, this file looks like this: --------------- -------------------------------------------------- --------------- Other auth optional /lib/security/pam_permit.so Other account optional /lib/security/pam_permit.so Other password optional /lib/security/pam_permit.so Other session Optional /lib/security/pam_permit.so ----------------------------------------- --------------------------------------- Please remember the copy / lib / security / pam_permit. So This file is to your root filesystem. This library is only about 8K, so it only occupies a very small amount of Overhead. Remember this configuration setting allows anyone to have complete access to this machine and service.

If you care about your bootdisk because of some reason, you must Copy or all your hard drive Pam Setup to your root filesystem. Make sure you have read the PAM file carefully, and Copy Any Valink Library you need in / lib / security to your root filesystem. You must contain /lib/libpam.so to your bootdisk. But you know this, because you have already performed LDD for / bin / login, which shows its dependencies. NSS (Name Service Switch) If you are using Glibc (Aka Libc6), you must prepare the name service (Name Switch), otherwise you will not log in. /Etc/nsswitch.conf This file control library is a search for all types of services (LOOKUPS). If you don't plan to access services from the Internet (such as: DNS or NIS search), then you only need to prepare a simple nsswitch.conf file, this file looks like this: --------- -------------------------------------------------- --------------------- Passwd: Files Hostow: Files Group: Files Hosts: Files Services: Files RPC: Files ethers: Files Netmasks: Files Netmasks: Files Netmasks: FILES NETMASKS: Files Netmasks Files bootparams: Files Automount: Files Aliases: Files NetGroup: Files Publickey: Files ------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------- This specified each A service is only available by Local Files. You also need to include /lib/libnss_files.so.x, where x is 1, refers to GLIBC 2.0, and 2 is GLIBC 2.1. This library will be loaded with dynamic manner to process file search. If you plan to access the Internet from your bootdisk, then you will want to make a more delicate and complicated nsswitch.conf file. Please refer to NSSwitch Man Page for details. Finally, please remember that you must put the /lib/libnss_service.so.1 file into bootdisk for each service you specified. 4.5 Module - Modules If you have a modular kernel, you must take it after booting, which module you want to upload from your bootdisk. You may want to include the FTAPE and ZFTAPE module (if your backup tape is Floppy Tape), and the module for SCSI devices (if you have SCSI devices), it is also a module that PPP or SLIP support (if You want to access the Internet in an emergency. These modules may be placed / lib / modules. You should also include Insmod, RMMOD and LSMOD. Depending on if you want to automatically load the module, you may also include MODPROBE, DEPMOD and SWAPOUT. If you use Kerneld, please include it with /etc/conf.modules.

However, the main advantage of using the module is that you can move the non-critical module to the Utility Disk, which is only loaded, so that less space is used on your root disk. If you have to handle many different devices, this method is better than building a huge Kernel that supports many devices. Please note that in order to start (boot) a compressed EXT2 FileSystem, you must have RAMDISK and built-in EXT2 support. They cannot be provided in a module. 4.6 Some last details - Some Final Details Some system programs, such as login, will issue a warning when the / var / run / utmp file is not present. So: MKDIR -P / MNT / VAR / {log, run {touch / mnt / var / run / utmp, after you set (SET UP) After all you need, LDConfig is executed in root FileSystem on Remake /etc/ld.so.cache. This cache will tell Loader where to find a library. To re-create ld.so.cache, issue the following instructions: chDIR / MNT; Chroot / MNT / SBIN / LDCONFIG Chroot is necessary because ldconfig will always re-create Cache for root filesystem. 4.7 Wrapping IT UP Once you have completed the construction of root filesystem, you will be a file into a file and compress it: umount / mnt dd if = device bs = 1k | gzip -v9> rootfs.gz end, you will There is a file called rootfs.gz, which is the Root FileSystem you are compressed. You should check its size to make sure it can be placed on a soft disc; if not, you must go back and remove some files. Reducing root filesystem size has some tips to tell you about reducing root filesystem size. -------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- ---------- 5. Select a kernel - Choosing a Kernel now, you have a complete compressed root filesystem. The next step is to build or select a kernel. In most cases, COPY you currently use the Kernel and start the flop from it. However, there will be some situations where you want to build a separate (Separate) kernel. One of the reasons is the consideration of size. If you are building a single boot / root magnetic sheet, kernel will be one of the largest files on the magnetic file, and you must reduce the Kernel's size as much as possible. In order to reduce Kernel Size, use the necessary devices that can support the system you want to create kernel. This refers to each item that you don't want.

The network function is a good choice that can be lost, and when you operate your boot / root filesystem, any of your unwanted disks and other equipment support. As mentioned above, your kernel must have Ramdisk and EXT2 support within it. If you have completed a set of minimum devices to make it in the kernel, then you need to start what you want to join. Perhaps the most common use of a Boot / root magnetic set, in order to check with a restore, a damaged root file system, and you need Kernel support in order to achieve this goal. For example, if your backup is placed on a tape, and use ftape to access your tape drive, then if you lose your current root drive with the DRIVE containing ftape, you will not be able to bring from your backup tape. Reply storage. You will have to reinstall Linux, download and reload FTAPE, and try to read your backup. The point of this is that no matter what I / O, you have supported your kernel to support backup, you should also join you to your boot / root kernel. The actual construction of Kernel is detailed in the file attached to the kernel. You can easily do indication, so you can / usr / src / linux starting. If you have difficulties on building Kernel, you may not try to build boot / root systems in an attempt to unscrupulous. Remember to compress Kernel with `` make zimage ''. -------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- ---------- 6. Put them together: Making a magnetic sheet (group) - Putting Them Together: Making The Diskette (s), you already have a kernel with a compressed root FileSystem. If you are making a boot / root magnetic sheet, check their size to determine that they can be placed on the same magnetic sheet. If you are making a Boot root magnetic sheet of two magners. Check the root filesystem to determine it on a magnetic piece. You should decide whether to use Lilo to launch bootdisk's kernel. The alternative method is to directly put the kernel copy to the magnet, then boot without LILO. The benefit of using LILO is that you can provide some parameters to kernel, which may be necessary for initialization hardware (please check the /etc/lilo.conf file on your system. If this file exists, there is a line of images `` append = ... '', you may need this feature). The disadvantage of using LILO is that the construction of bootdisk becomes more complicated and occupies a slight space. You will have to set a small and independent FileSystem, we call Kernel FileSystem, where you deliver KERNEL and some of the other files required for LILO. If you want to use Lilo, please continue to read; if you want to transfer Kernel directly, skip this, go directly to WITHOUT USING LILO.

6.1 Transfer KERNEL with LILO - Transferring The Kernel with Lilo The first thing you have to do is to write a small configuration file for Lilo. This file looks like this: ------------------------------------------- ------------------------------------ Boot = / dev / fd0 install = / boot / boot. B Map = / boot / map read-write backup = / dev / null compact image = kernel label = bootdisk root = / dev / fd0 --------------------- -------------------------------------------------- -------- Description of these parameters See LILO's User Documentation. You may also want to join the /etc/lilo.conf file on your hard drive, add a line of append = ... to this configuration file. Make this configuration file into bdlilo.conf. Now you have to make a small archive system, we call Kernel FileSystem, which is different from root filesystem. First, it is pointed out how much this FileSystem should be. Calculate the size of your kernel with blocks (this size), is displayed by 1024, and then plus 50. This 50 blocks is an estimated space that is required for Inodes and other files. If you want, you can accurately calculate this number, or use 50 well. If you are making two magnetic packages, you will overestimate this space, because in any case, only the first magnetic sheet is only used by Kernel. We call this number be kernel_blocks. Please put the soft disc in a soft disc (for easy, we assume / dev / fd0), then make EXT2 KERNEL FILESYSTEM. MKE2FS -I 8192 -M 0 / dev / fd0 kernel_blocks `` -i 8192 '' specifies that we want every 8192 bytes a Node. Next, Mount This FileSystem, remove the Lost Found directory, then create DEV and BOOT for LILO: Mount / DEV / FD0 / MNT RM-RF / MNT / LOST FOT MKDIR / MNT / {boot, DEV}, make equipment file / dev / null and / dev / fd0. Don't look for equipment numbers, you only need to use -r copy from your hard to: cp -r / dev / {null, fd0} / mnt / dev lilo needs a copy, boot.b, you Can get it from your hard disk. It is usually placed in the / boot directory.

CP /Boot/boot.b / mnt / boot Finally, with your kernel, Copy you are in the LILO configuration file written in the previous section. Both them can be placed under the root directory. Every item you need to CP bdlilo.conf kernel / MNT LILO is now on kernel filesystem, so you are ready to do it. LILO's -R flag (FLAG) is used as installation boot loader on some other root: lilo -v -c bdlilo.conf -r / mnt lilo should be able to execute without error, after you You can look at your kernel FileSystem, you should grow like this: ------------------------------------ -------------------------------------------- Total 361 1 -RW- R - r - 1 root root 176 Jan 10 07:22 bdlilo.conf 1 drwxr-xr-x 2 root root 1024 Jan 10 07:23 boot / 1 drwxr-xr-x 2 root root 1024 Jan 10 07:22 DEV / 358 -RW-R - R - 1 root root 362707 Jan 10 07:23 VMLinuz Boot: Total 8 4 -RW-R - R - 1 root root 3708 Jan 10 07:22 boot.b 4 - RW ------- 1 root root 3584 jan 10 07:23 map dev: total 0 0 BRW-R ----- 1 Root root 2, 0 Jan 10 07:22 FD0 0 CRW-R - R - 1 Root root 1, 3 Jan 10 07:22 Null ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------- If the file size and yourself FileSystem is slightly different, please don't worry. Now keep the magnetical in the Software disc server, then move into the section of Setting The Ramdisk Word. 6.2 Do not use LILO to transfer KERNEL - Transferring The Kernel WITHOUT LILO If you don't use Lilo, use DD instructions to transfer kernel to bootdisk:% DD if = kernel of = / dev / fd0 bs = 1k 353 1 Records in 353 1 Records OUT In this example, DD wrote 353 complete records (Records) 1 Partial Record, so KERNEL occupied 354 soft discs Blocks. This figure is called kernel_blocks, remember it, this number is to be used next section.

Finally, set the root device as the flop table you, then set the root to be loaded into the RDEV / DEV / FD0 / DEV / FD0 RDEV -R / DEV / FD0 0 in the second RDEV instruction In the middle, use -r. 6.3 Setting RamDisk - Setting The RamDisk Word In the Kernel Image, it is RamDisk Word, which specifies where the root filesystem should be found. This Word will be accessed and set by RDEV instructions, and its content is explained as follows: BITS 0-10: Offset to Start of Ramdisk, in 1024 BYTE BLOCKS BITS 11-13: Unused bit 14: flag indicating That Ramdisk is to prompt before loading rootfs If Bit 15 is set, when boot-up, you will be prompted to put a new flounce in a floppy drive. This is necessary for the boot magnetic sheet of a dual-magnetic sheet. Based on you build a single boot / root magnet, or two "boot root" magnetic wraps, which will have two cases. If you are a single magnetic tab, the compressed root filesystem will be placed after Kernel, so Offset will be the first free block (this value should be equal to KERNEL_BLOCKS). Bit 14 will be set to 1, and Bit 15 will be set to 0. For example, it is assumed that you are building a single magnetic sheet, and the root filesystem starts from the Block 253 (10). Then, the RamDisk Word value should be 253 (10 carry), and Bit 14 is set to 1 and Bit 15 is set to 0. To calculate this value, you can simply add this 10-in number. 253 (2 ^ 14) = 253 16384 = 16637. If you don't know how this figure comes from, put this number on the engineering computer, then convert it to 2 carry, if you build a two-capped group, then root filesystem will be self The block of the magnetic sheet begins, so OFFSet is 0. Bit 14 is set to 1 and Bit 15 is set to 1. In this case, the 10 inlet value is 2 ^ 14 2 ^ 15 = 49152. After carefully calculate the RamDisk Word, set it with RDEV -R. Please note that 10 carrier is used. If you use Lilo, the quotes pass to RDEV should be a moused kernel path, such as / mnt / vmlinuz; if you use DD to Copy Kernel, replace it with a Safe Dish name (such as / dev / fd0). RDEV -R kernel_or_floppy_drive value If you use lilo, please now install the magnetic unmount.

6.4 Transfer Root FileSystem - Transferring The root filesystem The last step is to transfer root filesystem. If root filesystem will be placed on the same magnetic sheet as Kernel, use DD instructions and its seek option to transfer it, this will specify how many blocks you want to skip: DD if = rootfs.gz of = / dev / fd0 BS = 1K seek = kernel_blocks If root filesystem is placed on the second magnetic piece, take the first soft disc in the disk machine and then put the second disk, then transfer the root filesystem to it: DD if = rootfs.gz of = / dev / fd0 bs = 1k Congratulations, already completed! Before using BootDisk for emergency use, please remember to test it first! If your finished product can't be executed, please continue to read. -------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- ---------- 7. Problem Solution - Troubleshooting, or the Agony Of Defeat When building bootdisks, the starting number of attempts is often unable to turn on. The general way to build a root disk is to combine components from your existing system, then try to get this magnetic-based system (Diskette-based system) until it displays messages on Console. Once it starts to talk to you, this battle is over half, because you can understand what it is complaining, and you can solve individual problems until the system can operate smoothly. If the system stops operation without any instructions, it is a difficult thing to find this reason. In order for the system to start to talk to you, this requires several components, and these components should be properly configured. The following is a recommended procedure for the investigation system that cannot talk to you: You will see a message like this: kernel PANIC: VFS: Unable to mount root fs on xx: yy This is a common problem, and it only has some reason. First, please check Device XX: YY in accordance with the Device Code list; Is it the correct root device? If not, then you may not have rdev -r, or you are the wrong image to perform RDEV -R. If Device Code is correct, please check it carefully to the Device driver that is compiled into your kernel. Please make sure it has built-in soft discs, EXT2 FileSystem support. If you see a lot of error messages like: End_Request: I / O Error, DEV 01:00 (RAMDISK), Sector nnn This is the I / O error message reported by Ramdisk Driver, which may be because kernel is trying to write beyond The end of the device. Your ramdisk cannot hold your root filesystem because it is too small.

转载请注明原文地址:https://www.9cbs.com/read-43801.html

New Post(0)