summaryrefslogtreecommitdiffstats
path: root/mkmodloop
diff options
context:
space:
mode:
Diffstat (limited to 'mkmodloop')
-rw-r--r--mkmodloop39
1 files changed, 39 insertions, 0 deletions
diff --git a/mkmodloop b/mkmodloop
new file mode 100644
index 0000000..a3723cc
--- /dev/null
+++ b/mkmodloop
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+msg() {
+ echo "==>" $@
+}
+
+die() {
+ echo $@
+ exit 1
+}
+
+image=$PWD/modloop
+dest=$PWD/modloop.cmg
+init=init
+
+
+kernel=$1
+# if no kernel specified, then guess...
+if [ -z "$kernel" ]; then
+ kernel=$(ls /lib/modules 2>/dev/null | tail -n 1)
+fi
+
+if [ ! -d /lib/modules/$kernel ]; then
+ die "modules dir /lib/modules/$kernel was not found"
+fi
+msg "Using kernel $kernel"
+
+
+rm -rf "$image"
+mkdir -p "$image/lib/modules" "$image/lib"
+
+cp -alf /lib/firmware $image/lib/
+cp -alf /lib/modules/$kernel $image/lib/modules/
+
+depmod -b "$image" $kernel
+
+rm -f $image/lib/modules/$kernel/source $image/lib/modules/$kernel/build
+
+mkcramfs $image $dest