1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#!/bin/bash
# This scripts creates the files for a driver disk from a driver source
# file. The script follows symbolic links and other nasty things, so don't
# trust it overly much.
#
# To run it, install the kernel-source RPM that you want to build the drivers
# for. You will also need the anaconda-runtime package installed. Once these
# are installed, run this script with the source file name for the module and
# the kernel version as it's arguments. For example:
#
# ./mk-dd eepro100.c 2.4.2-0.1.49
#
# might be appropriate for you.
#
# Drivers will be generated for the uniprocessor, smp, BOOT, and enterprise
# kernels. If you don't need all of these, you may remove the extra drivers
# from the modules.cgz file. If you would like to have drivers for other
# kernels on the same driver disk, repeat this process against a different
# kernel, and combine the modules.cgz files (unpack each one in the same
# place, and repack them with something like "find . -type f | cpio -H crc
# -o | gzip -9 > /some/driver/disk/modules.cgz").
#
# When mk-dd completes, the files in /tmp/modules comprise a driver disk.
# Copy these to a dos or ext2 floppy, and you're all set.
#
# Please note that this script is intended as an example to guide you in
# creating driver disks. Another (in many ways, better) solution is available
# at http://people.redhat.com/~dledford. This driver development kit is
# recommended for most uses.
version=$2
srcname=$1
modversions=$(rpm -ql kernel-source-$version | grep modversions.h)
usage() {
echo "usage: ./mk-dd <source.c> <kernel-version>"
exit 1
}
if [ ! -x /usr/lib/anaconda-runtime/modlist -o ! -f /usr/lib/anaconda-runtime/loader/module-info ]; then
echo "You need to have anaconda-runtime installed."
usage
fi
if [ ! -f "$srcname" -o ! -f $modversions ]; then
echo "either $srcname or $modversions doesn't exist"
usage
fi
rm -rf /tmp/modules
mkdir /tmp/modules
name=$(echo $srcname | sed 's/\.c$//')
obj=${name}.o
for kinfo in UP- SMP-smp ENTERPRISE-enterprise BOOT-BOOT; do
n=$(echo $kinfo | cut -d- -f1)
dir=/tmp/modules/${version}$(echo $kinfo | cut -d- -f2)
echo -n "Building $n..."
mkdir $dir
gcc -D__BOOT_KERNEL_${n}=1 -I/usr/src/linux-2.4.2/include -include $modversions -DMODVERSIONS -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -c $srcname -o $dir/$obj
rc=$?
echo
if [ "$rc" != 0 ]; then
exit 1
fi
done
cd /tmp/modules
find ${version}* -type f | cpio --quiet -H crc -o | gzip -9 > modules.cgz
rm -rf ${version}*
echo "$name driver disk" > rhdd-6.1
touch pcitable
touch modules.dep
/usr/lib/anaconda-runtime/modlist -m -f /usr/lib/anaconda-runtime/loader/module-info $name | sed 's/ "/ "Updated /' > modinfo
echo "Copy the contents of /tmp/modules to a diskette to create a driver disk."
|