Left Arrow Back to Homepage of KG

Linux: My Contributions to free software

Hint: This page contains mostly historical stuff. I still keep it around ... There's a few pieces here which I still actively maintain, namely the rescan-scsi-bus script, the dd_rescue program, and bonnie.
I really enjoy using free software, especially Linux, which I started to work with in late 1994. It's been more stable and reliable than the alternatives. A decade later, with the software then, it got even user-friendly, so MS felt threatened by it. Read the "Halloween document", which was written by an MS employee.

For more insight into the reasons why Open Source Software has such a high quality and outperforms many commercial products, read "The cathedral and the bazaar" from Eric S. Raymond and have a look at the Free Software Foundation. Another more recent investigation of the Linux development focuses on the management aspects of the distributed development effort.

For more info on Linux, see Linux, Linux Documentation Project, Kernel history, , Linux kernel mailing list FAQ,
SuSE, Debian, RedHat.
German Linux pages.
Moreover, I'd like to give you a pointer to an article about the philosophy of Un*x and Linux.

Some of my contributions to the development of Linux:

DC390 driver

There is one Linux kernel driver maintained by me: The Tekram DC390(T) SCSI driver (called tmscsim). It supports all sorts of AM53C974 based adapters. It went into the latest kernels (2.0.37pre1, 2.1.127). See the dc390 directory for a history of the driver. There you can also find links to download it, if it's not yet included into your kernel.

DC395 driver

A driver for the new Tekram DC395/DC315 SCSI adapters can be found on this page.

SuSE stuff

I'm working part time for SuSE and have some documents there.


As of kernel 2.4.19rc1/2.5.25, Linux supports only up to 128 SCSI disks (as it allocates 8 block device major numbers). I've a patch collection that allows more than 2000 disks on my SuSE pages on this subject.


My Linux on my Laptop page.

Framebuffer (Matrox, nVidia) backport

As I liked the multihead support for Matrox G400 in the 2.4 matroxfb driver, I backported it to 2.2.17pre10. More exactly to a 2.2.16-SuSE (as in the upcoming SuSE Linux 7.0), which contains additional patches to update some drivers. So, your mileage to apply it may vary. Sorry! (Update: You will probably get around using the bttv update patch) Anyway, here is the diff (V3) to get the 2.4.0-test3 drivers for matroxfb and rivafb working with the 2.2 kernel. RivaFB does really work now, yes. Old versions: V2 and V1.

The backport has been sent to Petr Vandrovecz (the author of matroxfb); he has put a version, where he merged the bttv- and the i2c-update with my backport (V1). His version can be applied cleanly against an official kernel tree. I plan to merge it my latest backport ...

Console font stuff

