summaryrefslogtreecommitdiff
path: root/mkmodloop
blob: f85b6283978e82c8d6d675578c852081f1ec32bd (plain) (blame)
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
#!/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"
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/lib $dest