Hand-made a soft disk size of a floppy disk (1) www.palmheart.net is unknown
〖
Back to〗 Forward〗
Anyone who has been in contact with a computer must have used the DOS boot floppy disk. As for the importance of starting the floppy disk, everyone is definitely clear. The floppy disk in Linux is equally important, which can not only test the new kernel, restore system errors, but also upgrade important system files. But in linux, doing the boot disk is not as easy as DOS, let's take a step in step by step to make your own system startup floppy disk. 1. Introduction to the Linux startup process A starter is actually a complete system of surgery, which can perform most of a complete system. So if you want to make a Linux boot disk, you have to know the basic process of the Linux system startup. Next, I will briefly introduce the Linux startup process. All PCs are activated through the code in the 0 cylinder 0 sector in the ROM in the ROM. In the 0 cylinder 0 sector of the starter disk in the Linux system, the start loader L iLo, which positions the kernel, load it, and finally execute it. Once the kernel is loaded, it is first initialized, then attempts to load and log in to the root file system in the disk, if the kernel does not find the loadable root file system, the startup process will stop this. If the root file system is loaded and logged in, you will see a line of information: vfs: mounted root (ext2 filesystem) readonly. After the system discovers the init program and execute it, the init program is looking for its configuration file / etc / inittab, And start executing the script, these scripts are combined with some shell commands to perform the following command, such as loading the desired module, loading S WAP, initializing the network, load all drives listed in the FSTAB. Finally, start a program called getty, which is responsible for communication between console and ttys, which prints the L Ogin prompt on the display and activates the login program, login to the validity of the login and establish a dialogue with the user. At this point, the startup process is completed. 2. Making the boot disk Create a boot disk First, you must create a root file system. Due to the limited floppy disk capacity, a compressed root file system is often used. Below I will introduce how to create a compressed format root file system. 2.1 Preparing a root file system must include all the full things that support the full Linux system, so it should include the following items: • Basic file system structure • At least the following directory: / dev, / proc, / bin, / etc, / LIB, / USR, / TMP · Most basic applications, such as SH, LS, CP, MV, etc. · Minimum profile, such as RC, ITTAB, FSTAB, etc. · Equipment: / dev / hd *, / / dev / tty *, / Dev / fd0 · Basic program runs the library function required for the above required files far more than 1.44m, so we usually do the contents, then compress it to the floppy disk, when started with a floppy disk, The file is extracted into the memory, forming a virtual disk (R amdisk), starts via the Ramdisk control system. In order to create the above root file system, you must have an idle RamDisk that can put down about 4M files. If you use the LILO control to start, check the size of the RAMDisk defined in LILO's configuration file /etc/lilo.conf. In /etc/lilo.conf, there is a line ramdisk_size = nnn which determines the maximum memory available by ramdisk to Nnn. It is 4096K by default. It is enough for us, but by the way, if your system is only 8M memory, Don't use 4 m Ramdisk.
Check if there is a device called / dev / ram0 or / dev / ram in your system device, this is the device name of RAMDisk, if not, create a device / dev / ram0 with command mknod. 2.2 Creating a root file system Linux kernel identification two file systems that can be directly copied to RAMDISK, they are Minix and Ext2, and EXT2 performance is better. If you use EXT2, you will find that the use -i option definition is very useful than the available information nodes. MKE2FS By default, 3 60 information nodes are generated on a 1.44m floppy disk. Use the root file system using compressed formats require more information nodes, so create a file system to create a file system to create a 2000 information node, generally not used Light: mke2fs -m 0 -i 2000 / dev / ram0 mke2fs will automatically determine the size of the device capacity and the corresponding configuration itself, -m 0 parameters prevent it from reserving space to the root, which will make more useful space. Then hook the virtual disk on the node / mnt: mount -t ext2 / dev / ram0 / mnt If there is no node / mnt, build one. Then you create a directory. Root file system should have the following 8 directory: / dev - device / proc - PROC file system Required Directory / etc - System Profile / SBIN - Important System Program / BIN - Basic Applications / LIB - Sharing FRUL / MNT - Loading other disk nodes / usr - Additional applications where / proc, / mnt, and / usr are empty in this case, just use MKDIR to create them both. The rest of the directory should be created separately as needed, and I will explain the detailed description of one by one. · / Dev: / dev "The system is indispensable device file, although the directory is common, you can create MKDIR, however the device file in the directory must be created with MKNOD, of course, there is shortcut, you can put existing systems / dev The file is copied, then deletes unnecessary files. Command C P -DPR / DEV / MNT will copy / dev entire directory but not copy file content, the DP switch guarantees that the link file is still constant, and the original file is not copied, and the attribute is unchanged. It must be noted that each device file occupies a message node, and the number of nodes on the floppy is limited, so it is necessary to delete the unused device file. For example, if you don't have a SCSI device, delete all files starting with SD. If you don't want to use the serial port device, remove all files starting with CUA. But remember to keep console, kmem, mem, null, ram, tty1, etc. · / Etc: This directory contains some essential system profiles, then which files are required, which can be possible? Tell you a tip, use the command ls -ltru, this command will look back in the directory / etc file according to the final use date, if some files have not been entered, basically can be deleted from your boot disk go with. My boot disk contains less than 15 profiles, which can be roughly divided into three parts: (1) The files must be included in the boot disk · rc.d / * - system start script · fstab - list the files to log in System · inittab - contains startup process parameters and these files are the simplest.
RC should include: #! / bin / hostname yjy fstab should include: / dev / ram0 / ext2 defaults / dev / fd0 / ext2 defaults / proc / proc PROC DEFAULTS INTTAB includes: ID: 2: INITDEFAULT: SI :: Sysinit: / etc / rc 1: 2345: Respaw: / sbin / getty 9600 TTY1 2: 23: Respawn: / sbin / getty 9600 TTY2 (2) Squiration System Required File · Passwd - User Name Directory. · Group - User Group · Shadow - User Encryption Password If you think this is not safe, remove Passwd and Shadow, so that only root can enter the system. (3) Occasionally, the file can be selected according to its own actual situation. · / Bin and / sbin: This catalog contains an indispensable application, such as LS, MV, Cat, you can choose according to your own needs, but you must remember the following procedures: init, getty, login, mount , Run your RC shell shell. · / Lib: This directory contains the shared log library required during your boot disk, if a must have a must-have library, the system will stop starting or have a lot of error messages, so be careful. Almost all procedures require libc libraries, column directory / lib / lib / lib / lib / 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 * libc.so.6 represents the version number, the file it pointing is that you really need. Check out the library used by each program, use the command ldd, such as:% ldd / sbin / mke2fs libext2fs.so.2 => /lib/libext2fs.so.2 (0x40014000) libcom_rr.so.2 => / lib / libcom_err .sso.2 (0x40026000) libuiD.so.1 => /Lib/LibuiD.SO.1 (0x40028000) libc.so.6 => /Lib/Libc.so.6 (0x4002C000) / lib / ld-linux. SO.2 => /Lib/ld-linux.so.2 (0x400000) Output The library on the right is must, and some may be a link file. In / lib directory you must have a library loader, this loader or ld.so (a.out library) or LD-Linux.so (for the ELF library). The new version of LDD generally tells you the loader you need. After copying the loader and the library to / lib, check it out carefully and must guarantee that there is no omission. 2.3 Module If you have a modular kernel, you have to consider the modules that need to be loaded. They are all in / lib / modules, you can put it on another disk that is not very important, when the system is launched This will save the space of the boot disk. 2.4 Once you have completed the above work, remove the virtual disk, copy it to a file, and then compress it.