Now, having the new matroxfb and rivafb driver in kernel, you may also want to use nice high resolutions without this resulting in tiny fonts. There is one rather large font in the kernel, the sun12x22 font.
Unfortunately, the kbd utils (as of 0.99) can't handle fonts with non-standard (8) width, so you can't even easily extract it from the kernel or load it later. Here is a fix for setfont. I will send it to the maintainer and ask for inclusion. I created another patch to enable the compose combinations for latin1 fonts and to map the compose key to the W*n9x Menu key (and to Shift - Right Ctrl). This is currently only enabled for the US and the DE keyboard maps, as I don't know about others :-(
Update (2000-07-25): The kbd-setfont is not necessary for new (>1.00) versions of kbd. Unfortunately, I based my work on 0.99 :-(
Update (2000-08-01): I created a patch against 1.03wip. You still need the compose patch ...

The sun12x22 font has a few deficiencies, IMHO. Firstly, it does not contain a Euro symbol. Secondly, I found some letters and signs not really fitting well to the overall beautiful design. Thirdly, some more useful characters were missing as well. I did address these issues and created a new font, which I called suse12x22, as I work for SuSE and also to reflect the similarity to the sun12x22 font. You can download a patch to your kernel as well as a font (with unimap), which can be loaded with (the fixed) setfont.
Here is a 1152x858 fbcon mode (73.6kHz hsync, 80Hz vsync), which works well on the TNT2 (with 32MB and an iiyama VM 403 screen) with the suse12x22 font here.
Update (2000-07-26): Here is an updated suse12x22 font that works with the new (patched) kbd-1.03wip.

More kernel patches: K6 and (Cyrix/IBM) 6x86 - patches. These will probably not go into the kernel ...

Cyrix/IBM 6x86 patches

... to be written ...
Now, as the newer standard kernels have satisfactory support for CPU detection and as there exist userspace tools (set6x86) to do the rest, we don't need them any longer.

AMD K6 WA-enable module

This little module enables L1 cache Write Allocation for the first 508Mb of main memory. This will resuolt in a few percent increased performance for most apps. (Note that it is possible, that your specific app gets slower.) This should normally be done by your BIOS, but there a lot of users upgrading old boards with K6/K6-2. It should be noted, that there is a K6-2 with a newer core, where this module won't work, as AMD has changed the control registers.
This module (source code) can be downloaded here. Look into the source code for docu. It will enable WA on insertion and restore the original state on removal.

Two small kernel patches

The 2GB Patch allows the usage of up to 2GB physical memory on ix86 machines. (Normally the Linux kernel supports only 1GB of physical memory in favour of more virtual memory per process.) Please note that there exist much better solutions by now (BIGMEM), which support up to 4GB (or even 64GB with PSE36) and which do NOT limit the per process address-space from 3GB to 2GB.

HZ=400 on ix86 This patch increases the frequency of the scheduler, which might be nice for multithreaded applications. At least, it is for mine. Starting from Linux-2.2.2pre1 (and 2.2.1-ac4) you need this file instead.


I created a bootdisk with LILO, a Linux kernel, and an INITRD containing modules and a lot of small tools. This might be useful, if you seriously crashed your box, if you just want to do diagnosis or if you have problems with the kernel images provided by your distribution in order to install Linux. There are two versions: An old one (bootdisk.gz) (kernel 2.0.33) and a new on (bootdsk2.gz) (kernel 2.0.36, with more tools). Also please read the docu: bootdisk.readme resp. bootdsk2.README. The later bootdisk does NOT fit on a 1440k floppy, but you need to format it with 21 sectors/track to get 1680k. This can be done by fdformat /dev/fd0u1680 or superformat -2 -s21 /dev/fd0 under Linux or with vgacopy under D*S. It's also the reason, why the old floppy is still there.

Rescan SCSI bus

Linux allows you to add and remove SCSI devices without rebooting by using the echo "scsi add-single-device H C I L" > /proc/scsi/scsi command (H = host, C = channel, I = SCSI ID, L = SCSI LUN). The remove-single-device command works similarily.
Note, however, that the SCSI bus was NOT designed for hot-plugging, so you might be out of luck ... And you have to be sure, that termination is OK. All filesystems on a device have to be unmounted before disconnecting it or powering it down.

I use the script rescan-scsi-bus.sh to do this.

v1.57 (2012-03-31)
Fix sg_inq version parsing for versions >= 1.00. Fix shell error reported by Martin Mokrijs.
v1.56 (2012-01-15)
Sort SCSI adapters numerically (from Mike Busse). Slight formatting improvements. Avoid direct readdition after removal, as this would always succeed, so we don't really know about the presence of a device (from Hannes Reinecke). Do iterative scan after LIP reset, so we do all the counting etc. right (also from Hannes). Issue warning if sg3_utils are missing (inspired by Alan McKay).
v1.48 (2010-08-10)
If no channel is detected, still scan channel 0 (bug fix). Don't wait too long for NOT READY devices if they are removable (optimization). Print warning when calling udevadm settle (as it can take a while in the worst case). Avoid calling udevadm settle on device removal (this is where it needlessly takes a long time); call a short usleep where we don't call udevadm settle. Sync filesystems before a potential LUN removal; can be controlled by --sync/--nosync flags. Provide options to change kernel scanning flags (2.6 kernel only): --attachpq3, --reportlun2, --sparselun, --largelun.
v1.41 (2010-06-01)
Indentation fixes (from Hannes). Call udevadm settle after doing 2.6 style scan commands; handle unit attention and "in progress of becoming ready" in sg_turs. Support removal of LUNs if LUN0 is gone already.
v1.38 (2010-05-31)
Fixed a few issues in doreportlun scan; new devices were detected, but not displayed (and counted) as new; old ones were not removed consistently. Fixed. Also make sure we don't change parameters that have been passed from the command line. Also merged two fixes from Hannes: Always invoke rescan on fibre channel adapters and handle return value better in case devices are offline/not connected.
v1.35 (2009-11-19)
Fixed LUN0 handling, be more careful to check vars before evaluation, implement --forcerescan (all from Hannes Reinecke). Check for permissions before spitting out errors due to missing privileges (Kurt). Sort host adapter IDs numerically and avoid double LUN 0 output with doreportlun scan (Kurt). Make sure not to expand "*" to files in current dir (thanks to J.D. Soerensen for spotting this!).
v1.29 (2008-10-29)
Minor cleanups; more fixes from Hannes (sg_len); sort host adapters numerically; work without /proc/scsi (thanks to Clemens Ladisch).
v1.25 (2007-07-19)
Merge work from Hannes Reinecke to add REPORT_LUNS scan support, and optional LIP reset support.
v1.24 (2006-07-29)
Better support for 2.6 kernels, option -L.
v1.19 (2005-10-09)
Only remove (and readd) all devices with --forceremove; fix bugs on INQUIRY match.
v1.15 (2004-05-08)
Initial 2.6 support: Use sysfs for data collection.
v1.11 (2003-10-24)
Fix --luns parameter, fix LUN matching. --nooptscan parameter.
v1.7 (2003-07-16)
Initial broad public release.

SCSI bugfixes

Here are two bugfixes for the SCSI layer of Linux, diffed against 2.2.12.
The first one prevents SCSI high level devices (sd, sr, sg, st) from being loaded in spite of being staticaaly compiled into the kernel and clobbering the device lists. It also fixes the module usage counters. Oops! The aforementioned patch missed a chunk. Get it here!
The second one fixes a problem that arises, if a disk has an unsupported sector size. Without this patch, this would have caused a deadlock and an Oops.

scsidev utility

If for some reason, the dynamic assignment of device numbers to SCSI devices of Linux is not suitable for your system, have a look at the scsidev page.


Bonnie is a little tool that measures the speed of your filesystem. Have a look at the bonnie page.


dd_rescue is a little tool that helps you when nobody else does: Your harddisk crashed and contains unreadable data. Standard Un*x tools like cp or dd just abort on every error, dd_rescue doesn't. Look at the dd_rescue page.


A lot of minor contributions have been made to modify existing software packages, such as mingetty, mount, viewfax, egcs, ...
These are collected on my Free Software page. You may be looking for gcc inlining page.
(w) by KG, last changed 2007-07-19