summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>2001-04-03 21:46:55 +0000
committerErik Troan <ewt@redhat.com>2001-04-03 21:46:55 +0000
commitcaf635438c3aafe89c7f90165e8aa8da9840cdad (patch)
treee6c8da780453f15e30745bb06b042fb1df7de14f /scripts
parent845c5472803f5f55956bb3cd5ee92d91e3a44548 (diff)
downloadanaconda-caf635438c3aafe89c7f90165e8aa8da9840cdad.tar.gz
anaconda-caf635438c3aafe89c7f90165e8aa8da9840cdad.tar.xz
anaconda-caf635438c3aafe89c7f90165e8aa8da9840cdad.zip
*** empty log message ***
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mk-dd84
1 files changed, 84 insertions, 0 deletions
diff --git a/scripts/mk-dd b/scripts/mk-dd
new file mode 100755
index 000000000..8a9f369a8
--- /dev/null
+++ b/scripts/mk-dd
@@ -0,0 +1,84 @@
+#!/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>"
+}
+
+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."