#!/bin/bash # load the target kernel version in tmp/UNAME_R # If that file doesn't exist or does not match the latest installed kernel, # then ./prepare likely hasn't been run for that kernel, so we exit. UNAME_R_FILE="tmp/UNAME_R" UNAME_R="`[ -f "$UNAME_R_FILE" ] && cat "$UNAME_R_FILE" || echo -n ""`" UNAME_R_TEST="`rpm -q kernel --last | head -n1 | sed -e 's/^kernel-//g' -e 's/\s.*//g'`" if [ "$UNAME_R" != "$UNAME_R_TEST" ]; then echo "error: prepare must be run first for kernel $UNAME_R_TEST" >&2 exit 1 fi cd rpmbuild cd BUILD/kernel-`egrep -o '^[0-9]+\.[0-9]+' <<< "$UNAME_R"`.`egrep -o 'fc[0-9]+' <<< "$UNAME_R"` cd linux-"$UNAME_R" # sudo make SUBDIRS=drivers/media/usb/cx231xx modules_install # I don't think this works sudo cp -p drivers/media/usb/cx231xx/*.ko \ /lib/modules/"$UNAME_R"/kernel/drivers/media/usb/cx231xx/ sudo chown root:root /lib/modules/"$UNAME_R"/kernel/drivers/media/usb/cx231xx/*.ko sudo depmod "$UNAME_R" if [ "$UNAME_R" = "`uname -r`" ]; then sudo modprobe cx231xx R=$? if [ $R -eq 0 ]; then echo "The patched driver/module has been installed and loaded." >&2 else echo "The patched driver/module has been installed, but could not be loaded." >&2 echo "Run \`dmesg\` for more info." >&2 exit $R fi else echo "The patched driver/module has been installed. Please reboot into" >&2 echo "kernel $UNAME_R to use it." >&2 fi