mirror of
https://github.com/krislamo/kernmod.git
synced 2024-11-14 02:00:35 +00:00
Compare commits
No commits in common. "42c46c05562dc66ec9ed15ed4e5e437ac813a200" and "e48f1aaf3cc4c0c604604070c455f1fe22d70ded" have entirely different histories.
42c46c0556
...
e48f1aaf3c
7
.gitignore
vendored
7
.gitignore
vendored
@ -1 +1,8 @@
|
|||||||
|
*.cmd
|
||||||
|
*.ko
|
||||||
|
*.mod*
|
||||||
|
*.o
|
||||||
|
.helloworld.o.d
|
||||||
.vagrant
|
.vagrant
|
||||||
|
Module.symvers
|
||||||
|
modules.order
|
||||||
|
78
build.sh
78
build.sh
@ -1,65 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Initial variables
|
|
||||||
PACKAGE="helloworld"
|
PACKAGE="helloworld"
|
||||||
VERSION="0.1"
|
VERSION="0.1"
|
||||||
REVISION="1"
|
REVISION="1"
|
||||||
SRCDIR="/vagrant/src"
|
BUILDDIR="$(mktemp -d)/${PACKAGE}_$VERSION-$REVISION"
|
||||||
SCRATCH="/vagrant/scratch"
|
|
||||||
OUTDIR="$SCRATCH"
|
|
||||||
TEMPDIR="$(mktemp -d)"
|
|
||||||
INSTALL=0
|
|
||||||
BUILDDIR="$TEMPDIR/${PACKAGE}_$VERSION-$REVISION"
|
|
||||||
|
|
||||||
# Build debian package
|
# Place sources and build package
|
||||||
function build_deb {
|
mkdir -p "$BUILDDIR/usr/src/${PACKAGE}-$VERSION"
|
||||||
[ $INSTALL -eq 1 ] && install_headers
|
mkdir -p "$BUILDDIR/etc"
|
||||||
mkdir -p "$BUILDDIR/usr/src/${PACKAGE}-$VERSION"
|
mkdir -p "$BUILDDIR/DEBIAN"
|
||||||
mkdir -p "$BUILDDIR/etc"
|
cp -r /vagrant/src/usr/src/* "$BUILDDIR/usr/src/${PACKAGE}-$VERSION"
|
||||||
mkdir -p "$BUILDDIR/DEBIAN"
|
cp -r /vagrant/src/etc/* "$BUILDDIR/etc"
|
||||||
cp -r $SRCDIR/usr/src/* "$BUILDDIR/usr/src/${PACKAGE}-$VERSION"
|
cp -r /vagrant/src/DEBIAN/* "$BUILDDIR/DEBIAN"
|
||||||
cp -r $SRCDIR/etc/* "$BUILDDIR/etc"
|
cd "$BUILDDIR/.."
|
||||||
cp -r $SRCDIR/DEBIAN/* "$BUILDDIR/DEBIAN"
|
dpkg-deb --build "${PACKAGE}_$VERSION-$REVISION"
|
||||||
cd "$TEMPDIR"
|
|
||||||
dpkg-deb --build "${PACKAGE}_$VERSION-$REVISION"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Display details on module
|
# Install package
|
||||||
function info_mod {
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
modinfo "$PACKAGE"
|
apt-get update
|
||||||
cat /proc/modules | grep "$PACKAGE"
|
apt-get install -y linux-headers-$(uname -r)
|
||||||
rmmod "$PACKAGE"
|
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
||||||
modprobe "$PACKAGE"
|
|
||||||
cat /var/log/messages | grep "$PACKAGE"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install Linux headers for current kernel
|
# Load module and show details about it
|
||||||
function install_headers {
|
modinfo helloworld
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
cat /proc/modules | grep helloworld
|
||||||
apt-get update
|
rmmod helloworld
|
||||||
apt-get install -y linux-headers-$(uname -r)
|
modprobe helloworld
|
||||||
}
|
cat /var/log/messages | grep helloworld
|
||||||
|
|
||||||
# Build and install helloworld module or module(s) in $SCRATCH
|
|
||||||
set -x
|
|
||||||
if [ ! -z "$(ls -Al $SCRATCH | grep -e ^d)" ]; then
|
|
||||||
cd "$SCRATCH"
|
|
||||||
for d in */ ; do
|
|
||||||
if [ -f "$(basename $d)/override.sh" ]; then
|
|
||||||
SRCDIR="$(pwd)/$(basename $d)"
|
|
||||||
. "$(basename $d)/override.sh"
|
|
||||||
build_deb
|
|
||||||
if [ $INSTALL -eq 1 ]; then
|
|
||||||
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
|
||||||
info_mod
|
|
||||||
fi
|
|
||||||
cp "./${PACKAGE}_$VERSION-$REVISION.deb" \
|
|
||||||
"$OUTDIR/${PACKAGE}_$VERSION-$REVISION-$(date +%s).deb"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
INSTALL=1
|
|
||||||
build_deb
|
|
||||||
apt-get install -y "./${PACKAGE}_$VERSION-$REVISION.deb"
|
|
||||||
info_mod
|
|
||||||
fi
|
|
||||||
|
2
scratch/.gitignore
vendored
2
scratch/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
Loading…
Reference in New Issue
Block a user