Knoppix CD Cover banner Debian GNU/Linux

mkxf86config for Debian

Knoppix-style video configuration for Debian


Whenever I setup Debian with xwindows, I find that I need to know quite a bit about the hardware (Video card chips, monitor refresh rates, ...) to get at least a half decent graphical display. By contrast, if I run Knoppix, a Debian derivate, the video card and monitor are detected and xwindows is configured automatically, with a result far superior to the native Debian install. Wouldn't it be nice to get the "Knoppix" results in a regular debian installation ?

The obvious workaround, i.e. to run knoppix on the machines in question and copy the resulting x86config file is ... not elegant enough to my liking, but it can serve as a last resort. It actually works, too.

Apparently, knoppix uses a mkxf86config tool that creates the /etx/X11/XF86Config-4 configuration file for XFree86 xwindows server. So if we could get that and run it on Debian ...


This is a re-write of mkxf86config, which was based on building packages from sources, as the knoppix binary packages ware nowhere to be found. But, oh happy day, http://debian-knoppix.alioth.debian.org/ now also has binaries so we can skip the "download source && build it" stuff by straight-forward apt-get install statements.


mkxf86config

mkxf86config is a script (/usr/sbin/mkxf86config on a running Knoppix system). What it does is run a couple of hardware detection and probing tools, and write the result to /etx/X11/XF86Config-4 in a way xserver can read. The tools in question are hwsetup and ddcxinfo-knoppix - all based on Redhat and Debian tools but adapted by the Knoppix developers. The /usr/sbin/mkxf86config itself comes from the xf86config-knoppix package, together with some templates for temporary XF86Config files that are used during the X server configuration.

So, to have knoppix-grade hardware detection and xserver configuration on a regular debian system, we just need to get those packages, and run mkxf86config. Here is a procedure :


	#!/bin/bash
	# Adds Knoppix msxf86config xserver configuration tool on a Debian system
	# run this after your usual base Debian (text mode) setup 
	# http://users.telenet.be/mydotcom/howto/linux/debianknoppix.htm
	# Koen Noens
	#
	# july 2006	: made it more script-like (conditional statements, put filenames in vars, add some checks ...)
	# february 2006	: initial script (just a batch of commands)
	################################################################

	# declare and initialize variables
	#
	APT_BIN="deb http://debian-knoppix.alioth.debian.org/ ./"
	XWINCONF="XF86Config-4"

	#TODO: get user input for these
	KEYB_MODEL="pc102"
	KEYB_LAYOUT="be"

	# main
	#

	# install x windows system and window manager -- modify at will
	### if we create a .deb package, these would become dependencies
	echo installing x-window-system and some extras
	apt-get -y install --force-yes x-window-system
	apt-get -y install --force-yes xserver-xfree86			
	aptitude -y install --with-recommends fvwm
	echo installing some extras
	apt-get -y install --force-yes perl gnupg vim ssh

	# Knoppix packages are at $APT_BIN so we modify sources.list if grep can't find them there.
	echo updating sources.list
	if grep "$APT_BIN" /etc/apt/sources.list; then
		echo sources.list ok
	else
		echo adding $APT_BIN and updating apt
		echo $APT_BIN >> /etc/apt/sources.list
		apt-get update
	fi
	cd ~

	###################installing knoppix stuff ###############################
	#
	# here, we install the knoppix packages, let knoppix mkxf86config do its magic
	# and replace the original X congig file by the one generated by mkxf86config
	#
		
	# install hwsetup (knoppix version)
	echo installing knoppix packages
	apt-get -y install hwdata-knoppix hwsetup ddcxinfo-knoppix xf86config-knoppix
	
	# run hardware detection and xserver setup tools. 
	echo backing up old X config
	pushd /etc/X11
	for i in $(find XF86Config*); do
		cp /etc/X11/$i /etc/X11/$i.movedbyKnoppix
	done
	popd

	echo detecting hardware 
	hwsetup -p -a -s
	mkxf86config	

	# almost there ...
	# Knoppix defaults to standard US querty keyboard, but in Belgium we use 'Belgian AZERTY'. 
	# Boot options to change keyboard, as you would do when booting a knoppix CD, 
	# are not available in the setup described here, so we just 'find and replace' with sed
	# syntax is: sed -i 's/oldstuff/newstuff/' file ;  replace with values appropriate for your keyboard 
	# (refer to KEYB_MOD and KEYB_LAYOUT variables)
	
	echo editing xorg.conf : keyboard model, ....
	sed -i 's/"XkbModel".*$/"XkbModel" "$KEYB_MODEL"/' /etc/X11/$XWINCONF
	sed -i 's/"XkbLayout".*$/"XkbLayout" "$KEYB_LAYOUT"/' /etc/X11/$XWINCONF
	

startx, ... and bingo ! a fully automated knoppix-quality optimized graphical display on a Debian system.

make a package out of it ?

It is fairly easy to run this script on a base Debian (stable) system to improve the Xserver configuration. We can also make a Debian package out of it, that contains this script, and has the knoppix tools as 'dependencies'. This will let you install and reconfigure the xserver by installing the package with apt-get install.

Xorg

Knoppix 5 is now using xorg xwindow server in stead of xf86free, but at the time of writing, the knoppix packages discussed here still generate XF86Config files. Debian will switch to xorg at the next release; xorg is already available in the 'testing' release. Xorg is more geared towards auto-configuration than Xf86 was, so maybe this procedure will become obsolete soon. If not, it's probably not too hard to rewrite it for xorg.


Koen Noens
July 2006