[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiling for non-factory




Cloudmaster said:
> Well, that's kinda how I got the "stripped" size in my original message...

Crap.  Sorry, I wasn't paying enough attention.

FWIW, I was able to build a single-disk (or maybe it was two disks...
I don't remember now) recovery system using glibc a couple of years
ago.  It was rough, but the procedure went something like this:

    * Start with a directory to dump everything in.
    * Create a basic filesystem in that directory (/bin, /dev, /tmp,
      /etc, /proc, /lib, and anything else necessary).
    * Create necessary files like /etc/passwd, /etc/group,
      /etc/ld.so.conf, etc. in the image.
    * Populate /dev with only what you are sure you will use.
    * Copy /lib/libc-*.so, /lib/ld*,  and any of the other necessary
      libraries (make sure the list is short though) to /lib in your
      image.
    * Copy /sbin/ldconfig to the image.
    * Use chroot(1) to run ldconfig in the image to create
      /etc/ld.so.cache in the image.
    * Build bash with the --enable-minimal-config configure option (I
      like bash better than stuff like ash) and copy it to the image.
    * Copy stuff like /sbin/mk*fs, /sbin/*fsck, /sbin/fdisk, most of
      util-linux, and anything else you can think of that you have to
      have to the image.
    * Strip everything that looks like an executable or library.
    * Use du(1) to verify that you aren't using too much space.
    * Use chroot(1) to make sure that /bin/bash in your image actually
      runs.
    * Make a disk image (i.e. with "dd if=/dev/zero of=file bs=4k
      count=1k").
    * Make a Minix filesystem on the disk (with "mkfs -t minix file").
      The Minix filesystem limits you to 14-character filenames, but
      it has less overhead (so it uses less space)...
    * Mount the file loopback ("mount -t minix -o loop file
      /mnt/image").
    * Use tar or something similar to copy the files from your
      directory to the image.
    * umount(8) the image, compress it, and test.

BTW, the glibc from Red Hat's compat-glibc looks about the size I
remember when stripped...

    -rwxr-xr-x    1 stevep   stevep     650176 Apr 28 15:05 libc-2.0.7.so*

Everything I can think of that would bloat it up, like NIS support, is
already in external libraries, IIRC.

Steve
-- 
steve@silug.org           | Linux Users of Central Illinois
(618)398-7320             | Meetings the 4th Tuesday of every month
Steven Pritchard          | http://www.luci.org/ for more info

--
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.