#!/bin/bash

# I copied over the modules from:
# http://www.freemoe.org/users/jebba/kernel/modules/2.6.28-omap1/
# and put them in /lib/modules/2.6.28-omap1-jebmods

# If it says "File exists" it means that it is already in the stock
# kernel and loaded. So it's ok.

# If it says "Unknown symbol in module" it means there is something
# missing in the kernel, so it isn't going to work.

# If it just says "foo.ko" and nothing more, it means it inserted OK
# and is now a usable kernel module.


cd /lib/modules/2.6.28-omap1-jebmods

# Copy over modules that aren't there already.
# Yes, this seems odd way to do it, but busybox has no `cp -n`.
for i in *.ko
do echo $i
	if [ -f /lib/modules/2.6.28-omap1/$i ] ; then
		echo "$i exists"
	else
		echo "Adding $i"
		sudo cp -p $i /lib/modules/2.6.28-omap1
	fi
done

sudo depmod -ae

for i in *ko
do echo "-----------------------"
	echo $i
	sudo modprobe `basename $i .ko`
done &>/home/user/modprobe-test.log

