Building a Linux Media Network, one step at a time

Wednesday, February 22, 2006

Building up from Minimal Debian

I'm a sucker for punishment, so I've decided to put all my progress on hold for a while and try to rebuild the system from (almost) scratch. The OS was getting a little bloated, and I'd like to keep a tighter rein on what's getting installed. This post is a compilation of several earlier posts, with some extra details added here and there.

Note that you can skip steps 1 and 2 by burning the Debian businesscard ISO to a CD and configuring your BIOS to boot from CD.

Note also that I've kept my previous installation on a different partition. If this doesn't work out, I can switch back with a simple change to the GRUB boot menu.

Finally... building xorg (the X Windows Server) from scratch is really a post unto itself... the documentation for version 6.9.0 is available here. If you still have questions I'll do my best to help.


  • Format a fresh partition with the ext3 file system.

  • Follow the instructions here to load the debian installer. Briefly,
    mkdir /boot/debian-installer
    cp businesscard.iso /boot
    cd debian-installer
    wget http://ftp.debian.org/debian/dists/stable/main/installer-i386/current/images/hd-media/initrd.gz
    wget http://ftp.debian.org/debian/dists/stable/main/installer-i386/current/images/hd-media/vmlinuz
    edit /boot/menu/grub.lst, add new entry. Recall that the partition numbering is 0-based.
    root(0,0)
    kernel /boot/debian-installer/vmlinuz ramdisk_size=12000 root=/dev/ram0
    initrd /boot/debian-installer/initrd.gz

  • Activate the installer by rebooting.

    • accept the defaults up to the screen where you are asked about disk partitioning. Choose to manually edit the partition table. Choose the partition you were just in as the install target. Do not format the partition if you are booting from the hard disk. Specify "/" as the mount point.

    • Reboot. The installation proceeds. When you are asked about the system's "profile", ie. webserver, desktop, etc. select the packages manually. This launches the aptitude package manager frontend.

    • Select "kernel-source-2.6.8" "libncurses5-dev" "module-init-tools" "flex" "bison" "g++" "libpam-dev". You can use the "/" key to open a search box and the "n" key to advance through the search hits. Use the "+" key to select packages for installation. Installing these packages will install a number of ancillary developer tools.

    • Quit the installer

  • Log in as root. (All further steps should be performed as root)

  • Build a more appropriate kernel as described here
    cd /usr/src
    tar xvfj kernel-source-2.6.8.tar.bz2 && rm kernel-source-2.6.8.tar.bz2
    cd kernel-source-2.6.8
    make menuconfig

  • In the kernel config GUI, select "Processor Type and Features" > "Processor Family" > "VIA C3-2 (Nehemiah)"

  • Optionally disable drivers to get faster compile time: ISDN, Telephony, all graphics drivers except VGA and VESA

  • Enabled ALSA (and all its sub-items, and the VIA drivers), Parallel Port Support, PC-Style Hardware

  • Exit, save, run make all install modules_install Wait a long, long time.

  • Run mkinitrd -o /boot/initrd-2.6.8 2.6.8

  • Add new entry to /boot/grub/menu.lst:
    title Debian 2.6.8
    root (hd0,2)
    kernel /boot/vmlinuz-2.6.8 root=/dev/hda3 ro
    initrd /boot/initrd-2.6.8
    savedefault
    boot

  • Get and Build the xorg source (for the X server)
    cd /usr/local/src
    wget http://xorg.freedesktop.org/releases/X11R6.9.0/src-single/X11R6.9.0.tar.bz2
    tar xvfj X11R6.9.0.tar.bz2 && rm X11R6.9.0.tar.bz2
    cd xc/config/cf
    cp xorgsite.def host.def
    # Note: the xorg distribution comes with its dependencies,
    # but it does a shitty job building them. Also, none of the
    # executable perms have been set.
    cd ../../extras/expat
    chmod a+x configure
    ./configure --prefix=/usr && make && make install
    cd ../freetype2
    chmod a+x configure builds/unix/configure builds/unix/install-sh builds/unix-mkinstalldirs
    ./configure --prefix=/usr && make && make install
    cd ../..
    make World | tee World.log 2>&1
    make install install.man
    # Not sure if there's a more correct way to do this
    cd /usr/bin
    ln -s /usr/X11R6/bin X11

  • Download and build the Openchrome Drivers as described here. If you haven't got a SVN/CVS client, you can download one of the snapshot tarballs from openchrome.org. Here I have downloaded the source to /usr/local/src.

    cd /usr/local/src
    # Follow directions in README
    cd drm/linux-core
    make LINUXDIR=/usr/src/kernel-source-2.6.8 DRM_MODULES=via
    cp *.ko /lib/modules/2.6.8/kernel/drivers/char/drm/
    depmod -ae
    export PATH=$PATH:/usr/X11R6/bin
    xmkmf /usr/local/src/xc
    make && make install
    cd ../unichrome
    xmkmf /usr/local/src/xc

  • The DRM and Mesa stuff that's packaged with X.org is a piece of shit. To install the DRI drivers I had to download the binaries from here (just get the latest VIA drivers). Extract the tarball and copy unichrome_dri.so to /usr/X11R6/lib/modules/dri. You can follow the directions here to verify that hardware acceleration is being used. On GLXGears, the SP800 should be capable of about 30-60fps un-accelerated and approximately 500fps when hardware acceleration is active.

  • Download, Build and Install a Window Manager


    • Obtain the fluxbox development release source from http://fluxbox.sourceforge.net. Don't go with the "stable" 0.1.14 release; it doesn't even compile. ("stable"?!?)

    • Extract to /usr/local/src; Enter fluxbox directory

    • ./configure --prefix=/usr && make && make install

    • Edit the file /etc/X11/xinit/xinitrc. Remove the lines after "start some nice programs" and replace with:
      fluxbox & wmpid=$!
      wait $wmpid

    • Start the xserver with startx


0 Comments:

Post a Comment

<< Home