#!/bin/sh
#
# at least it looked like fat to me, but what do I know?
#
# I've been picking through the v0.15 release with a fine-toothed comb
# looking for cruft that we can delete to save some space. This email
# captures the results of my searching so far. I've formatted this
# posting as a shell script that you can execute in the v0.15
# directory after untarring usr-src-2-40.tar.gz and
# root-src-2-40.tar.gz. As is, the script will allow the following
# savings, (you can uncomment a couple of sections to make it smaller
# with less functionality):
#
# root-2-40.cramfs usr-2-40.cramfs Total
# Before 2686976 7098368 9785344
# After 2584576 5435392 8019968
# ------- ------- -------
# Savings 102400 1662976 1765376
#
# So I've trimmed >1.5MB off of the installation images, and I don't
# think that I have affected any significant functionality, (but
# that's still open to interpretation -- at least I have successfully
# booted and played around a bit). Beware though, that this script
# deletes all libraries which are not directly needed by binaries in
# the release, (gtk for example) -- you may want to install other
# programs that depend on these libraries. And is it really safe for
# me to be deleting those libc6 shared libraries? (See comment
# regarding libnss* below). Also, I could have missed a lot of things
# that could still be deleted -- feel free to have a closer look.
#
# There are still two big things that could be done, (I mentioned
# these in an earlier message):
#
# 1) Replace all possible utilities with busybox.
# This saves about 500kB uncompressed.
#
# 2) Remove all "user-level" binaries from images.
# Without gdb, xanim, mpg123, and gqmpeg.static, usr-2-40
# shrinks down to 3317760 bytes! (3121152 without all of
# /usr/share/locale/*) Plus there are many small programs
# that could be considered user-level/optional and moved
# out of the release. This would allow for a much larger,
# writable /usr/local partition. The default install could
# be tiny and it would be up to each user how to eat up the
# rest of flash.
#
# Then again, a lot of this gets rather subjective, so configurable
# partition sizes and/or a package maintenance system would be good
# long-term solutions for all of this. (If only every Debian
# maintainer were required to provide an "install-tiny" script...)
#
# Anyway, I'm posting this for comments. The things that I am least
# sure of I have placed at the top of the file. Also, I was too burned
# out by the time I got to /usr/sbin so I haven't looked at it yet,
# (although I did notice /usr/sbin/dump and /usr/bin/dump both exist
# although they do differ).
#
# -Carl
# Let the fat-trimming script begin!
# The script is organized into major sections where files are being
# removed for different reasons. Each section begins with a comment
# explaining my justification for removing the files. Feel free to
# comment. (I'm risking exposing my ignorance here...)
#!/bin/sh
# What are these? Do we need them?
#
# (Please pardon my ignorance, but the names of these binaries don't
# mean anything to me and I did not see equivalent programs installed on my
# Debian system. I haven't poked around beyond that.)
#---------------------------------------------------------------------------
# /sbin/iwconfig
# /sbin/iwpriv
# /sbin/iwspy
# /sbin/kdstat
# /sbin/pcinitrd
# /sbin/update
#
# /usr/bin/callbootd
# /usr/bin/fromport
# /usr/bin/gpio # Note, has no execute permission by default
# /usr/bin/toport
# /usr/bin/X11/led
#
# /usr/libexec/pt_chown
#
# /usr/sbin/dongle_attach
# /usr/sbin/findchip
# I'm unqualified to comment on these.
# Could this be trimmed down at all?
#-------------------------------------
# du -s /usr/lib/terminfo
# 460
# du -s /dev
# 32 # Yes, this would be getting pretty picky about the space
# Redundant functionality (replace with symlinks/tiny scripts?)
#--------------------------------------------------------------
# /usr/bin/logname # /usr/bin/whoami
# /usr/bin/whoami # /usr/bin/id -un
# /usr/bin/printenv # /usr/bin/env -- or switched, env is ~400B bigger ;)
# Some large user-level binaries
#-------------------------------
# (These aren't good for much if your mixer isn't working)
#rm usr/bin/mpg123
#rm usr/bin/X11/gqmpeg.static # Ouch, where's a shared version?
#
# and if you're not playing animations... (good for demos though)
#rm usr/bin/X11/xanim
#
# or if you always write perfect code... ;)
#rm usr/bin/gdb
# Support for various languages.
#-------------------------------
# (I've got these all commented out so you don't lose your favorite
# language, but you could selectively uncomment some of these if you
# don't need them and want to save some space -- about 200KB
# compressed!)
#rm -r usr/share/locale/cs
#rm -r usr/share/locale/de
#rm -r usr/share/locale/fr
#rm -r usr/share/locale/it
#rm -r usr/share/locale/ja
#rm -r usr/share/locale/nl
#rm -r usr/share/locale/pt_BR
# A couple of slip-ups in v0.15
#-----------------------------
rmdir usr/sbin/sbin
mv root/ash root/bin
# Duplicated files, should be symlinks
#-------------------------------------
rm root/lib/ld-2.1.so
(cd root/lib; ln -s ld-2.1.2.so ld-2.1.so)
rm root/lib/libcrypt.so.1
(cd root/lib; ln -s libcrypt-2.1.so libcrypt.so.1)
rm root/lib/libz.so
(cd root/lib; ln -s libz.so.1.1.2 libz.so)
rm root/bin/fgrep
(cd root/bin; ln -s grep fgrep)
rm root/bin/egrep
(cd root/bin; ln -s grep egrep)
rm root/bin/gunzip
(cd root/bin; ln -s gzip gunzip)
rm root/bin/uncompress
(cd root/bin; ln -s gzip uncompress)
rm root/bin/zcat
(cd root/bin; ln -s gzip zcat)
# Unsupported Functionality/Not working
#--------------------------------------
# Missing libpam dependency, (but will anyone miss these?)
rm usr/bin/chfn
rm usr/bin/chsh
rm usr/bin/newgrp
rm usr/bin/sg
# We don't have perl!
rm usr/bin/chkdupexe
rm usr/sbin/update-rc.d
rm usr/sbin/update-alternatives
rm usr/sbin/cleanup-info
rm usr/sbin/update-inetd
rm usr/sbin/checkrhosts
# No logging is supported right now...
rm usr/bin/faillog
rm usr/bin/last
rm usr/bin/lastb
rm usr/bin/lastlog
rm usr/bin/logger
rm usr/bin/savelog
# Missing libslang.so dependency (this is actually because a link is missing)
# rm root/sbin/cfdisk
(cd usr/lib; ln -s libslang.so.1.2.2 libslang.so.1; ln -s libslang.so.1.2.2 libslang.so)
# No architecture support?
rm root/sbin/clock
rm root/sbin/hwclock
rm usr/bin/kbdrate
rm root/sbin/kbdrate
# Perl? Lilo? what're those?
rm root/sbin/installkernel
rm usr/sbin/mkboot
# Unneeded functionality (a.k.a. I may not be as creative as you are)
#---------------------------------------------------------------------
# Does anyone use the minix fs?
rm root/sbin/fsck.minix
rm root/sbin/mkfs.minix
# Can you think of a way to use these?
rm root/sbin/ipchains
rm root/sbin/ipchains-save
rm root/sbin/ipchains-restore
rm root/sbin/ipfwadm # Hasn't this been superseded by ipchains?
# Could we ever need a PCI prober?
rm root/sbin/probe
# How about a floppy on an iPAQ?
rm usr/bin/fdformat
rm usr/bin/setfdprm
# This is a nice Debian feature, but until we have a real Debian
# system on here it doesn't make sense to have these,
# (ie. /etc/modutils/arch/m68.amiga???) (And yes, I know that
# update-modules is only a script and we're only talking about ~5kB
# here)
rm -r init/etc/modutils
rm root/sbin/update-modules
# Unneeded libraries
#-------------------
# I came up with this list by doing:
#
# ldd /bin/* /usr/bin/* /sbin/* /usr/libexec/* /usr/bin/X11/* /usr/sbin/* | grep '=>' | cut -d '=' -f 2 | cut -d ' ' -f 2 | sort | uniq
#
# and then finding all the libraries in /lib, /usr/lib, and
# /usr/lib/X11 that were not listed in the output of the pipeline.
# So all of these are shared libraries on which no binaries in the
# current release depend.
#
# Of course, I'd be open to any argument claiming that we should
# definitely keep these in the release for one reason or another.
#
# My list generated with the ldd command above is imperfect. For
# example it does not reveal a dependence on /lib/libnss* but if I
# remove those files then I cannot login to my iPAQ, I just get:
#
# (none) login: root
# Password:
# login[105]: invalid password for `UNKNOWN' on `ttyS0'
#
# What causes this dependency? Is it possible that some of these other
# libraries are similarly necessary? It feels really weird to delete
# libraries that come from libc6... Comments?
# From libc6:
rm root/lib/libBrokenLocale*
rm root/lib/libSegFault*
rm root/lib/librt*
# From e2fsprogs:
rm root/lib/libss*
rm usr/lib/X11/libXp.so*
rm usr/lib/X11/libpsres*
rm -r usr/lib/ipmasqadm
# Actually, this batch of libraries looks _very_ useful. It's just
# that nothing is using it in the release. And we might make an
# argument for minimal releases that do not include these
# libraries. (ie. is the GUI toolkit going to be gtk? fltk? qt? Why
# not push these out of the release and let the user decide?)
rm usr/lib/libaudiofile*
rm usr/lib/libgdk-*
rm usr/lib/libgdk_imlib*
rm usr/lib/libgmodule*
rm usr/lib/libgtk*
rm usr/lib/libjpeg*
rm usr/lib/libpng*
# User-level binaries that I would never miss
# (Does anyone want to argue for keeping any of these?)
#------------------------------------------------------
rm usr/games/banner
rm usr/bin/#start-audio#
rm usr/bin/bashbug
rm usr/bin/cytune
rm usr/bin/ddate
rm usr/bin/factor
rm usr/bin/getent
rm usr/bin/glibcbug
rm usr/bin/irpsion5
rm usr/bin/sensible-editor
rm usr/bin/sensible-pager
rm usr/bin/sessreg
rm usr/bin/X11/ico
# These are perhaps a bit more useful, but I could still get by
# without them
rm usr/bin/expand
rm usr/bin/expiry
rm usr/bin/fmt
rm usr/bin/fold
rm usr/bin/namei
rm usr/bin/od
rm usr/bin/pathchk
rm usr/bin/rev
rm usr/bin/script
rm usr/bin/tac
rm usr/bin/tftp
rm usr/bin/tload
rm usr/bin/unexpand
# Most of the current "documentation" is very incomplete or almost
# totally inaccessible. I'm in favor of wiping it out.
#-----------------------------------------------------------------
rm -r usr/man/* # The man binary is not even included
rm -r usr/info/* # Ditto for info
rm -r usr/doc/* # This is haphazard and incomplete now;
# if it were complete it would be too large.
rm -r usr/lib/getopt
Received on Tue Sep 19 09:10:14 2000
This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:43:42 EDT