Reducing glibc

Jeff Sheinberg (jeffsh at erols dot com) recently sent me an email message explaining how to reduce considerably the size of glibc.so with Yard. Below is a slightly edited version of his message. I have not tried this myself, but the instructions look reasonable, and several people have asked me about this so I'll pass this along.
-Tom

I just queried Adam Di Carlo (adam at onshore dot com), the Debian boot floppies team coordinator, and he then kindly pointed me directly to Marcus's script.

For glibc-2.1.3, I got a reduction in size from 887712 bytes to 496396 bytes, about 55%.

Here is what you need to perform the library reduction, since I use Debian 2.2, everything that follows assumes a Debian 2.2 system.

  1. The following pic (position independent code) libraries should be installed:
          apt-get install glibc-pic
          apt-get install slang1-pic #(optional, for slang1 using commands)
        
  2. Marcus' library reduction script, from the Debian boot floppies source package,
        apt-get -d source boot-floppies
        cd ~/some-dir
        dpkg-source -x /var/cache/apt/archives/boot-floppies_2.2.16.dsc
        cd ~/yard/run-dir
        cp ~/some-dir/boot-floppies-2.2.16/scripts/rootdisk/mklibs.sh .
        
  3. In the ~/yard/run-dir, assuming the ramdisk root fs is mounted on /mnt/yard, run these commands as usual:
        make_root_fs
        check_root_fs
        
    Then run:
        find /mnt/yard \( \
                         -path /mnt/yard/bin/\* \
                      -o -path /mnt/yard/sbin/\* \
                      -o -path /mnt/yard/usr/bin/\* \
                      -o -path /mnt/yard/usr/sbin/\* \
                   \) -type f -print | \
        xargs ~/yard/run-dir/mklibs.sh --verbose \
        --dest-dir /mnt/yard/lib \
        /mnt/yard/lib/libnss_files.so.2 /mnt/yard/lib/libnss_compat.so.2
        
    The above find command just gets the list of executable files and then passes them, via xargs, to `mklibs.sh' script. The `mklibs.sh' script will then just overwrite the full size glibc previously copied to /mnt/yard/lib/... with the reduced glibc that it creates.
I have, of course, booted and tested the rescue disks that I then made with `write_rescue_disk' and they seem to work quite well.
Back to the Yard page
Modified: 09-Sep-2000