Gentoo Wiki


This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

First, sorry for my English. I created small LiveCD (165MB) with lots of security related packages. It contains Firefox, Mplayer, Xmms, Gimp ... etc. Here I'll give some tips for creating small LiveCDs. The big advantage of the small size is that it can be copied to memory. You can also put it in a small cd (210 MB) which can be put in your wallet.


LiveCD scripts

There is one script for creating a LiveCD provided by Gentoo, but there is a better alternative: Linux live scripts. Slax distro is based in these scripts. It was unique, because you can create a pseudo writeable filesystem (changes are stored in ram). Now it's used by Knoppix and various other distros, but Slax had this many years before.

So here are some tips for LiveCD-scripts

1) You must have squashfs (in Gentoo-sources) and unionfs (emerge unionfs) enabled in your kernel.

2) You will get a message that some devices in /dev are missing. In '' find

echo "creating compressed images..."
for dir in bin etc home lib opt root usr sbin var; do

and change it to

echo "creating compressed images..."
for dir in bin etc home lib opt root usr sbin var dev; do

3) You will have problems with check root so remove it from rc

rc-update del checkroot boot
rc-update del checkfs boot

4) Follow flying with gentoo manual, to speed up your gentoo start.

You can find it here: Flying with Gentoo

Building gentoo

Use chrooted dir somewhere on your system. You will need about 2 GB.

Forget about -O3 optimization. You should create a small CD which will run everywhere. Here is an example of my make.conf

CFLAGS="-Os -pipe"
USE=" -berkdb -nls -readline
       -python -perl  browserplugin
       minimal -type1-fonts truetype -truetype-fonts
       -motif ethereal
       alsa -arts -oss
       -gnome -kde xinerama  -tiff -eds
       -cups   -spell
       dvd dvdr cdr
       mmx dga theora matroska aalib  -quicktime
       -sdl -pam -gpm

Building kernel

You must have a universal kernel. I found the kernel configuration from genkernel very good, so use it. You only must enable SquashFs in /filesystems/fs misc/squasfs

You can also get a precompiled slax kernel which is a lot easier than trying to install unionfs.
1) Untar stage3 and the slax kernel in the same dir.
2) Add -symlink vanilla to your use variable.
3) You might have to download the 2.6.16 source and mount it --bind /usr/src/linux (or symlink it outside your filesystem, whatever).

You can boot w/ root=whatever, kernel=/boot/vmlinuz. Make sure to move /etc/fstab somewhere when you build the liveCD.

I'm not sure exactly what comes with the kernel but alsa works and nvidia is installed, thought I dont think glx is. Maybe somebody else could figure some of this out. At least add this to your package.provided


Building gentoo

Don't optimize for Athlon/Pentium 4... Keep it on i686 without generic x86, it's better.


Use flags '-minimal -type1-fonts truetype -truetype-fonts' works fine. Xserver is built without fonts and many command line utils, but with all drivers. Compressed on LiveCD it will take ~ 25 MB, which is very good. If you will not use GTK 1.x you can also disable the bitmap font '-bitmap-fonts'. If you will disable all fonts, don't forget to 'emerge core-fonts' which are much better than the default fonts from X.

Later I'll show how to take X autodetection from knoppix.

Very small (~2 MB) Xserver is kdrive, used in Damm Small Linux and similar ultra light distros. It's also in portage, but I strongly recommend using normal X server.

And of course you can build your Live-CD without X server :)

Desktop enviroment

Forget KDE or Gnome, it will take up half of your mini Live-CD. Use icewm, fluxbox etc... If you really need something clickable use XFCE.

Don't mix graphic toolkit, use only GTK based apps. QT and kde-libs will take about 30 MB on the CD :(


Mplayer is fine, but do you really need 50 MB of codecs? You can also consider building it without GTK 1.2 which takes ~ 2MB. You also don't need an X server to play videos, use SVGA as the output device.

Xmms is my choice, also great is BMP. There are also great terminal players (moc...)

CD burning is a problem. The best is K3B, but it needs QT, so I prefer xcdroast, which is well tested and can detect most cd-roms. There are also some console frontends to cdrecord.

Best sound mixer is alsamixer


Use coldplug, works fine.

Xserver autoconfiguration from Knoppix

Use the mkxf86config tool to make the xorg.conf file

Follow the directions from here: mkxf86config and add "hwsetup -p" to /etc/init.d/mkxf86config to before the script is run.

Retrieved from ""

Last modified: Thu, 04 Sep 2008 04:18:00 +0000 Hits: 14,026