Библиотека сайта rus-linux.net
Take another look at the Bootdisk-HOWTO and notice how many utilities can be squeezed onto a 1.44M floppy. There are three things that make this possible. One is the use of shared libraries. The second is stripped binaries. And the third is the use of a compressed filesystem. We can use all of these techniques to save space on our root disk.
First, in order to use shared libraries we will need to rebuild
the BASH shell. This time we will configure it without using the
--enable-static-link option. Once BASH is rebuilt we
need to figure out which libraries it is linked with and be sure to
include them on the root disk. The ldd command makes
this job easy. By typing ldd bash on the command-line
we can see a list of all the shared libraries that BASH uses. As long as
all these libraries are copied to the root disk, the new BASH build
should work fine.
Next, we should strip any binaries that get copied to the root disk. The manpage for strip does not give much description of what it does other than to say, "strip discards all symbols from the object files." It seems like removing pieces of a binary would render it useless, but this is not the case. The reason it works is because a large number of these discarded symbols are used for debugging. While debugging symbols are very helpful to programmers working to improve the code, they do not do much for the average end-user other than take up more disk space. And since space is at a premium, we should definitely remove as many symbols as possible from BASH and any other binaries before we copy over them to the ramdisk.
The process of stripping files to save space also works with
shared library files. But when stripping libraries it is important to
--strip-unneeded option so as not to break
--strip-unneeded shrinks the file size, but
leaves the symbols needed for relocation intact which is something that
shared libraries need to function properly.
Finally, we can tackle the problem of how to build a compressed root filesystem. The Bootdisk-HOWTO suggests three ways of constructing a compressed root filesystem using either a ramdisk, a spare hard drive partition or a loopback device. This project will concentrate on using the ramdisk approach. It seems logical that if the root filesystem is going to be run from a ramdisk, it may as well be built on a ramdisk. All we have to do is create a second extended filesystem on a ramdisk device, mount it and copy files to it. Once the filesystem is populated with all the files that the root disk needs, we simply unmount it, compress it and write it out to floppy.
For this to work, we need to make sure the system used for building has ramdisk support. If ramdisk is not available it is also possible to use a loopback device. See the Bootdisk-HOWTO for more information on using loopback devices.
Только зарегистрированные пользователи могут оценивать и комментировать статьи.