Marvelous howto!
Did you post it already on the WIKI? Or on the forums?
I'm sure a lot of people would be interested.
Tom
Heinz Sporn wrote:
Hi!
That's a toughy! But I think it's doable.
Here are my SUGGESTIONS:
1. Develop the entire system on another machine (that's pretty much
obvious) in a chroot environment. Use symlinks (or mount -o bind) to
adress your Portage tree (you don't want to copy THAT back and forth!).
Follow the Gentoo docu as usual. Build a kernel 2.6.9 or above with
development-sources. Enable CONFIG_CRAMFS in your kernel. Emerge Samba.
Emerge sysklogd if you want to have logging enabled. Emerge cramfs. If
possible - don't emerge anything else.
2. Clone this development folder to another folder. Here you will shrink it.
3. Shrinking: chroot into the environment you created in step 2 and emerge --unmerge the following packages:
nasm, perl, ed, fbset, groff, help2man, man, man-pages, miscfiles, setserial, slocate, texinfo, autoconf, automake, bc, bin86, binutils, bison, flex, gcc, gcc-config, gettext, gnuconfig, libperl, libtool, m4, make, patch, development-sources, linux-headers
Be aware: after shrinking you won't be able to emerge anything on your target system
Now there's stuff left that can't be unmerge. Delete the following directories and files:
rm -R /usr/include/* > /dev/null 2>&1 rm /usr/lib/locale/locale-archive > /dev/null 2>&1 rm -R /usr/lib/perl5/* > /dev/null 2>&1 rm -R /usr/lib/portage/* > /dev/null 2>&1 rm -R /usr/lib/python2.3/* > /dev/null 2>&1 rm -R /usr/share/doc/* > /dev/null 2>&1 rm -R /usr/share/emacs/* > /dev/null 2>&1
# select the charmaps you need on your target # system - German stuff in my case mv /usr/share/i18n/charmaps/EBCDIC-AT-DE*.gz /tmp > /dev/null 2>&1 mv /usr/share/i18n/charmaps/EBCDIC-US.gz /tmp > /dev/null 2>&1 mv /usr/share/i18n/charmaps/IBM437.gz /tmp > /dev/null 2>&1 mv /usr/share/i18n/charmaps/ISO-8859-1*.gz /tmp > /dev/null 2>&1 mv /usr/share/i18n/charmaps/ISO_8859-*.gz /tmp > /dev/null 2>&1 rm -R /usr/share/i18n/charmaps/* > /dev/null 2>&1 mv /tmp/EBCDIC-AT-DE*.gz /usr/share/i18n/charmaps > /dev/null 2>&1 mv /tmp/EBCDIC-US.gz /usr/share/i18n/charmaps > /dev/null 2>&1 mv /tmp/IBM437.gz /usr/share/i18n/charmaps > /dev/null 2>&1 mv /tmp/ISO-8859-1*.gz /usr/share/i18n/charmaps > /dev/null 2>&1 mv /tmp/ISO_8859-*.gz /usr/share/i18n/charmaps > /dev/null 2>&1
mv /usr/share/i18n/locales/POSIX /tmp > /dev/null 2>&1 mv /usr/share/i18n/locales/i18n /tmp > /dev/null 2>&1 mv /usr/share/i18n/locales/de_* /tmp > /dev/null 2>&1 mv /usr/share/i18n/locales/en_* /tmp > /dev/null 2>&1 mv /usr/share/i18n/locales/translit_* /tmp > /dev/null 2>&1 rm -R /usr/share/i18n/locales/* > /dev/null 2>&1 mv /tmp/POSIX /usr/share/i18n/locales > /dev/null 2>&1 mv /tmp/i18n /usr/share/i18n/locales > /dev/null 2>&1 mv /tmp/de_* /usr/share/i18n/locales > /dev/null 2>&1 mv /tmp/en_* /usr/share/i18n/locales > /dev/null 2>&1 mv /tmp/translit_* /usr/share/i18n/locales > /dev/null 2>&1
rm -R /usr/share/info/* > /dev/null 2>&1
rm -R /usr/share/keymaps/amiga/* > /dev/null 2>&1 rm -R /usr/share/keymaps/atari/* > /dev/null 2>&1 rm -R /usr/share/keymaps/mac/* > /dev/null 2>&1 rm -R /usr/share/keymaps/sun/* > /dev/null 2>&1 rm -R /usr/share/keymaps/i386/azerty/* > /dev/null 2>&1 rm -R /usr/share/keymaps/i386/dvorak/* > /dev/null 2>&1 rm -R /usr/share/keymaps/i386/fgGIod/* > /dev/null 2>&1
mv /usr/share/locale/locale.alias /tmp > /dev/null 2>&1 mv /usr/share/locale/de /tmp > /dev/null 2>&1 rm -R /usr/share/locale/* > /dev/null 2>&1 mv /tmp/locale.alias /usr/share/locale > /dev/null 2>&1 mv /tmp/de /usr/share/locale > /dev/null 2>&1
rm -R /usr/share/man/* > /dev/null 2>&1
rm -f /etc/localtime > /dev/null 2>&1 mv /usr/share/zoneinfo/Europe/Vienna /etc/localtime > /dev/null 2>&1 rm -R /usr/share/zoneinfo/* > /dev/null 2>&1
rm -R /usr/src/* > /dev/null 2>&1 rm -R /usr/portage/* > /dev/null 2>&1 rm -R /var/tmp/portage/* > /dev/null 2>&1 rm -R /var/cache/edb/* > /dev/null 2>&1 rm -R /var/db/pkg/* > /dev/null 2>&1 rm /var/log/emerge.log > /dev/null 2>&1 rm /var/log/kern.log > /dev/null 2>&1 touch /var/log/kern.log > /dev/null 2>&1 rm /var/log/lastlog.log > /dev/null 2>&1 touch /var/log/lastlog.log > /dev/null 2>&1 rm /var/log/syslog > /dev/null 2>&1 touch /var/log/syslog > /dev/null 2>&1 rm -R /lib/dev-state > /dev/null 2>&1
Ok. Let's see what du -sh / comes up with - should be between 60 and 80 MB.
4. Things to consider a.) Recently sysklogd introduced some Perl scripts for clean-ups. Check /etc/cron.daily/syslog.cron and replace syslogd-listfiles with a bash script. The rest of the system should be Perl-free.
b.) With 32MB RAM Samba WILL respond .. aah .. not that fast - but I'm sure you already did know that
c.) On your target machine you'll have to use a filesystem with REAL small overhead like Ext2 or Minix.
d.) To fit the set you created in step 3 on a 40MB partition you will have to use CRAMFS. In a nutshell: RTFM cramfs, create a cramfs enabled loop device and copy the shrinked environment over. To finally load you're system you might have to create your own initrd package that mounts/prepares the CRAMFS device.
OK. I've done all of the above. It is working.
Hope I could help.
Am Dienstag, den 01.02.2005, 15:03 +0800 schrieb Qiangning Hong:
I want to make a i486 machine to run SAMBA server, with the following requirements:
- The whole system should run under 32MB memory.
- The boot partition is less than 5MB, the system partition is less than 32MB, and the rest of hard disk for shared data. (Actually the hard disk is an expensive flash drive, that's why we want as little as possible of disk space used by system itself)
I know it can be done using some binary distro such as RedHat or Debian, but I am only some familiar with Gentoo and just love it. Is it possible to boot the i486 machine with Gentoo LiveCD and only copy the needed software (in binary format of course) to it from the developper's gentoo box? That is, no gcc, no portage, no anything that is only required for compilation?
-- gentoo-user@gentoo.org mailing list
-- gentoo-user@gentoo.org mailing list